@@ -28,28 +28,29 @@ import dash_html_components as html
28
28
from dash_slicer import VolumeSlicer
29
29
import imageio
30
30
31
- app = dash.Dash(__name__ )
31
+ app = dash.Dash(__name__ , update_title = None )
32
32
33
33
vol = imageio.volread(" imageio:stent.npz" )
34
34
slicer = VolumeSlicer(app, vol)
35
+
35
36
app.layout = html.Div([slicer.graph, slicer.slider, * slicer.stores])
36
37
37
38
if __name__ == " __main__" :
38
- app.run_server()
39
+ app.run_server(debug = True , dev_tools_props_check = False )
39
40
```
40
41
41
42
42
43
## License
43
44
44
- This code is distributed under MIT license.
45
+ This code is distributed under the MIT license.
45
46
46
47
47
48
## Developers
48
49
49
50
50
51
* Make sure that you have Python with the appropriate dependencies installed, e.g. via ` venv ` .
51
52
* Run ` pip install -e . ` to do an in-place install of the package.
52
- * Run the examples using e.g. ` python examples/slicer_with_1_view .py `
53
+ * Run the examples using e.g. ` python examples/all_features .py `
53
54
54
55
* Use ` black . ` to autoformat.
55
56
* Use ` flake8 . ` to lint.
@@ -74,26 +75,26 @@ instantiation one can provide the following parameters:
74
75
* ` volume ` (` ndarray ` ): the 3D numpy array to slice through. The dimensions
75
76
are assumed to be in zyx order. If this is not the case, you can
76
77
use ` np.swapaxes ` to make it so.
77
- * ` spacing ` (tuple of ` float ` ): The distance between voxels for each
78
- dimension (zyx).The spacing and origin are applied to make the slice
78
+ * ` spacing ` (tuple of ` float ` ): the distance between voxels for each
79
+ dimension (zyx). The spacing and origin are applied to make the slice
79
80
drawn in "scene space" rather than "voxel space".
80
- * ` origin ` (tuple of ` float ` ): The offset for each dimension (zyx).
81
+ * ` origin ` (tuple of ` float ` ): the offset for each dimension (zyx).
81
82
* ` axis ` (` int ` ): the dimension to slice in. Default 0.
82
- * ` reverse_y ` (` bool ` ): Whether to reverse the y-axis, so that the origin of
83
+ * ` reverse_y ` (` bool ` ): whether to reverse the y-axis, so that the origin of
83
84
the slice is in the top-left, rather than bottom-left. Default True.
84
- Note: setting this to False affects performance, see #12 .
85
+ Note: setting this to False affects performance, see #12 . This has been
86
+ fixed, but the fix has not yet been released with Dash.
85
87
* ` scene_id ` (` str ` ): the scene that this slicer is part of. Slicers
86
88
that have the same scene-id show each-other's positions with
87
89
line indicators. By default this is derived from ` id(volume) ` .
88
- * ` color ` (` str ` ): the color for this slicer. By default the color is
89
- red, green, or blue, depending on the axis. Set to empty string
90
- for "no color".
91
- * ` thumbnail ` (` int ` or ` bool ` ): preferred size of low-resolution data to be
92
- uploaded to the client. If ` False ` , the full-resolution data are
93
- uploaded client-side. If ` True ` (default), a default value of 32 is
94
- used.
95
-
96
- Note that this is not a Dash component. The components that make
90
+ * ` color ` (` str ` ): the color for this slicer. By default the color
91
+ is a shade of blue, orange, or green, depending on the axis. Set
92
+ to empty string to prevent drawing indicators for this slicer.
93
+ * ` thumbnail ` (` int ` or ` bool ` ): the preferred size of low-resolution data
94
+ to be uploaded to the client. If ` False ` , the full-resolution data are
95
+ uploaded client-side. If ` True ` (default), a default value of 32 is used.
96
+
97
+ Note that this is not a Dash Component. The components that make
97
98
up the slicer (and which must be present in the layout) are:
98
99
` slicer.graph ` , ` slicer.slider ` , and ` slicer.stores ` .
99
100
@@ -104,7 +105,7 @@ can be used as output for `slicer.overlay_data`. The color
104
105
can be a hex color or an rgb/rgba tuple. Alternatively, color
105
106
can be a list of such colors, defining a colormap.
106
107
107
- ** property ` VolumeSlicer.axis ` ** (` int ` ): The axis at which the slicer is slicing .
108
+ ** property ` VolumeSlicer.axis ` ** (` int ` ): The axis to slice .
108
109
109
110
** property ` VolumeSlicer.graph ` ** : The ` dcc.Graph ` for this slicer. Use ` graph.figure ` to access the
110
111
Plotly Figure object.
@@ -171,8 +172,8 @@ To apply the position for one dimension only, use e.g `(None, None, x)`.
171
172
### Performance tips
172
173
173
174
There tends to be a lot of interaction in an application that contains
174
- slicer objects. Therefore, performance matters to realize a smooth user
175
- experience. Here are some tips to help with that:
175
+ slicer objects. To realize a smooth user experience, performance matters.
176
+ Here are some tips to help with that:
176
177
177
178
* Most importantly, when running the server in debug mode, consider setting
178
179
` dev_tools_props_check=False ` .
0 commit comments