NIPY logo

Site Navigation

NIPY Community

Table Of Contents

Previous topic

modalities.fmri.fmristat.invert

This Page

modalities.fmri.fmristat.model

Module: modalities.fmri.fmristat.model

Inheritance diagram for nipy.modalities.fmri.fmristat.model:

This module defines the two default GLM passes of fmristat

Classes

AR1

class nipy.modalities.fmri.fmristat.model.AR1(fmri_image, formula, rho, outputs=[], volume_start_times=None)

Bases: object

Second pass through fmri_image.

Parameters :

fmri_image : FmriImageList

object returning 4D array from np.asarray, having attribute volume_start_times (if volume_start_times is None), and such that object[0] returns something with attributes shape

formula : nipy.modalities.fmri.formula.Formula

rho : Image

image of AR(1) coefficients. Returning data from np.asarray(rho), and having attribute coordmap

outputs : :

volume_start_times : :

Methods

execute
__init__(fmri_image, formula, rho, outputs=[], volume_start_times=None)
execute()

ModelOutputImage

class nipy.modalities.fmri.fmristat.model.ModelOutputImage(filename, coordmap, shape, clobber=False)

Bases: object

These images have their values filled in as the model is fit, and are saved to disk after being completely filled in.

They are saved to disk by calling the ‘save’ method.

The __getitem__ and __setitem__ calls are delegated to a private Image. An exception is raised if trying to get/set data after the data has been saved to disk.

Methods

save
__init__(filename, coordmap, shape, clobber=False)
save()

Save current Image data to disk

OLS

class nipy.modalities.fmri.fmristat.model.OLS(fmri_image, formula, outputs=[], volume_start_times=None)

Bases: object

First pass through fmri_image.

Parameters :

fmri_image : FmriImageList or 4D image

object returning 4D data from np.asarray, with first (object[0]) axis being the independent variable of the model; object[0] returns an object with attribute shape.

formula : nipy.modalities.fmri.formula.Formula

outputs : :

volume_start_times : :

Methods

execute
__init__(fmri_image, formula, outputs=[], volume_start_times=None)
execute()

Functions

nipy.modalities.fmri.fmristat.model.estimateAR(resid, design, order=1)

Estimate AR parameters using bias correction from fMRIstat.

Parameters :

resid: residual image :

model: an OLS model used to estimate residuals :

Returns :

output : :

nipy.modalities.fmri.fmristat.model.generate_output(outputs, iterable, reshape=<function <lambda> at 0x46f2c80>)

Write out results of a given output.

In the regression setting, results is generally going to be a scipy.stats.models.model.LikelihoodModelResults instance.

nipy.modalities.fmri.fmristat.model.model_generator(formula, data, volume_start_times, iterable=None, slicetimes=None, model_type=<class 'nipy.fixes.scipy.stats.models.regression.OLSModel'>, model_params=<function <lambda> at 0x46f5848>)

Generator for the models for a pass of fmristat analysis.

nipy.modalities.fmri.fmristat.model.output_AR1(outfile, fmri_image, clobber=False)

Create an output file of the AR1 parameter from the OLS pass of fmristat.

Parameters :

outfile : :

fmri_image : FmriImageList or 4D image

object such that object[0] has attributes coordmap and shape

clobber : bool

if True, overwrite previous output

Returns :

regression_output : :

nipy.modalities.fmri.fmristat.model.output_F(outfile, contrast, fmri_image, clobber=False)

output F

Parameters :

outfile : :

contrast : :

fmri_image : FmriImageList

object such that object[0] has attributes shape and coordmap

clobber : bool

if True, overwrites previous output; if False, raises error

nipy.modalities.fmri.fmristat.model.output_T(outbase, contrast, fmri_image, effect=True, sd=True, t=True, clobber=False)
Parameters :

outbase : string

Base filename that will be used to construct a set of files for the TContrast. For example, outbase=’output.nii’ will result in the following files (assuming defaults for all other params): output_effect.nii, output_sd.nii, output_t.nii

contrast : a TContrast

fmri_image : FmriImageList

object such that object[0] has attributes shape and coordmap

nipy.modalities.fmri.fmristat.model.output_resid(outfile, fmri_image, clobber=False)

Create an output file of the residuals parameter from the OLS pass of fmristat.

Uses affine part of the first image to output resids unless fmri_image is an Image.

Parameters :

outfile : :

fmri_image : FmriImageList or 4D image

If FmriImageList, needs attributes volume_start_times, supports len(), and object[0] has attributes affine, coordmap and shape, from which we create a new 4D coordmap and shape If 4D image, use the images coordmap and shape

clobber : bool

if True, overwrite previous output

Returns :

regression_output : :

nipy.modalities.fmri.fmristat.model.results_generator(model_iterable)

Generator for results from an iterator that returns (index, data, model) tuples.

See model_generator.