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

Colourmap display names are now explicitly set.

parent b9ecd8ef
No related branches found
No related tags found
No related merge requests found
...@@ -52,6 +52,8 @@ The following functions are available for managing and accessing colour maps: ...@@ -52,6 +52,8 @@ The following functions are available for managing and accessing colour maps:
:nosignatures: :nosignatures:
getColourMaps getColourMaps
getColourMap
getColourMapLabel
registerColourMap registerColourMap
installColourMap installColourMap
isColourMapRegistered isColourMapRegistered
...@@ -256,7 +258,7 @@ def registerColourMap(cmapFile, ...@@ -256,7 +258,7 @@ def registerColourMap(cmapFile,
if overlayList is None: overlayList = [] if overlayList is None: overlayList = []
data = np.loadtxt(cmapFile) data = np.loadtxt(cmapFile)
cmap = colors.ListedColormap(data, name) cmap = colors.ListedColormap(data, key)
log.debug('Loading and registering custom ' log.debug('Loading and registering custom '
'colour map: {}'.format(cmapFile)) 'colour map: {}'.format(cmapFile))
...@@ -401,6 +403,11 @@ def getColourMap(cmapName): ...@@ -401,6 +403,11 @@ def getColourMap(cmapName):
return _caseInsensitiveLookup(_cmaps, cmapName).mapObj return _caseInsensitiveLookup(_cmaps, cmapName).mapObj
def getColourMapLabel(cmapName):
"""Returns a label/display name for the specified colour map. """
return _caseInsensitiveLookup(_cmaps, cmapName).name
def isColourMapRegistered(cmapName): def isColourMapRegistered(cmapName):
"""Returns ``True`` if the specified colourmap is registered, ``False`` """Returns ``True`` if the specified colourmap is registered, ``False``
otherwise. otherwise.
......
...@@ -21,6 +21,7 @@ import fsl.utils.typedict as td ...@@ -21,6 +21,7 @@ import fsl.utils.typedict as td
import fsl.data.strings as strings import fsl.data.strings as strings
import fsl.fsleyes.tooltips as fsltooltips import fsl.fsleyes.tooltips as fsltooltips
import fsl.fsleyes.panel as fslpanel import fsl.fsleyes.panel as fslpanel
import fsl.fsleyes.colourmaps as fslcm
import fsl.fsleyes.actions.loadcolourmap as loadcmap import fsl.fsleyes.actions.loadcolourmap as loadcmap
import fsl.fsleyes.displaycontext as displayctx import fsl.fsleyes.displaycontext as displayctx
...@@ -258,6 +259,7 @@ class OverlayDisplayPanel(fslpanel.FSLEyesPanel): ...@@ -258,6 +259,7 @@ class OverlayDisplayPanel(fslpanel.FSLEyesPanel):
# Negative colour map widget # Negative colour map widget
negCmap = props.Widget('negativeCmap', negCmap = props.Widget('negativeCmap',
labels=fslcm.getColourMapLabel,
enabledWhen=lambda i, enc: enc, enabledWhen=lambda i, enc: enc,
dependencies=['useNegativeCmap']) dependencies=['useNegativeCmap'])
useNegCmap = props.Widget('useNegativeCmap') useNegCmap = props.Widget('useNegativeCmap')
...@@ -304,7 +306,8 @@ _DISPLAY_PROPS = td.TypeDict({ ...@@ -304,7 +306,8 @@ _DISPLAY_PROPS = td.TypeDict({
enabledWhen=lambda o: o.overlay.is4DImage()), enabledWhen=lambda o: o.overlay.is4DImage()),
props.Widget('interpolation', props.Widget('interpolation',
labels=strings.choices['VolumeOpts.interpolation']), labels=strings.choices['VolumeOpts.interpolation']),
props.Widget('cmap'), props.Widget('cmap',
labels=fslcm.getColourMapLabel),
props.Widget('invert'), props.Widget('invert'),
props.Widget('invertClipping'), props.Widget('invertClipping'),
props.Widget('linkLowRanges', props.Widget('linkLowRanges',
...@@ -342,6 +345,7 @@ _DISPLAY_PROPS = td.TypeDict({ ...@@ -342,6 +345,7 @@ _DISPLAY_PROPS = td.TypeDict({
enabledWhen=lambda o, ci: ci is None), enabledWhen=lambda o, ci: ci is None),
props.Widget('clipImage', labels=_imageName), props.Widget('clipImage', labels=_imageName),
props.Widget('cmap', props.Widget('cmap',
labels=fslcm.getColourMapLabel,
dependencies=['colourImage'], dependencies=['colourImage'],
enabledWhen=lambda o, ci: ci is not None), enabledWhen=lambda o, ci: ci is not None),
props.Widget('clippingRange', props.Widget('clippingRange',
......
...@@ -16,12 +16,13 @@ import wx ...@@ -16,12 +16,13 @@ import wx
import props import props
import fsl.fsleyes.toolbar as fsltoolbar import fsl.fsleyes.toolbar as fsltoolbar
import fsl.fsleyes.icons as icons import fsl.fsleyes.icons as icons
import fsl.fsleyes.tooltips as fsltooltips import fsl.fsleyes.tooltips as fsltooltips
import fsl.fsleyes.actions as actions import fsl.fsleyes.actions as actions
import fsl.utils.typedict as td import fsl.fsleyes.colourmaps as fslcm
import fsl.data.strings as strings import fsl.utils.typedict as td
import fsl.data.strings as strings
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
...@@ -521,6 +522,7 @@ _TOOLBAR_PROPS = td.TypeDict({ ...@@ -521,6 +522,7 @@ _TOOLBAR_PROPS = td.TypeDict({
tooltip=_TOOLTIPS['VolumeOpts.resetDisplayRange']), tooltip=_TOOLTIPS['VolumeOpts.resetDisplayRange']),
'cmap' : props.Widget( 'cmap' : props.Widget(
'cmap', 'cmap',
labels=fslcm.getColourMapLabel,
tooltip=_TOOLTIPS['VolumeOpts.cmap'])}, tooltip=_TOOLTIPS['VolumeOpts.cmap'])},
'MaskOpts' : { 'MaskOpts' : {
......
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