diff --git a/fsl/data/strings.py b/fsl/data/strings.py index 89ffe6f1d56f3ae0f5a33439a0e7882e0ee7a5b0..6c7ddd4edaa864e3c365ceef20d3e819f54d7a6e 100644 --- a/fsl/data/strings.py +++ b/fsl/data/strings.py @@ -144,7 +144,7 @@ properties = TypeDict({ 'Profile.mode' : 'Mode', 'CanvasPanel.syncLocation' : 'Sync location', - 'CanvasPanel.syncImageOrder' : 'Sync image order', + 'CanvasPanel.syncImageOrder' : 'Sync overlay order', 'CanvasPanel.syncVolume' : 'Sync volume', 'CanvasPanel.profile' : 'Profile', @@ -193,7 +193,6 @@ properties = TypeDict({ 'Display.interpolation' : 'Interpolation', 'Display.resolution' : 'Resolution', 'Display.volume' : 'Volume', - 'Display.syncVolume' : 'Synchronise volume', 'Display.transform' : 'Image transform', 'Display.imageType' : 'Image data type', diff --git a/fsl/fslview/controls/imagedisplaytoolbar.py b/fsl/fslview/controls/imagedisplaytoolbar.py index c97b44eb26815591ccbd72467eb984385e2460ec..b67ff4a5f1a31e9f16b0f6ecbf096de38de671c0 100644 --- a/fsl/fslview/controls/imagedisplaytoolbar.py +++ b/fsl/fslview/controls/imagedisplaytoolbar.py @@ -14,7 +14,6 @@ log = logging.getLogger(__name__) import fsl.fslview.toolbar as fsltoolbar -import imageselectpanel as imageselect import imagedisplaypanel as imagedisplay @@ -27,9 +26,6 @@ class ImageDisplayToolBar(fsltoolbar.FSLViewToolBar): fsltoolbar.FSLViewToolBar.__init__( self, parent, imageList, displayCtx, actionz) - self._imageSelect = imageselect.ImageSelectPanel( - self, imageList, displayCtx, False) - self._viewPanel = viewPanel self._imageTools = {} self._currentImage = None @@ -54,8 +50,6 @@ class ImageDisplayToolBar(fsltoolbar.FSLViewToolBar): """Deregisters property listeners. """ fsltoolbar.FSLViewToolBar.destroy(self) - self._imageSelect.destroy() - self._imageList .removeListener('images', self._name) self._displayCtx.removeListener('selectedImage', self._name) self._displayCtx.removeListener('imageOrder', self._name) @@ -99,6 +93,12 @@ class ImageDisplayToolBar(fsltoolbar.FSLViewToolBar): for tool, _ in oldOptsTools: tool.Destroy() + + def _toggleEnabled(self, *a): + image = self._displayCtx.getSelectedImage() + display = self._displayCtx.getDisplayProperties(image) + + self.Enable(display.enabled) def _selectedImageChanged(self, *a): @@ -111,9 +111,23 @@ class ImageDisplayToolBar(fsltoolbar.FSLViewToolBar): if image is None: self.ClearTools() return - + + display = self._displayCtx.getDisplayProperties(image) + + # Call _toggleEnabled when + # the image is enabled/disabled + for i in self._imageList: + if i == image: + display.addListener('enabled', + self._name, + self._toggleEnabled, + overwrite=True) + else: + display.removeListener('enabled', self._name) + + # Build/refresh the toolbar widgets for this image tools = self._imageTools.get(image, None) - + if tools is None: displayTools = self._makeDisplayWidgets(image, self) optsTools = self._makeOptsWidgets( image, self) @@ -137,8 +151,7 @@ class ImageDisplayToolBar(fsltoolbar.FSLViewToolBar): tools = self.GetTools() for widget in tools: - if widget is not self._imageSelect: - widget.Show(False) + widget.Show(False) self.ClearTools(postevent=False) @@ -150,8 +163,8 @@ class ImageDisplayToolBar(fsltoolbar.FSLViewToolBar): dispTools, dispLabels = zip(*dispTools) optsTools, optsLabels = zip(*optsTools) - tools = [self._imageSelect] + list(dispTools) + list(optsTools) - labels = [None] + list(dispLabels) + list(optsLabels) + tools = list(dispTools) + list(optsTools) + labels = list(dispLabels) + list(optsLabels) for tool in tools: tool.Show(True) diff --git a/fsl/fslview/displaycontext/display.py b/fsl/fslview/displaycontext/display.py index 64e698fda9223d0ea962a25891acc88fe27bec28..95f830122c3764d05f8743419fedaaa479f19d3f 100644 --- a/fsl/fslview/displaycontext/display.py +++ b/fsl/fslview/displaycontext/display.py @@ -70,9 +70,6 @@ class Display(props.SyncableHasProperties): """If a 4D image, the current volume to display.""" - syncVolume = props.Boolean(default=True) - - transform = props.Choice( ('affine', 'pixdim', 'id'), labels=[strings.choices['Display.transform.affine'], diff --git a/fsl/fslview/displaycontext/displaycontext.py b/fsl/fslview/displaycontext/displaycontext.py index 081f686fe6a10407087cc6c80cd5ba41fced2720..86b152f3f8425195a68d237e2661444524bc2f4c 100644 --- a/fsl/fslview/displaycontext/displaycontext.py +++ b/fsl/fslview/displaycontext/displaycontext.py @@ -377,8 +377,7 @@ class DisplayContext(props.SyncableHasProperties): # be clamped to the possible value for that # image, so we don't need to check if the # current volume value is valid for each image - if display.syncVolume: - display.volume = self.volume + display.volume = self.volume def _boundsChanged(self, *a): diff --git a/fsl/fslview/displaycontext/volumeopts.py b/fsl/fslview/displaycontext/volumeopts.py index a06df9b381532c7eb793540d22d203d0c779ac95..786d50b6cd25c07837ce47754222021bcd156e76 100644 --- a/fsl/fslview/displaycontext/volumeopts.py +++ b/fsl/fslview/displaycontext/volumeopts.py @@ -82,7 +82,6 @@ class VolumeOpts(fsldisplay.DisplayOpts): 'each displayed real world location', 'resolution' : 'Data resolution in voxels', 'volume' : 'Volume number (for 4D images)', - 'syncVolume' : 'Synchronise to global volume number', 'transform' : 'The transformation matrix which specifies the ' 'conversion from voxel coordinates to a real ' 'world location', diff --git a/fsl/fslview/layouts.py b/fsl/fslview/layouts.py index 4b33eea7af2eadcb62c89800c6d404eb6c6ace4a..63932732636a1fdac17b56b70321ebbf5ce90981 100644 --- a/fsl/fslview/layouts.py +++ b/fsl/fslview/layouts.py @@ -95,8 +95,7 @@ CanvasPanelLayout = props.VGroup(( 'profile', visibleWhen=lambda i: len(i.getProp('profile').getChoices(i)) > 1), widget(CanvasPanel, 'syncImageOrder'), - widget(CanvasPanel, 'syncLocation'), - widget(CanvasPanel, 'syncVolume'))) + widget(CanvasPanel, 'syncLocation'))) SceneOptsLayout = props.VGroup(( widget(SceneOpts, 'showCursor'), @@ -145,7 +144,6 @@ LightBoxPanelLayout = props.VGroup(( DisplayToolBarLayout = [ - widget(Display, 'enabled'), widget(Display, 'name'), widget(Display, 'imageType'), widget(Display, 'alpha', spin=False, showLimits=False), @@ -175,7 +173,6 @@ DisplayLayout = props.VGroup( widget(Display, 'transform'), widget(Display, 'interpolation'), widget(Display, 'volume', editLimits=False), - widget(Display, 'syncVolume'), widget(Display, 'enabled'), widget(Display, 'alpha', showLimits=False, editLimits=False), widget(Display, 'brightness', showLimits=False, editLimits=False),