Skip to content

Commit

Permalink
fix limits on new image loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
paskino committed Sep 8, 2023
1 parent f4f24ff commit 172698f
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions Wrappers/Python/ccpi/viewer/CILViewer2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,7 @@ def setInput3DData(self, imageData):

def setInputData(self, imageData):
self.log("setInputData")
self.reset()
self.img3D = imageData
self.installPipeline()
self.axes_initialised = True
Expand Down Expand Up @@ -1315,7 +1316,7 @@ def installPipeline(self):
elif self.vis_mode == CILViewer2D.RECTILINEAR_WIPE:
self.installRectilinearWipePipeline()

self.installSliderWidget()
self.installSliceSliderWidgetPipeline()
self.ren.ResetCamera()
self.ren.Render()

Expand Down Expand Up @@ -1466,13 +1467,22 @@ def installRectilinearWipePipeline(self):

self.AddActor(wipeSlice, WIPE_ACTOR)

def installSliderWidget(self):
def installSliceSliderWidgetPipeline(self):

if self.sliderWidget is not None:
# reset the values to the appropriate ones of the new loaded image
self.sliderProperty.value_minimum = 0
self.sliderProperty.value_maximum = self.img3D.GetDimensions()[2] - 1

self.sliderProperty.value_initial = self.getActiveSlice()

# update min and max of the slider
self.sliderWidget.GetRepresentation().SetMaximumValue(self.sliderProperty.value_maximum)
self.sliderWidget.GetRepresentation().SetValue(self.sliderProperty.value_initial)

# update the label text
self.sliderCallback.update_from_viewer(self.style, 'reset')
return

self.sliderProperty.value_minimum = 0
self.sliderProperty.value_maximum = self.img3D.GetDimensions()[2] - 1

Expand Down Expand Up @@ -1837,3 +1847,9 @@ def uninstallPipeline2(self):
elif self.vis_mode == CILViewer2D.RECTILINEAR_WIPE:
# rectilinear wipe visualises 2 images in the same pipeline
pass

def reset(self):
self.uninstallPipeline()
if self.image2 is not None:
self.uninstallPipeline2()

0 comments on commit 172698f

Please sign in to comment.