Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: change image user layer UI labels #496

Merged
merged 10 commits into from
Nov 6, 2023
9 changes: 9 additions & 0 deletions python/neuroglancer/viewer_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ class BlendTool(Tool):
TOOL_TYPE = "blend"


@export_tool
class VolumeRenderingTool(Tool):
__slots__ = ()
TOOL_TYPE = "volumeRendering"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per the comment in the other PR, I think there could be one option that controls the volume rendering mode, with one mode being "off" --- then there wouldn't be a separate tool and python option.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I'll change the other PR to have this new mode controllable from Python and remove the new tool from this PR



@export_tool
class OpacityTool(Tool):
__slots__ = ()
Expand Down Expand Up @@ -537,6 +543,9 @@ def __init__(self, *args, **kwargs):
)
opacity = wrapped_property("opacity", optional(float, 0.5))
blend = wrapped_property("blend", optional(str))
volume_rendering = volumeRendering = wrapped_property(
"volumeRendering", optional(bool, False)
)
cross_section_render_scale = crossSectionRenderScale = wrapped_property(
"crossSectionRenderScale", optional(float, 1)
)
Expand Down
16 changes: 8 additions & 8 deletions src/neuroglancer/image_user_layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,37 +291,37 @@ function makeShaderCodeWidget(layer: ImageUserLayer) {

const LAYER_CONTROLS: LayerControlDefinition<ImageUserLayer>[] = [
{
label: 'Resolution (slice)',
label: 'Resolution selector (2D)',
toolJson: CROSS_SECTION_RENDER_SCALE_JSON_KEY,
...renderScaleLayerControl(layer => ({
histogram: layer.sliceViewRenderScaleHistogram,
target: layer.sliceViewRenderScaleTarget
})),
},
{
label: 'Blending',
label: 'Cross-section blending',
toolJson: BLEND_JSON_KEY,
...enumLayerControl(layer => layer.blendMode),
},
{
label: 'Cross-section opacity',
toolJson: OPACITY_JSON_KEY,
...rangeLayerControl(layer => ({value: layer.opacity})),
},
{
label: 'Volume rendering (experimental)',
toolJson: VOLUME_RENDERING_JSON_KEY,
...checkboxLayerControl(layer => layer.volumeRendering),
},
{
label: 'Resolution (3d)',
label: 'Resolution indicator (3D)',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per the comment in the other PR, the change to this label may be unnecessary if it is changed to control the number of samples.

toolJson: VOLUME_RENDER_SCALE_JSON_KEY,
isValid: layer => layer.volumeRendering,
...renderScaleLayerControl(layer => ({
histogram: layer.volumeRenderingRenderScaleHistogram,
target: layer.volumeRenderingRenderScaleTarget
})),
},
{
label: 'Opacity',
toolJson: OPACITY_JSON_KEY,
...rangeLayerControl(layer => ({value: layer.opacity})),
},
];

for (const control of LAYER_CONTROLS) {
Expand Down