diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b043447..36125a0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Enhancements: - Adds methods to CILviewer and CILviewer2D #425 Bugfix: + - Hides the slider when one image dimension is 1 #432 - Differentiate 3D and 2D images in the converter `numpy2vtkImage` #437 - Edit slider min value #420 - Fix extent error when user clicks in the viewer to create a box by clicking outside of the image #425 diff --git a/Wrappers/Python/ccpi/viewer/CILViewer2D.py b/Wrappers/Python/ccpi/viewer/CILViewer2D.py index 90be5929..6915ed61 100644 --- a/Wrappers/Python/ccpi/viewer/CILViewer2D.py +++ b/Wrappers/Python/ccpi/viewer/CILViewer2D.py @@ -1550,11 +1550,18 @@ def installSliceSliderWidgetPipeline(self): '''Create the pipeline for the slice slider widget The slider widget and representation are created if not already present. - Currently the slider widget enabled flag is not used. + If present, the slider is updated. + The slider is hidden if any of the dimensions of the visualised image is 1, + else it is shown. ''' + # set slider_hidden + dims = self.img3D.GetDimensions() + slider_hidden = any(dim == 1 for dim in dims) + if self.sliderWidget is not None: # reset the values to the appropriate ones of the new loaded image self.sliderCallback.update_orientation(self.style, 'reset') + self.sliderWidget.SetEnabled(not slider_hidden) return sr = SliceSliderRepresentation() @@ -1567,7 +1574,8 @@ def installSliceSliderWidgetPipeline(self): sw.SetRepresentation(sr) sw.SetAnimationModeToAnimate() sw.EnabledOn() - + # enable slider + sw.SetEnabled(not slider_hidden) cb = SliderCallback(self, sw) # Add interaction observers