From eb24a411d7a5419a8228574eb8412a15c6e16fe5 Mon Sep 17 00:00:00 2001 From: Sean Martin Date: Wed, 27 Sep 2023 15:31:47 +0100 Subject: [PATCH 1/9] refactor: clearer naming of 3D resolution --- src/neuroglancer/image_user_layer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/neuroglancer/image_user_layer.ts b/src/neuroglancer/image_user_layer.ts index 9942b2a30..a091492a5 100644 --- a/src/neuroglancer/image_user_layer.ts +++ b/src/neuroglancer/image_user_layer.ts @@ -309,7 +309,7 @@ const LAYER_CONTROLS: LayerControlDefinition[] = [ ...checkboxLayerControl(layer => layer.volumeRendering), }, { - label: 'Resolution (3d)', + label: 'Resolution indicator (3D)', toolJson: VOLUME_RENDER_SCALE_JSON_KEY, isValid: layer => layer.volumeRendering, ...renderScaleLayerControl(layer => ({ From bac7cf6c9dbf1901ca259bf795954a520344af00 Mon Sep 17 00:00:00 2001 From: Sean Martin Date: Tue, 3 Oct 2023 11:06:58 +0100 Subject: [PATCH 2/9] feat: hide non-VR options in VR --- src/neuroglancer/image_user_layer.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/neuroglancer/image_user_layer.ts b/src/neuroglancer/image_user_layer.ts index a091492a5..b06a356d4 100644 --- a/src/neuroglancer/image_user_layer.ts +++ b/src/neuroglancer/image_user_layer.ts @@ -293,6 +293,7 @@ const LAYER_CONTROLS: LayerControlDefinition[] = [ { label: 'Resolution (slice)', toolJson: CROSS_SECTION_RENDER_SCALE_JSON_KEY, + isValid: layer => makeCachedDerivedWatchableValue(volumeRendering => !volumeRendering, [layer.volumeRendering]), ...renderScaleLayerControl(layer => ({ histogram: layer.sliceViewRenderScaleHistogram, target: layer.sliceViewRenderScaleTarget @@ -301,6 +302,7 @@ const LAYER_CONTROLS: LayerControlDefinition[] = [ { label: 'Blending', toolJson: BLEND_JSON_KEY, + isValid: layer => makeCachedDerivedWatchableValue(volumeRendering => !volumeRendering, [layer.volumeRendering]), ...enumLayerControl(layer => layer.blendMode), }, { @@ -320,6 +322,7 @@ const LAYER_CONTROLS: LayerControlDefinition[] = [ { label: 'Opacity', toolJson: OPACITY_JSON_KEY, + isValid: layer => makeCachedDerivedWatchableValue(volumeRendering => !volumeRendering, [layer.volumeRendering]), ...rangeLayerControl(layer => ({value: layer.opacity})), }, ]; From c24415cb2c5dd0dedcf11f6c04149a576314c4c9 Mon Sep 17 00:00:00 2001 From: Sean Martin Date: Tue, 10 Oct 2023 18:15:57 +0100 Subject: [PATCH 3/9] feat: rename UI labels in image user layer To try and make it clearer that they don't impact volume rendering Also that the 3D resolution does not change the data resolution --- src/neuroglancer/image_user_layer.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/neuroglancer/image_user_layer.ts b/src/neuroglancer/image_user_layer.ts index b06a356d4..f129491ad 100644 --- a/src/neuroglancer/image_user_layer.ts +++ b/src/neuroglancer/image_user_layer.ts @@ -291,20 +291,23 @@ function makeShaderCodeWidget(layer: ImageUserLayer) { const LAYER_CONTROLS: LayerControlDefinition[] = [ { - label: 'Resolution (slice)', + label: 'Resolution selector (2D)', toolJson: CROSS_SECTION_RENDER_SCALE_JSON_KEY, - isValid: layer => makeCachedDerivedWatchableValue(volumeRendering => !volumeRendering, [layer.volumeRendering]), ...renderScaleLayerControl(layer => ({ histogram: layer.sliceViewRenderScaleHistogram, target: layer.sliceViewRenderScaleTarget })), }, { - label: 'Blending', + label: 'Cross-section blending', toolJson: BLEND_JSON_KEY, - isValid: layer => makeCachedDerivedWatchableValue(volumeRendering => !volumeRendering, [layer.volumeRendering]), ...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, @@ -319,12 +322,6 @@ const LAYER_CONTROLS: LayerControlDefinition[] = [ target: layer.volumeRenderingRenderScaleTarget })), }, - { - label: 'Opacity', - toolJson: OPACITY_JSON_KEY, - isValid: layer => makeCachedDerivedWatchableValue(volumeRendering => !volumeRendering, [layer.volumeRendering]), - ...rangeLayerControl(layer => ({value: layer.opacity})), - }, ]; for (const control of LAYER_CONTROLS) { From e473edf7b37ad250764d8f0df14a9bbdeecfc97c Mon Sep 17 00:00:00 2001 From: Sean Martin Date: Tue, 10 Oct 2023 18:16:12 +0100 Subject: [PATCH 4/9] feat(Python): control volume rendering on/off --- python/neuroglancer/viewer_state.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/python/neuroglancer/viewer_state.py b/python/neuroglancer/viewer_state.py index 05656bb4e..357f8a4f8 100644 --- a/python/neuroglancer/viewer_state.py +++ b/python/neuroglancer/viewer_state.py @@ -158,6 +158,12 @@ class BlendTool(Tool): TOOL_TYPE = "blend" +@export_tool +class VolumeRenderingTool(Tool): + __slots__ = () + TOOL_TYPE = 'volumeRendering' + + @export_tool class OpacityTool(Tool): __slots__ = () @@ -537,6 +543,8 @@ 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) ) From 84c1307bce91a4d69eec9e5d0519c553e93a40c3 Mon Sep 17 00:00:00 2001 From: Sean Martin Date: Tue, 10 Oct 2023 18:19:13 +0100 Subject: [PATCH 5/9] chore: update Python change to match new format --- python/neuroglancer/viewer_state.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/neuroglancer/viewer_state.py b/python/neuroglancer/viewer_state.py index 357f8a4f8..7be3e0a5a 100644 --- a/python/neuroglancer/viewer_state.py +++ b/python/neuroglancer/viewer_state.py @@ -161,7 +161,7 @@ class BlendTool(Tool): @export_tool class VolumeRenderingTool(Tool): __slots__ = () - TOOL_TYPE = 'volumeRendering' + TOOL_TYPE = "volumeRendering" @export_tool @@ -544,7 +544,8 @@ 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)) + "volumeRendering", optional(bool, False) + ) cross_section_render_scale = crossSectionRenderScale = wrapped_property( "crossSectionRenderScale", optional(float, 1) ) From 0bc30fa8278ee31d8f96ce5e4d4657d26a735e81 Mon Sep 17 00:00:00 2001 From: Sean Martin Date: Wed, 11 Oct 2023 16:20:50 +0100 Subject: [PATCH 6/9] fix(Python): remove VR tool --- python/neuroglancer/viewer_state.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/python/neuroglancer/viewer_state.py b/python/neuroglancer/viewer_state.py index 7be3e0a5a..05656bb4e 100644 --- a/python/neuroglancer/viewer_state.py +++ b/python/neuroglancer/viewer_state.py @@ -158,12 +158,6 @@ class BlendTool(Tool): TOOL_TYPE = "blend" -@export_tool -class VolumeRenderingTool(Tool): - __slots__ = () - TOOL_TYPE = "volumeRendering" - - @export_tool class OpacityTool(Tool): __slots__ = () @@ -543,9 +537,6 @@ 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) ) From 979ecdf28dd2e7656296eb40a9eb94586832759e Mon Sep 17 00:00:00 2001 From: Sean Martin Date: Wed, 18 Oct 2023 12:21:24 +0100 Subject: [PATCH 7/9] feat: reset resolution names --- src/neuroglancer/image_user_layer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/neuroglancer/image_user_layer.ts b/src/neuroglancer/image_user_layer.ts index f129491ad..6549081d4 100644 --- a/src/neuroglancer/image_user_layer.ts +++ b/src/neuroglancer/image_user_layer.ts @@ -291,7 +291,7 @@ function makeShaderCodeWidget(layer: ImageUserLayer) { const LAYER_CONTROLS: LayerControlDefinition[] = [ { - label: 'Resolution selector (2D)', + label: 'Resolution (2D)', toolJson: CROSS_SECTION_RENDER_SCALE_JSON_KEY, ...renderScaleLayerControl(layer => ({ histogram: layer.sliceViewRenderScaleHistogram, @@ -314,7 +314,7 @@ const LAYER_CONTROLS: LayerControlDefinition[] = [ ...checkboxLayerControl(layer => layer.volumeRendering), }, { - label: 'Resolution indicator (3D)', + label: 'Resolution (3D)', toolJson: VOLUME_RENDER_SCALE_JSON_KEY, isValid: layer => layer.volumeRendering, ...renderScaleLayerControl(layer => ({ From 91de7c6ebf4c488af58f6be342c7b3eb04ecc8e4 Mon Sep 17 00:00:00 2001 From: Sean Martin Date: Wed, 18 Oct 2023 12:22:24 +0100 Subject: [PATCH 8/9] feat: reset resolution name --- src/neuroglancer/image_user_layer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/neuroglancer/image_user_layer.ts b/src/neuroglancer/image_user_layer.ts index 6549081d4..0e0b30d92 100644 --- a/src/neuroglancer/image_user_layer.ts +++ b/src/neuroglancer/image_user_layer.ts @@ -291,7 +291,7 @@ function makeShaderCodeWidget(layer: ImageUserLayer) { const LAYER_CONTROLS: LayerControlDefinition[] = [ { - label: 'Resolution (2D)', + label: 'Resolution (slice)', toolJson: CROSS_SECTION_RENDER_SCALE_JSON_KEY, ...renderScaleLayerControl(layer => ({ histogram: layer.sliceViewRenderScaleHistogram, From acfdf7ce6ad345a41eb77af707369bee5d1b9df2 Mon Sep 17 00:00:00 2001 From: Sean Martin Date: Mon, 23 Oct 2023 17:58:55 +0100 Subject: [PATCH 9/9] feat: rename opacity and blending --- src/neuroglancer/image_user_layer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/neuroglancer/image_user_layer.ts b/src/neuroglancer/image_user_layer.ts index 0e0b30d92..248ffccd2 100644 --- a/src/neuroglancer/image_user_layer.ts +++ b/src/neuroglancer/image_user_layer.ts @@ -299,12 +299,12 @@ const LAYER_CONTROLS: LayerControlDefinition[] = [ })), }, { - label: 'Cross-section blending', + label: 'Blending (slice)', toolJson: BLEND_JSON_KEY, ...enumLayerControl(layer => layer.blendMode), }, { - label: 'Cross-section opacity', + label: 'Opacity (slice)', toolJson: OPACITY_JSON_KEY, ...rangeLayerControl(layer => ({value: layer.opacity})), },