Skip to content

Commit 4013303

Browse files
Feat(options): Complete ConfigOptions
Finish options for [email protected]
2 parents 582dd62 + fbb2b33 commit 4013303

File tree

5 files changed

+300
-74
lines changed

5 files changed

+300
-74
lines changed

examples/mesh_layers.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"outputs": [],
4545
"source": [
4646
"nv = NiiVue(\n",
47-
" show_3d_crosshair=True, back_color=(1, 1, 1, 1), mesh_x_ray=0.3, is_colorbar=True\n",
47+
" show_3d_crosshair=True, back_color=(1, 1, 1, 1), mesh_xray=0.3, is_colorbar=True\n",
4848
")\n",
4949
"\n",
5050
"mesh_layer = {\n",

examples/prototypes/meshes_(GIfTI, FreeSurfer, MZ3, OBJ, STL, legacy VTK).ipynb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"source": [
4141
"# based on https://github.com/niivue/ipyniivue/blob/main/original_gallery.md#meshes-gifti-freesurfer-mz3-obj-stl-legacy-vtk\n",
4242
"nv = NiiVue(\n",
43-
" show_3d_crosshair=True, back_color=(1, 1, 1, 1), mesh_x_ray=0.3, is_colorbar=True\n",
43+
" show_3d_crosshair=True, back_color=(1, 1, 1, 1), mesh_xray=0.3, is_colorbar=True\n",
4444
")\n",
4545
"\n",
4646
"nv.load_meshes(\n",
@@ -59,7 +59,11 @@
5959
]
6060
}
6161
],
62-
"metadata": {},
62+
"metadata": {
63+
"language_info": {
64+
"name": "python"
65+
}
66+
},
6367
"nbformat": 4,
6468
"nbformat_minor": 4
6569
}

scripts/generate_config_options.py

