Skip to content
Snippets Groups Projects
Commit b45c9945 authored by Paul McCarthy's avatar Paul McCarthy
Browse files

Image display toolbar simplified - image select buttons removed,

enabled checkbox removed
parent bc7d2e9e
No related branches found
No related tags found
No related merge requests found
...@@ -144,7 +144,7 @@ properties = TypeDict({ ...@@ -144,7 +144,7 @@ properties = TypeDict({
'Profile.mode' : 'Mode', 'Profile.mode' : 'Mode',
'CanvasPanel.syncLocation' : 'Sync location', 'CanvasPanel.syncLocation' : 'Sync location',
'CanvasPanel.syncImageOrder' : 'Sync image order', 'CanvasPanel.syncImageOrder' : 'Sync overlay order',
'CanvasPanel.syncVolume' : 'Sync volume', 'CanvasPanel.syncVolume' : 'Sync volume',
'CanvasPanel.profile' : 'Profile', 'CanvasPanel.profile' : 'Profile',
...@@ -193,7 +193,6 @@ properties = TypeDict({ ...@@ -193,7 +193,6 @@ properties = TypeDict({
'Display.interpolation' : 'Interpolation', 'Display.interpolation' : 'Interpolation',
'Display.resolution' : 'Resolution', 'Display.resolution' : 'Resolution',
'Display.volume' : 'Volume', 'Display.volume' : 'Volume',
'Display.syncVolume' : 'Synchronise volume',
'Display.transform' : 'Image transform', 'Display.transform' : 'Image transform',
'Display.imageType' : 'Image data type', 'Display.imageType' : 'Image data type',
......
...@@ -14,7 +14,6 @@ log = logging.getLogger(__name__) ...@@ -14,7 +14,6 @@ log = logging.getLogger(__name__)
import fsl.fslview.toolbar as fsltoolbar import fsl.fslview.toolbar as fsltoolbar
import imageselectpanel as imageselect
import imagedisplaypanel as imagedisplay import imagedisplaypanel as imagedisplay
...@@ -27,9 +26,6 @@ class ImageDisplayToolBar(fsltoolbar.FSLViewToolBar): ...@@ -27,9 +26,6 @@ class ImageDisplayToolBar(fsltoolbar.FSLViewToolBar):
fsltoolbar.FSLViewToolBar.__init__( fsltoolbar.FSLViewToolBar.__init__(
self, parent, imageList, displayCtx, actionz) self, parent, imageList, displayCtx, actionz)
self._imageSelect = imageselect.ImageSelectPanel(
self, imageList, displayCtx, False)
self._viewPanel = viewPanel self._viewPanel = viewPanel
self._imageTools = {} self._imageTools = {}
self._currentImage = None self._currentImage = None
...@@ -54,8 +50,6 @@ class ImageDisplayToolBar(fsltoolbar.FSLViewToolBar): ...@@ -54,8 +50,6 @@ class ImageDisplayToolBar(fsltoolbar.FSLViewToolBar):
"""Deregisters property listeners. """ """Deregisters property listeners. """
fsltoolbar.FSLViewToolBar.destroy(self) fsltoolbar.FSLViewToolBar.destroy(self)
self._imageSelect.destroy()
self._imageList .removeListener('images', self._name) self._imageList .removeListener('images', self._name)
self._displayCtx.removeListener('selectedImage', self._name) self._displayCtx.removeListener('selectedImage', self._name)
self._displayCtx.removeListener('imageOrder', self._name) self._displayCtx.removeListener('imageOrder', self._name)
...@@ -99,6 +93,12 @@ class ImageDisplayToolBar(fsltoolbar.FSLViewToolBar): ...@@ -99,6 +93,12 @@ class ImageDisplayToolBar(fsltoolbar.FSLViewToolBar):
for tool, _ in oldOptsTools: for tool, _ in oldOptsTools:
tool.Destroy() tool.Destroy()
def _toggleEnabled(self, *a):
image = self._displayCtx.getSelectedImage()
display = self._displayCtx.getDisplayProperties(image)
self.Enable(display.enabled)
def _selectedImageChanged(self, *a): def _selectedImageChanged(self, *a):
...@@ -111,9 +111,23 @@ class ImageDisplayToolBar(fsltoolbar.FSLViewToolBar): ...@@ -111,9 +111,23 @@ class ImageDisplayToolBar(fsltoolbar.FSLViewToolBar):
if image is None: if image is None:
self.ClearTools() self.ClearTools()
return 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) tools = self._imageTools.get(image, None)
if tools is None: if tools is None:
displayTools = self._makeDisplayWidgets(image, self) displayTools = self._makeDisplayWidgets(image, self)
optsTools = self._makeOptsWidgets( image, self) optsTools = self._makeOptsWidgets( image, self)
...@@ -137,8 +151,7 @@ class ImageDisplayToolBar(fsltoolbar.FSLViewToolBar): ...@@ -137,8 +151,7 @@ class ImageDisplayToolBar(fsltoolbar.FSLViewToolBar):
tools = self.GetTools() tools = self.GetTools()
for widget in tools: for widget in tools:
if widget is not self._imageSelect: widget.Show(False)
widget.Show(False)
self.ClearTools(postevent=False) self.ClearTools(postevent=False)
...@@ -150,8 +163,8 @@ class ImageDisplayToolBar(fsltoolbar.FSLViewToolBar): ...@@ -150,8 +163,8 @@ class ImageDisplayToolBar(fsltoolbar.FSLViewToolBar):
dispTools, dispLabels = zip(*dispTools) dispTools, dispLabels = zip(*dispTools)
optsTools, optsLabels = zip(*optsTools) optsTools, optsLabels = zip(*optsTools)
tools = [self._imageSelect] + list(dispTools) + list(optsTools) tools = list(dispTools) + list(optsTools)
labels = [None] + list(dispLabels) + list(optsLabels) labels = list(dispLabels) + list(optsLabels)
for tool in tools: for tool in tools:
tool.Show(True) tool.Show(True)
......
...@@ -70,9 +70,6 @@ class Display(props.SyncableHasProperties): ...@@ -70,9 +70,6 @@ class Display(props.SyncableHasProperties):
"""If a 4D image, the current volume to display.""" """If a 4D image, the current volume to display."""
syncVolume = props.Boolean(default=True)
transform = props.Choice( transform = props.Choice(
('affine', 'pixdim', 'id'), ('affine', 'pixdim', 'id'),
labels=[strings.choices['Display.transform.affine'], labels=[strings.choices['Display.transform.affine'],
......
...@@ -377,8 +377,7 @@ class DisplayContext(props.SyncableHasProperties): ...@@ -377,8 +377,7 @@ class DisplayContext(props.SyncableHasProperties):
# be clamped to the possible value for that # be clamped to the possible value for that
# image, so we don't need to check if the # image, so we don't need to check if the
# current volume value is valid for each image # current volume value is valid for each image
if display.syncVolume: display.volume = self.volume
display.volume = self.volume
def _boundsChanged(self, *a): def _boundsChanged(self, *a):
......
...@@ -82,7 +82,6 @@ class VolumeOpts(fsldisplay.DisplayOpts): ...@@ -82,7 +82,6 @@ class VolumeOpts(fsldisplay.DisplayOpts):
'each displayed real world location', 'each displayed real world location',
'resolution' : 'Data resolution in voxels', 'resolution' : 'Data resolution in voxels',
'volume' : 'Volume number (for 4D images)', 'volume' : 'Volume number (for 4D images)',
'syncVolume' : 'Synchronise to global volume number',
'transform' : 'The transformation matrix which specifies the ' 'transform' : 'The transformation matrix which specifies the '
'conversion from voxel coordinates to a real ' 'conversion from voxel coordinates to a real '
'world location', 'world location',
......
...@@ -95,8 +95,7 @@ CanvasPanelLayout = props.VGroup(( ...@@ -95,8 +95,7 @@ CanvasPanelLayout = props.VGroup((
'profile', 'profile',
visibleWhen=lambda i: len(i.getProp('profile').getChoices(i)) > 1), visibleWhen=lambda i: len(i.getProp('profile').getChoices(i)) > 1),
widget(CanvasPanel, 'syncImageOrder'), widget(CanvasPanel, 'syncImageOrder'),
widget(CanvasPanel, 'syncLocation'), widget(CanvasPanel, 'syncLocation')))
widget(CanvasPanel, 'syncVolume')))
SceneOptsLayout = props.VGroup(( SceneOptsLayout = props.VGroup((
widget(SceneOpts, 'showCursor'), widget(SceneOpts, 'showCursor'),
...@@ -145,7 +144,6 @@ LightBoxPanelLayout = props.VGroup(( ...@@ -145,7 +144,6 @@ LightBoxPanelLayout = props.VGroup((
DisplayToolBarLayout = [ DisplayToolBarLayout = [
widget(Display, 'enabled'),
widget(Display, 'name'), widget(Display, 'name'),
widget(Display, 'imageType'), widget(Display, 'imageType'),
widget(Display, 'alpha', spin=False, showLimits=False), widget(Display, 'alpha', spin=False, showLimits=False),
...@@ -175,7 +173,6 @@ DisplayLayout = props.VGroup( ...@@ -175,7 +173,6 @@ DisplayLayout = props.VGroup(
widget(Display, 'transform'), widget(Display, 'transform'),
widget(Display, 'interpolation'), widget(Display, 'interpolation'),
widget(Display, 'volume', editLimits=False), widget(Display, 'volume', editLimits=False),
widget(Display, 'syncVolume'),
widget(Display, 'enabled'), widget(Display, 'enabled'),
widget(Display, 'alpha', showLimits=False, editLimits=False), widget(Display, 'alpha', showLimits=False, editLimits=False),
widget(Display, 'brightness', showLimits=False, editLimits=False), widget(Display, 'brightness', showLimits=False, editLimits=False),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment