Skip to content
Snippets Groups Projects
Commit 8dc1cebb authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

ENH: accessors for zfstats

parent 79c280da
No related branches found
No related tags found
No related merge requests found
...@@ -72,9 +72,11 @@ class FEATImage(fslimage.Image): ...@@ -72,9 +72,11 @@ class FEATImage(fslimage.Image):
if featanalysis.hasStats(featDir): if featanalysis.hasStats(featDir):
design = featanalysis.loadDesign( featDir, settings) design = featanalysis.loadDesign( featDir, settings)
names, cons = featanalysis.loadContrasts(featDir) names, cons = featanalysis.loadContrasts(featDir)
ftests = featanalysis.loadFTests( featDir)
else: else:
design = None design = None
names, cons = [], [] names, cons = [], []
ftests = []
fslimage.Image.__init__(self, path, **kwargs) fslimage.Image.__init__(self, path, **kwargs)
...@@ -83,12 +85,14 @@ class FEATImage(fslimage.Image): ...@@ -83,12 +85,14 @@ class FEATImage(fslimage.Image):
self.__design = design self.__design = design
self.__contrastNames = names self.__contrastNames = names
self.__contrasts = cons self.__contrasts = cons
self.__ftests = ftests
self.__settings = settings self.__settings = settings
self.__residuals = None self.__residuals = None
self.__pes = [None] * self.numEVs() self.__pes = [None] * self.numEVs()
self.__copes = [None] * self.numContrasts() self.__copes = [None] * self.numContrasts()
self.__zstats = [None] * self.numContrasts() self.__zstats = [None] * self.numContrasts()
self.__zfstats = [None] * self.numFTests()
self.__clustMasks = [None] * self.numContrasts() self.__clustMasks = [None] * self.numContrasts()
if 'name' not in kwargs: if 'name' not in kwargs:
...@@ -102,6 +106,7 @@ class FEATImage(fslimage.Image): ...@@ -102,6 +106,7 @@ class FEATImage(fslimage.Image):
self.__pes = None self.__pes = None
self.__copes = None self.__copes = None
self.__zstats = None self.__zstats = None
self.__zfstats = None
self.__clustMasks = None self.__clustMasks = None
...@@ -191,6 +196,11 @@ class FEATImage(fslimage.Image): ...@@ -191,6 +196,11 @@ class FEATImage(fslimage.Image):
return len(self.__contrasts) return len(self.__contrasts)
def numFTests(self):
"""Returns the number of f-tests in the analysis."""
return len(self.__ftests)
def contrastNames(self): def contrastNames(self):
"""Returns a list containing the name of each contrast in the analysis. """Returns a list containing the name of each contrast in the analysis.
""" """
...@@ -274,6 +284,17 @@ class FEATImage(fslimage.Image): ...@@ -274,6 +284,17 @@ class FEATImage(fslimage.Image):
return self.__zstats[con] return self.__zstats[con]
def getZFStats(self, ftest):
"""Returns the Z statistic image for the given f-test (0-indexed). """
if self.__zfstats[ftest] is None:
zfile = featanalysis.getZFStatFile(self.__featDir, ftest)
self.__zstats[con] = fslimage.Image(
zfile,
name=f'{self.__analysisName}: zfstat{con + 1}')
return self.__zfstats[ftest]
def getClusterMask(self, con): def getClusterMask(self, con):
"""Returns the cluster mask image for the given contrast (0-indexed). """Returns the cluster mask image for the given contrast (0-indexed).
""" """
......
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