Lines changed: 53 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from ipyniivue.constants import (
77
_SNAKE_TO_CAMEL_OVERRIDES,
88
DragMode,
9+
DragModePrimary,
910
MultiplanarType,
1011
ShowRender,
1112
SliceType,
@@ -61,7 +62,13 @@ def generate_config_options(options: dict[str, typing.Any]):
6162
'"""Defines a class for NiiVue configuration options."""',
6263
"",
6364
"import traitlets as t",
64-
"from .constants import DragMode, MultiplanarType, ShowRender, SliceType",
65+
"from ipyniivue.constants import (",
66+
" DragMode,",
67+
" DragModePrimary,",
68+
" MultiplanarType,",
69+
" ShowRender,",
70+
" SliceType,",
71+
")",
6572
"",
6673
'__all__ = ["ConfigOptions", "CAMEL_TO_SNAKE", "SNAKE_TO_CAMEL"]',
6774
"",
@@ -135,16 +142,22 @@ def generate_config_options(options: dict[str, typing.Any]):
135142
DEFAULT_OPTIONS = {
136143
"textHeight": 0.06,
137144
"colorbarHeight": 0.05,
138-
"crosshairWidth": 1,
139-
"crosshairGap": 0,
140-
"rulerWidth": 4,
145+
"colorbarWidth": -1.0,
146+
"showColorbarBorder": True,
147+
"crosshairWidth": 1.0,
148+
"crosshairWidthUnit": "voxels",
149+
"crosshairGap": 0.0,
150+
"rulerWidth": 4.0,
141151
"show3Dcrosshair": False,
142-
"backColor": (0, 0, 0, 1),
143-
"crosshairColor": (1, 0, 0, 1),
144-
"fontColor": (0.5, 0.5, 0.5, 1),
145-
"selectionBoxColor": (1, 1, 1, 0.5),
146-
"clipPlaneColor": (0.7, 0, 0.7, 0.5),
147-
"rulerColor": (1, 0, 0, 0.8),
152+
"backColor": (0.0, 0.0, 0.0, 1.0),
153+
"crosshairColor": (1.0, 0.0, 0.0, 1.0),
154+
"fontColor": (0.5, 0.5, 0.5, 1.0),
155+
"selectionBoxColor": (1.0, 1.0, 1.0, 0.5),
156+
"clipPlaneColor": (0.7, 0.0, 0.7, 0.5),
157+
"clipThick": 2.0,
158+
"clipVolumeLow": (0.0, 0.0, 0.0),
159+
"clipVolumeHigh": (1.0, 1.0, 1.0),
160+
"rulerColor": (1.0, 0.0, 0.0, 0.8),
148161
"colorbarMargin": 0.05,
149162
"trustCalMinMax": True,
150163
"clipPlaneHotKey": "KeyC",
@@ -154,24 +167,29 @@ def generate_config_options(options: dict[str, typing.Any]):
154167
"keyDebounceTime": 50,
155168
"isNearestInterpolation": False,
156169
"isResizeCanvas": True,
157-
"isAtlasOutline": False,
158170
"atlasOutline": 0.0,
159171
"isRuler": False,
160172
"isColorbar": False,
161173
"isOrientCube": False,
174+
"tileMargin": 0.0,
162175
"multiplanarPadPixels": 0,
163176
"multiplanarForceRender": False,
177+
"multiplanarEqualSize": False,
164178
"multiplanarShowRender": ShowRender.AUTO,
165179
"isRadiologicalConvention": False,
166180
"meshThicknessOn2D": float("inf"),
167181
"dragMode": DragMode.CONTRAST,
182+
"dragModePrimary": DragModePrimary.CROSSHAIR,
168183
"yoke3Dto2DZoom": False,
169184
"isDepthPickMesh": False,
170185
"isCornerOrientationText": False,
186+
"isOrientationTextVisible": True,
187+
"heroImageFraction": 0,
188+
"heroSliceType": SliceType.RENDER,
171189
"sagittalNoseLeft": False,
172190
"isSliceMM": False,
173191
"isV1SliceShader": False,
174-
"isHighResolutionCapable": True,
192+
"forceDevicePixelRatio": 0.0,
175193
"logLevel": "info",
176194
"loadingText": "loading ...",
177195
"isForceMouseClickToVoxelCenters": False,
@@ -194,12 +212,32 @@ def generate_config_options(options: dict[str, typing.Any]):
194212
"renderOverlayBlend": 1.0,
195213
"sliceMosaicString": "",
196214
"centerMosaic": False,
197-
"gradientAmount": 0.0,
198-
"gradientOpacity": 0.0,
199-
"forceDevicePixelRatio": 0,
215+
"penSize": 1.0,
216+
"interactive": True,
200217
"clickToSegment": False,
218+
"clickToSegmentRadius": 3.0,
219+
"clickToSegmentBright": True,
201220
"clickToSegmentAutoIntensity": False,
221+
"clickToSegmentIntensityMax": float("nan"),
222+
"clickToSegmentIntensityMin": float("nan"),
223+
"clickToSegmentPercent": 0.0,
224+
"clickToSegmentMaxDistanceMM": float("inf"),
202225
"clickToSegmentIs2D": False,
226+
"selectionBoxLineThickness": 4.0,
227+
"selectionBoxIsOutline": False,
228+
"scrollRequiresFocus": False,
229+
"showMeasureUnits": True,
230+
"measureTextJustify": "center",
231+
"measureTextColor": (1.0, 0.0, 0.0, 1.0),
232+
"measureLineColor": (1.0, 0.0, 0.0, 1.0),
233+
"measureTextHeight": 0.03,
234+
"isAlphaClipDark": False,
235+
"gradientOrder": 1,
236+
"gradientOpacity": 0.0,
237+
"renderSilhouette": 0.0,
238+
"gradientAmount": 0.0,
239+
"invertScrollDirection": False,
240+
"is2DSliceShader": False,
203241
}
204242
code = generate_config_options(DEFAULT_OPTIONS)
205243
loc = pathlib.Path(__file__).parent / "../src/ipyniivue/config_options.py"

0 commit comments

Comments
 (0)