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(*args, **kwargs)[source]¶ Bases:
fsl.data.image.ImageThe
MGHImageclass is a NIFTIImagewhich has been converted from a Freesurfer.mghfile.- See:
-
__init__(image, **kwargs)[source]¶ Create a
MGHImage.- Parameters
image – Name of MGH file, or a
nibabel.freesurfer.mghformat.MGHImageinstance.
All other arguments are passed through to
Image.__init__()
-
save(filename=None)[source]¶ Overrides
Image.save(). If afilenameis not provided, converts the original (MGH) file name into a NIFTI filename, before passing it to theImage.save()method.
-
property
mghImageFile¶ If this
MGHImagewas loaded from a file, returns the file name. Otherwise returnsNone.
-
property
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
-
property
surfToVoxMat¶ Returns an affine which can be used to transform surface coordinates into the voxel coordinate system for this image.
-
property
surfToWorldMat¶ Returns an affine which can be used to transform surface coordinates into the world coordinate system for this image.
-
__module__= 'fsl.data.mghimage'¶
-
property
worldToSurfMat¶ Returns an affine which can be used to transform world coordinates into the surface coordinate system for this image.
-
fsl.data.mghimage.voxToSurfMat(img)[source]¶ Generate an affine which can transform the voxel coordinates of the given image into a corresponding Freesurfer surface coordinate system (known as “Torig”, or “vox2ras-tkr”).
See https://surfer.nmr.mgh.harvard.edu/fswiki/CoordinateSystems
- Parameters
img – An
Imageobject.- Returns
A
(4, 4)matrix encoding an affine transformation from the image voxel coordinate system to the corresponding Freesurfer surface coordinate system.