Skip to content

Commit cebbc83

Browse files
committed
rename volume-id -> scene-id, and clarify example
1 parent 9efbc12 commit cebbc83

File tree

1 file changed

+0
-40
lines changed

1 file changed

+0
-40
lines changed

dash_3d_viewer/slicer.py

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,9 @@ class DashVolumeSlicer:
1414
app (dash.Dash): the Dash application instance.
1515
volume (ndarray): the 3D numpy array to slice through.
1616
axis (int): the dimension to slice in. Default 0.
17-
<<<<<<< HEAD
1817
scene_id (str): the scene that this slicer is part of. Slicers
1918
that have the same scene-id show each-other's positions with
2019
line indicators. By default this is a hash of ``id(volume)``.
21-
=======
22-
volume_id (str): the id to use for the volume. By default this is a
23-
hash of ``id(volume)``. Slicers that have the same volume-id show
24-
each-other's positions with line indicators.
25-
>>>>>>> Implement indicators
2620
2721
This is a placeholder object, not a Dash component. The components
2822
that make up the slicer can be accessed as attributes:
@@ -35,26 +29,16 @@ class DashVolumeSlicer:
3529
Each component is given a dict-id with the following keys:
3630
3731
* "context": a unique string id for this slicer instance.
38-
<<<<<<< HEAD
3932
* "scene": the scene_id.
4033
* "axis": the int axis.
4134
* "name": the name of the (sub) component.
42-
=======
43-
* "volume": the volume_id.
44-
* "axis": the int axis.
45-
* "name": the name of the component.
46-
>>>>>>> Implement indicators
4735
4836
TODO: iron out these details, list the stores that are public
4937
"""
5038

5139
_global_slicer_counter = 0
5240

53-
<<<<<<< HEAD
5441
def __init__(self, app, volume, axis=0, scene_id=None):
55-
=======
56-
def __init__(self, app, volume, axis=0, volume_id=None):
57-
>>>>>>> Implement indicators
5842
if not isinstance(app, Dash):
5943
raise TypeError("Expect first arg to be a Dash app.")
6044
self._app = app
@@ -67,7 +51,6 @@ def __init__(self, app, volume, axis=0, volume_id=None):
6751
raise ValueError("The given axis must be 0, 1, or 2.")
6852
self._axis = int(axis)
6953
# Check and store id
70-
<<<<<<< HEAD
7154
if scene_id is None:
7255
scene_id = "volume_" + hex(id(volume))[2:]
7356
elif not isinstance(scene_id, str):
@@ -76,16 +59,6 @@ def __init__(self, app, volume, axis=0, volume_id=None):
7659
# Get unique id scoped to this slicer object
7760
DashVolumeSlicer._global_slicer_counter += 1
7861
self.context_id = "slicer_" + str(DashVolumeSlicer._global_slicer_counter)
79-
=======
80-
if volume_id is None:
81-
volume_id = hex(id(volume))
82-
elif not isinstance(volume_id, str):
83-
raise TypeError("volume_id must be a string")
84-
self.volume_id = volume_id
85-
# Get unique id scoped to this slicer object
86-
DashVolumeSlicer._global_slicer_counter += 1
87-
self.context_id = "slicer" + str(DashVolumeSlicer._global_slicer_counter)
88-
>>>>>>> Implement indicators
8962

9063
# Get the slice size (width, height), and max index
9164
arr_shape = list(volume.shape)
@@ -164,11 +137,7 @@ def _subid(self, name):
164137
# todo: is there a penalty for using a dict-id vs a string-id?
165138
return {
166139
"context": self.context_id,
167-
<<<<<<< HEAD
168140
"scene": self.scene_id,
169-
=======
170-
"volume-id": self.volume_id,
171-
>>>>>>> Implement indicators
172141
"axis": self._axis,
173142
"name": name,
174143
}
@@ -248,7 +217,6 @@ def _create_client_callbacks(self):
248217
let x0 = 0, y0 = 0, dx = 1, dy = 1;
249218
//slice_cache[new_index] = undefined; // todo: disabled cache for now!
250219
// Maybe we do not need an update
251-
console.log(slice_size)
252220
if (!data) {
253221
data = lowres[index];
254222
// Scale the image to take the exact same space as the full-res
@@ -319,22 +287,14 @@ def _create_client_callbacks(self):
319287
y: y,
320288
hoverinfo: 'skip',
321289
version: version
322-
<<<<<<< HEAD
323290
};
324-
=======
325-
}
326-
>>>>>>> Implement indicators
327291
}
328292
""",
329293
Output(self._subid("_indicators"), "data"),
330294
[
331295
Input(
332296
{
333-
<<<<<<< HEAD
334297
"scene": self.scene_id,
335-
=======
336-
"volume-id": self.volume_id,
337-
>>>>>>> Implement indicators
338298
"context": ALL,
339299
"name": "index",
340300
"axis": axis,

0 commit comments

Comments
 (0)