Skip to content

Commit 7c65b3c

Browse files
Update options
- add PenType enum - semi-auto-update other options
1 parent b08821e commit 7c65b3c

File tree

5 files changed

+46
-2
lines changed

5 files changed

+46
-2
lines changed

docs/source/enums.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ Enums
1818
:undoc-members:
1919
:show-inheritance:
2020

21+
.. autoclass:: PenType
22+
:members:
23+
:undoc-members:
24+
:show-inheritance:
25+
2126
.. autoclass:: ShowRender
2227
:members:
2328
:undoc-members:

scripts/generate_config_options.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
_SNAKE_TO_CAMEL_OVERRIDES,
88
DragMode,
99
MultiplanarType,
10+
PenType,
1011
ShowRender,
1112
SliceType,
1213
)
@@ -65,6 +66,7 @@ def generate_config_options(options: dict[str, typing.Any]):
6566
"from ipyniivue.constants import (",
6667
" DragMode,",
6768
" MultiplanarType,",
69+
" PenType,",
6870
" ShowRender,",
6971
" SliceType,",
7072
")",
@@ -156,6 +158,7 @@ def generate_config_options(options: dict[str, typing.Any]):
156158
"fontColor": (0.5, 0.5, 0.5, 1.0),
157159
"selectionBoxColor": (1.0, 1.0, 1.0, 0.5),
158160
"clipPlaneColor": (0.7, 0.0, 0.7, 0.5),
161+
"paqdUniforms": (0.3, 0.5, 0.5, 1.0),
159162
"clipThick": 2.0,
160163
"clipVolumeLow": (0.0, 0.0, 0.0),
161164
"clipVolumeHigh": (1.0, 1.0, 1.0),
@@ -183,11 +186,15 @@ def generate_config_options(options: dict[str, typing.Any]):
183186
"meshThicknessOn2D": float("inf"),
184187
"dragMode": DragMode.CONTRAST,
185188
"dragModePrimary": DragMode.CROSSHAIR,
189+
# "mouseEventConfig": undefined, # not supported for
190+
# now because right click on jupyter notebook is buggy
191+
# "touchEventConfig": undefined,
186192
"yoke3Dto2DZoom": False,
187193
"isDepthPickMesh": False,
188194
"isCornerOrientationText": False,
189195
"isOrientationTextVisible": True,
190-
"heroImageFraction": 0,
196+
"showAllOrientationMarkers": False,
197+
"heroImageFraction": 0.0,
191198
"heroSliceType": SliceType.RENDER,
192199
"sagittalNoseLeft": False,
193200
"isSliceMM": False,
@@ -199,6 +206,7 @@ def generate_config_options(options: dict[str, typing.Any]):
199206
"dragAndDropEnabled": True,
200207
"drawingEnabled": False,
201208
"penValue": 1.0,
209+
"penType": PenType.PEN,
202210
"floodFillNeighbors": 6,
203211
"isFilledPen": False,
204212
"thumbnail": "",

src/ipyniivue/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
ColormapType,
77
DragMode,
88
MultiplanarType,
9+
PenType,
910
ShowRender,
1011
SliceType,
1112
)

