We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cbd299e commit 6e1c9e1Copy full SHA for 6e1c9e1
dash_slicer/slicer.py
@@ -7,6 +7,9 @@
7
from .utils import img_array_to_uri, get_thumbnail_size, shape3d_to_size2d
8
9
10
+_assigned_scene_ids = {} # id(volume) -> str
11
+
12
13
class VolumeSlicer:
14
"""A slicer to show 3D image data in Dash.
15
@@ -87,7 +90,8 @@ def __init__(
87
90
88
91
# Check and store scene id, and generate
89
92
if scene_id is None:
- scene_id = "volume_" + hex(id(volume))[2:]
93
+ n = len(_assigned_scene_ids)
94
+ scene_id = _assigned_scene_ids.setdefault(id(volume), f"vol{n}")
95
elif not isinstance(scene_id, str):
96
raise TypeError("scene_id must be a string")
97
self._scene_id = scene_id
0 commit comments