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)

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 the featanalysis 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)
getFEATDir()

Returns the FEAT directory this image is contained in.

getAnalysisName()

Returns the FEAT analysis name, which is the FEAT directory name, minus the .feat / .gfeat suffix.

isFirstLevelAnalysis()

Returns True if the FEAT analysis described by settings is a first level analysis, False otherwise.

getTopLevelAnalysisDir()

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()

Returns the path to the FEAT report - see featanalysis.getReportFile().

hasStats()

Returns True if the analysis for this FEATImage contains a statistical analysis.

getDesign(voxel=None)

Returns the analysis design matrix as a numpy array with shape \(numPoints\times numEVs\). See FEATFSFDesign.getDesign().

numPoints()

Returns the number of points (e.g. time points, number of subjects, etc) in the analysis.

numEVs()

Returns the number of explanatory variables (EVs) in the analysis.

evNames()

Returns a list containing the name of each EV in the analysis.

numContrasts()

Returns the number of contrasts in the analysis.

contrastNames()

Returns a list containing the name of each contrast in the analysis.

contrasts()

Returns a list containing the analysis contrast vectors.

See featanalysis.loadContrasts()

thresholds()

Returns the statistical thresholds used in the analysis.

See featanalysis.getThresholds()

clusterResults(contrast)

Returns the clusters found in the analysis.

See :func:.featanalysis.loadClusterResults`

getPE(ev)

Returns the PE image for the given EV (0-indexed).

getResiduals()

Returns the residuals of the full model fit.

getCOPE(con)

Returns the COPE image for the given contrast (0-indexed).

getZStats(con)

Returns the Z statistic image for the given contrast (0-indexed).

getClusterMask(con)

Returns the cluster mask image for the given contrast (0-indexed).

fit(contrast, xyz)

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)

Calculates and returns the partial model fit for the specified contrast vector at the specified voxel.

See fit() for details on the arguments.

fsl.data.featimage.modelFit(data, design, contrast, pes, firstLevel=True)

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.