Table Of Contents

Previous topic

modalities.fmri.fmristat.model

Next topic

modalities.fmri.fmristat.utils

This Page

modalities.fmri.fmristat.npzimage

Module: modalities.fmri.fmristat.npzimage

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

A simple way of storing nipy.core.image.image.Image‘s in .npz files.

Also includes NPZBuffer that keeps data in an ndarray instance until flushed to an .npz file.

At the time, NifTi file writing is broken – that’s why NifTi files are not written.

Class

NPZBuffer

class nipy.modalities.fmri.fmristat.npzimage.NPZBuffer(filename, grid, clobber=False)

A temporary image that is saved to an npz Image when its flush method is called.

The attribute ‘extra’ should be a dictionary of arrays that will be included in the resuting .npz file when flush is called. This is a simple way to add extra information to Image files.

__init__(filename, grid, clobber=False)
flush()

Functions

nipy.modalities.fmri.fmristat.npzimage.create_npz(filename, grid, dtype=<type 'numpy.float32'>, clobber=False)

Create an .npz Image, which consists of at least three arrays:

  • data: the data array
  • dimnames: the dimension names of the corresponding grid
  • affine: the affine transformation of grid
nipy.modalities.fmri.fmristat.npzimage.load_npz(filename)

Load an .npz Image, this .npz file must have at least two arrays

  • data: the data array
  • dimnames: the dimension names of the corresponding grid
  • affine: the affine transformation of grid

The remaining arrays of .npz file are stored as the ‘extra’ attribute of the Image.

nipy.modalities.fmri.fmristat.npzimage.save_npz(filename, image, clobber=False, **extra)

Save an .npz Image, which consists of at least three arrays:

  • data: the data array
  • dimnames: the dimension names of the corresponding grid
  • affine: the affine transformation of grid

Image must have an affine transformation, which is the only part of the mapping that is saved.