src/ipyniivue/config_options.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from ipyniivue.constants import (
99
DragMode,
1010
MultiplanarType,
11+
PenType,
1112
ShowRender,
1213
SliceType,
1314
)
@@ -36,6 +37,7 @@ class ConfigOptions(t.HasTraits):
3637
font_color = t.Tuple((0.5, 0.5, 0.5, 1.0)).tag(sync=False)
3738
selection_box_color = t.Tuple((1.0, 1.0, 1.0, 0.5)).tag(sync=False)
3839
clip_plane_color = t.Tuple((0.7, 0.0, 0.7, 0.5)).tag(sync=False)
40+
paqd_uniforms = t.Tuple((0.3, 0.5, 0.5, 1.0)).tag(sync=False)
3941
clip_thick = t.Float(2.0).tag(sync=False)
4042
clip_volume_low = t.Tuple((0.0, 0.0, 0.0)).tag(sync=False)
4143
clip_volume_high = t.Tuple((1.0, 1.0, 1.0)).tag(sync=False)
@@ -71,7 +73,8 @@ class ConfigOptions(t.HasTraits):
7173
is_depth_pick_mesh = t.Bool(False).tag(sync=False)
7274
is_corner_orientation_text = t.Bool(False).tag(sync=False)
7375
is_orientation_text_visible = t.Bool(True).tag(sync=False)
74-
hero_image_fraction = t.Int(0).tag(sync=False)
76+
show_all_orientation_markers = t.Bool(False).tag(sync=False)
77+
hero_image_fraction = t.Float(0.0).tag(sync=False)
7578
hero_slice_type = t.UseEnum(SliceType, default_value=SliceType.RENDER).tag(
7679
sync=False
7780
)
@@ -85,6 +88,7 @@ class ConfigOptions(t.HasTraits):
8588
drag_and_drop_enabled = t.Bool(True).tag(sync=False)
8689
drawing_enabled = t.Bool(False).tag(sync=False)
8790
pen_value = t.Float(1.0).tag(sync=False)
91+
pen_type = t.UseEnum(PenType, default_value=PenType.PEN).tag(sync=False)
8892
flood_fill_neighbors = t.Int(6).tag(sync=False)
8993
is_filled_pen = t.Bool(False).tag(sync=False)
9094
thumbnail = t.Unicode("").tag(sync=False)
@@ -153,6 +157,7 @@ def __init__(self, parent=None, **kwargs):
153157
"font_color",
154158
"selection_box_color",
155159
"clip_plane_color",
160+
"paqd_uniforms",
156161
"clip_thick",
157162
"clip_volume_low",
158163
"clip_volume_high",
@@ -184,6 +189,7 @@ def __init__(self, parent=None, **kwargs):
184189
"is_depth_pick_mesh",
185190
"is_corner_orientation_text",
186191
"is_orientation_text_visible",
192+
"show_all_orientation_markers",
187193
"hero_image_fraction",
188194
"hero_slice_type",
189195
"sagittal_nose_left",
@@ -196,6 +202,7 @@ def __init__(self, parent=None, **kwargs):
196202
"drag_and_drop_enabled",
197203
"drawing_enabled",
198204
"pen_value",
205+
"pen_type",
199206
"flood_fill_neighbors",
200207
"is_filled_pen",
201208
"thumbnail",
@@ -265,6 +272,7 @@ def _propagate_parent_change(self, change):
265272
"fontColor": "font_color",
266273
"selectionBoxColor": "selection_box_color",
267274
"clipPlaneColor": "clip_plane_color",
275+
"paqdUniforms": "paqd_uniforms",
268276
"clipThick": "clip_thick",
269277
"clipVolumeLow": "clip_volume_low",
270278
"clipVolumeHigh": "clip_volume_high",
@@ -296,6 +304,7 @@ def _propagate_parent_change(self, change):
296304
"isDepthPickMesh": "is_depth_pick_mesh",
297305
"isCornerOrientationText": "is_corner_orientation_text",
298306
"isOrientationTextVisible": "is_orientation_text_visible",
307+
"showAllOrientationMarkers": "show_all_orientation_markers",
299308
"heroImageFraction": "hero_image_fraction",
300309
"heroSliceType": "hero_slice_type",
301310
"sagittalNoseLeft": "sagittal_nose_left",
@@ -308,6 +317,7 @@ def _propagate_parent_change(self, change):
308317
"dragAndDropEnabled": "drag_and_drop_enabled",
309318
"drawingEnabled": "drawing_enabled",
310319
"penValue": "pen_value",
320+
"penType": "pen_type",
311321
"floodFillNeighbors": "flood_fill_neighbors",
312322
"isFilledPen": "is_filled_pen",
313323
"thumbnail": "thumbnail",

src/ipyniivue/constants.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"ColormapType",
1111
"DragMode",
1212
"MultiplanarType",
13+
"PenType",
1314
"ShowRender",
1415
"SliceType",
1516
]
@@ -40,6 +41,25 @@ class SliceType(enum.Enum):
4041
RENDER = 4
4142

4243

44+
class PenType(enum.Enum):
45+
"""
46+
An enumeration of pen types for drawing tools.
47+
48+
Members
49+
-------
50+
PEN : int
51+
Standard pen (freehand drawing) (value 0).
52+
RECTANGLE : int
53+
Rectangle drawing mode (value 1).
54+
ELLIPSE : int
55+
Ellipse drawing mode (value 2).
56+
"""
57+
58+
PEN = 0
59+
RECTANGLE = 1
60+
ELLIPSE = 2
61+
62+
4363
class ShowRender(enum.Enum):
4464
"""
4565
An enumeration for specifying when to show rendering in NiiVue instances.

0 commit comments

Comments
 (0)