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

Mean melodic image is automatically loaded with Melodic image (if

autoDisplay is enabled).
parent 4c406e81
No related branches found
No related tags found
No related merge requests found
......@@ -128,6 +128,13 @@ class MelodicImage(fslimage.Image):
return melresults.getDataFile(self.__meldir)
def getMeanFile(self):
"""Returns the file name of the mean data image associated with this
``MelodicImage``. See the :func:`.melodicresults.getMeanFile` function.
"""
return melresults.getMeanFile(self.__meldir)
def getICClassification(self):
"""Return the :class:`.MelodicClassification` instance associated with
this ``MelodicImage``.
......
......@@ -107,10 +107,8 @@ def getDataFile(meldir):
dataFile = op.join(topDir, 'filtered_func_data')
try:
return fslimage.addExt(dataFile, mustExist=True)
except ValueError:
return None
try: return fslimage.addExt(dataFile, mustExist=True)
except ValueError: return None
def getMeanFile(meldir):
......
......@@ -182,7 +182,22 @@ def _MelodicImageDisplay(overlay, overlayList, displayCtx):
opts.negativeCmap = 'Blue-LightBlue'
opts.displayRange = [1.5, 5.0]
opts.clippingRange = [1.5, opts.dataMax]
opts.useNegativeCmap = True
opts.useNegativeCmap = True
# Add the mean as an underlay
idx = overlayList.index(overlay)
meanFile = overlay.getMeanFile()
existing = [op.abspath(o.dataSource) for o in overlayList]
# But only if it's not
# already in the list
if meanFile not in existing:
log.debug('Inserting mean melodic image into '
'overlay list: {}'.format(meanFile))
meanImg = fslimage.Image(meanFile)
overlayList.insert(idx, meanImg)
def _ModelDisplay(overlay, display, overlayList, displayCtx):
......
......@@ -20,7 +20,6 @@ import pwidgets.notebook as notebook
import fsl.utils.settings as fslsettings
import fsl.data.strings as strings
import fsl.data.image as fslimage
import fsl.data.melodicresults as fslmelresults
import fsl.data.melodicimage as fslmelimage
import fsl.fsleyes.colourmaps as fslcm
......@@ -377,27 +376,22 @@ class MelodicClassificationPanel(fslpanel.FSLEyesPanel):
return
# Try loading the melodic_IC image
# specified in the label file. We'll
# load the mean image as well, as an
# underlay.
# specified in the label file.
try:
overlay = fslmelimage.MelodicImage( melDir)
mean = fslmelresults.getMeanFile(melDir)
mean = fslimage.Image( mean)
log.debug('Adding {} and {} to overlay list'.format(overlay, mean))
log.debug('Adding {} to overlay list'.format(overlay))
self._overlayList.disableListener('overlays', self._name)
self._displayCtx .disableListener('selectedOverlay', self._name)
self._overlayList.extend([mean, overlay])
self._overlayList.append(overlay)
self._overlayList.enableListener('overlays', self._name)
self._displayCtx .enableListener('selectedOverlay', self._name)
if self._displayCtx.autoDisplay:
for o in [overlay, mean]:
autodisplay.autoDisplay(o,
self._overlayList,
self._displayCtx)
autodisplay.autoDisplay(overlay,
self._overlayList,
self._displayCtx)
fslsettings.write('loadOverlayLastDir', op.abspath(melDir))
......
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