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:
Image
The
MGHImage
class is a NIFTIImage
which has been converted from a Freesurfer.mgh
file.- See:
- __init__(image, **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 afilename
is not provided, converts the original (MGH) file name into a NIFTI filename, before passing it to theImage.save()
method.
- property mghImageFile
If this
MGHImage
was 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.
- __annotations__ = {}
- __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
Image
object.- Returns:
A
(4, 4)
matrix encoding an affine transformation from the image voxel coordinate system to the corresponding Freesurfer surface coordinate system.