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

MelodicImage updated to work with new Image interface (no longer a

HasProperties type).
parent 2be63aaf
No related branches found
No related tags found
No related merge requests found
...@@ -12,8 +12,6 @@ sub-class which encapsulates data from a MELODIC analysis. ...@@ -12,8 +12,6 @@ sub-class which encapsulates data from a MELODIC analysis.
import os.path as op import os.path as op
import props
from . import image as fslimage from . import image as fslimage
from . import melodicanalysis as melanalysis from . import melodicanalysis as melanalysis
from . import melodiclabels as mellabels from . import melodiclabels as mellabels
...@@ -39,15 +37,14 @@ class MelodicImage(fslimage.Image): ...@@ -39,15 +37,14 @@ class MelodicImage(fslimage.Image):
getTopLevelAnalysisDir getTopLevelAnalysisDir
getDataFile getDataFile
getICClassification getICClassification
"""
tr = props.Real(default=1.0) The :attr:`tr` time of the ``MelodicImage`` may not be known when it is
"""The TR time of the raw data from which this ``MelodicImage`` was created. If it is updated at a later time, the ``MelodicImage`` will
generated. If it is possible to do so, this is automatically initialised notify any listeners which are registerd on the ``'tr'`` topic (see the
from the data file (see the :meth:`getDataFile` method). :class:`.Notifier` interface).
""" """
def __init__(self, path, *args, **kwargs): def __init__(self, path, *args, **kwargs):
"""Create a ``MelodicImage``. """Create a ``MelodicImage``.
...@@ -69,6 +66,7 @@ class MelodicImage(fslimage.Image): ...@@ -69,6 +66,7 @@ class MelodicImage(fslimage.Image):
fslimage.Image.__init__(self, path, *args, **kwargs) fslimage.Image.__init__(self, path, *args, **kwargs)
meldir = op.dirname(path) meldir = op.dirname(path)
self.__tr = 1.0
self.__meldir = meldir self.__meldir = meldir
self.__melmix = melanalysis.getComponentTimeSeries( meldir) self.__melmix = melanalysis.getComponentTimeSeries( meldir)
self.__melFTmix = melanalysis.getComponentPowerSpectra(meldir) self.__melFTmix = melanalysis.getComponentPowerSpectra(meldir)
...@@ -83,12 +81,33 @@ class MelodicImage(fslimage.Image): ...@@ -83,12 +81,33 @@ class MelodicImage(fslimage.Image):
loadData=False, loadData=False,
calcRange=False) calcRange=False)
if dataImage.is4DImage(): if dataImage.is4DImage():
self.tr = dataImage.pixdim[3] self.__tr = dataImage.pixdim[3]
# TODO load classifications if present # TODO load classifications if present
for i in range(self.numComponents()): for i in range(self.numComponents()):
self.__melICClass.addLabel(i, 'Unknown') self.__melICClass.addLabel(i, 'Unknown')
@property
def tr(self):
"""The TR time of the raw data from which this ``MelodicImage`` was
generated. If it is possible to do so, this is automatically
initialised from the data file (see the :meth:`getDataFile` method).
"""
return self.__tr
@tr.setter
def tr(self, val):
"""Set the :attr:`tr` time for this ``MelodicImage``. Any listeners
registered on the ``'tr'`` topic are notified of the update.
"""
oldval = self.__tr
self.__tr = val
if oldval != val:
self.notify('tr')
def getComponentTimeSeries(self, component): def getComponentTimeSeries(self, component):
"""Returns the time course for the specified (0-indexed) component. """ """Returns the time course for the specified (0-indexed) component. """
......
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