fsl.data.featimage
¶
This module provides the FEATImage
class, a subclass of
Image
designed to encapsulate data from a FEAT analysis.
This module also provides the modelFit()
function.
-
class
fsl.data.featimage.
FEATImage
(path, **kwargs)[source]¶ Bases:
fsl.data.image.Image
An
Image
which contains the input data from a FEAT analysis.The
FEATImage
class makes use of the functions defined in thefeatanalysis
module.An example of using the
FEATImage
class:import fsl.data.featimage as featimage # You can pass in the name of the # .feat directory, or the filtered_func_data # file contained within that directory. img = featimage.FEATImage('myanalysis.feat/filtered_func_data.nii.gz') # Query information about the FEAT analysis print(img.numEVs()) print(img.contrastNames()) print(img.numPoints()) # Get the model fit residuals res4d = img.getResiduals() # Get the full model fit for voxel # [23, 30, 42] (in this example, we # have 4 EVs - the first argument # is a contrast vector). img.fit([1, 1, 1, 1], [23, 30, 42], fullModel=True)
-
__init__
(path, **kwargs)[source]¶ Create a
FEATImage
instance.- Parameters
path – A FEAT analysis directory, or the input data image file contained within such a directory.
kwargs – Passed to the
Image
constructor.
-
getAnalysisName
()[source]¶ Returns the FEAT analysis name, which is the FEAT directory name, minus the
.feat
/.gfeat
suffix.
-
isFirstLevelAnalysis
()[source]¶ Returns
True
if the FEAT analysis described bysettings
is a first level analysis,False
otherwise.
-
getTopLevelAnalysisDir
()[source]¶ Returns the path to the higher level analysis directory of which this FEAT analysis is a part, or
None
if this analysis is not part of another analysis.
-
getReportFile
()[source]¶ Returns the path to the FEAT report - see
featanalysis.getReportFile()
.
-
hasStats
()[source]¶ Returns
True
if the analysis for thisFEATImage
contains a statistical analysis.
-
getDesign
(voxel=None)[source]¶ Returns the analysis design matrix as a
numpy
array with shape \(numPoints\times numEVs\). SeeFEATFSFDesign.getDesign()
.
-
numPoints
()[source]¶ Returns the number of points (e.g. time points, number of subjects, etc) in the analysis.
-
clusterResults
(contrast)[source]¶ Returns the clusters found in the analysis.
See :func:.featanalysis.loadClusterResults`
-
fit
(contrast, xyz)[source]¶ Calculates the model fit for the given contrast vector at the given voxel. See the
modelFit()
function.- Parameters
contrast – The contrast vector (pass all 1s for a full model fit).
xyz – Coordinates of the voxel to calculate the model fit for.
-
partialFit
(contrast, xyz)[source]¶ Calculates and returns the partial model fit for the specified contrast vector at the specified voxel.
See
fit()
for details on the arguments.
-
__module__
= 'fsl.data.featimage'¶
-
-
fsl.data.featimage.
modelFit
(data, design, contrast, pes, firstLevel=True)[source]¶ Calculates the model fit to the given data for the given contrast vector.
- Parameters
data – The input data
design – The design matrix
contrast – The contrast vector (pass all 1s for a full model fit)
pes – Parameter estimates for each EV in the design matrix
firstLevel – If
True
(the default), the mean of the input data is added to the result.
- Returns
The best fit of the model to the data.