# fmri.io

## Module: `fmri.io`

Input and output for fmri data files

## Functions

nitime.fmri.io.nifti_from_time_series(volume, coords, time_series, nifti_path)

  Makes a Nifti file out of a time_series object

  Parameters:

    volume: list (3-d, or 4-d) :

    > The total size of the nifti image to be created

    coords: 3*n_coords array :

    > The coords into which the time_series will be inserted. These need to be given in the order in which the time_series is organized

    time_series: a time-series object :

    > The time-series to be inserted into the file

    nifti_path: the full path to the file name which will be created :

nitime.fmri.io.time_series_from_file(nifti_files, coords=None, TR=None, normalize=None, average=False, filter=None, verbose=False)
  Make a time series from a Analyze file, provided coordinates into the

    file

  Parameters:

    nifti_files: a string or a list/tuple of strings. :

    > The full path(s) to the file(s) from which the time-series is (are) extracted

    coords: ndarray or list/tuple of ndarray, optional. :

    > x,y,z (inplane,inplane,slice) coordinates of the ROI(s) from which the time-series is (are) derived. If coordinates are provided, the resulting time-series object will have 2 dimentsions. The first is the coordinate dimension, in order of the provided coordinates and the second is time. If set to None, all the coords in the volume will be used and the coordinate system will be preserved - the output will be 4 dimensional, with time as the last dimension.

    TR: float or TimeArray, optional :

    > The TR of the fmri measurement. The units are seconds, if provided as a float argument. Otherwise, in the units of the TimeArray object provided. Default: 1 second.

    normalize: bool, optional :

    > Whether to normalize the activity in each voxel, defaults to None, in which case the original fMRI signal is used. Other options are: ‘percent’: the activity in each voxel is converted to percent change, relative to this scan. ‘zscore’: the activity is converted to a zscore relative to the mean and std in this voxel in this scan.

    average: bool, optional whether to average the time-series across the :

    > voxels in the ROI (assumed to be the first dimension). In which case, TS.data will be 1-d

    filter: dict, optional :

    > If provided with a dict of the form:

    > {‘lb’:float or 0, ‘ub’:float or None, ‘method’:’fourier’,’boxcar’ ‘fir’ or ‘iir’ }

    > each voxel’s data will be filtered into the frequency range [lb,ub] with nitime.analysis.FilterAnalyzer, using the method chosen here (defaults to ‘fir’)

    verbose: Whether to report on ROI and file being read. :

  Returns:

    time-series object :