fsl.data.mghimage

This module provides the MGHImage class, which can be used to load Freesurfer mgh/mgz image files.

fsl.data.mghimage.ALLOWED_EXTENSIONS = ['.mgz', '.mgh']

List of file extensions interpreted as MGH image files.

fsl.data.mghimage.EXTENSION_DESCRIPTIONS = ['Compressed MGH image', 'MGH image']

A description for each of the ALLOWED_EXTENSIONS.

class fsl.data.mghimage.MGHImage(image, *args, **kwargs)[source]

Bases: fsl.data.image.Image

The MGHImage class is a NIFTI Image which has been converted from a Freesurfer .mgh file.

See:
__init__(image, *args, **kwargs)[source]

Create a MGHImage.

Parameters:image – Name of MGH file, or a nibabel.freesurfer.mghformat.MGHImage instance.

All other arguments are passed through to Image.__init__()

save(filename=None)[source]

Overrides Image.save(). If a filename is not provided, converts the original (MGH) file name into a NIFTI filename, before passing it to the Image.save() method.

mghImageFile

If this MGHImage was loaded from a file, returns the file name. Otherwise returns None.

voxToSurfMat

Returns an affine which can be used to transform voxel coordinates into the surface coordinate system for this image.

See: http://www.grahamwideman.com/gw/brain/fs/coords/fscoords.htm See: https://surfer.nmr.mgh.harvard.edu/fswiki/CoordinateSystems

surfToVoxMat

Returns an affine which can be used to transform surface coordinates into the voxel coordinate system for this image.

__module__ = 'fsl.data.mghimage'
surfToWorldMat

Returns an affine which can be used to transform surface coordinates into the world coordinate system for this image.

worldToSurfMat

Returns an affine which can be used to transform world coordinates into the surface coordinate system for this image.