cortex.xfm.Transform

class cortex.xfm.Transform(xfm: NDArray, reference: str | tuple[int, int, int] | NDArray | nibabel.Nifti1Image)[source]

A standard affine transform. Typically holds a transform from anatomical magnet space to epi file space.

Parameters:
xfmndarray

4x4 affine transformation matrix.

referencestr, tuple of int, ndarray, or nibabel.Nifti1Image

Reference space for the transform. If a str, treated as a path to a nibabel-readable image (loaded to set reference and shape); if loading fails, kept as a plain string. If a 3-tuple of ints, used directly as shape, with no reference image loaded. Otherwise (ndarray or nibabel.Nifti1Image), used directly as reference, with shape derived from it.

__init__(xfm: NDArray, reference: str | tuple[int, int, int] | NDArray | nibabel.Nifti1Image)[source]

Methods

__init__(xfm, reference)

from_freesurfer(fs_register, func_nii, subject)

Converts a FreeSurfer transform to a pycortex transform.

from_fsl(xfm, func_nii, anat_nii)

Converts an fsl transform to a pycortex transform.

save(subject, name[, xfmtype])

Save this transform into the pycortex database.

to_freesurfer(fs_register, subject[, ...])

Converts a pycortex transform to a FreeSurfer transform.

to_fsl(anat_nii[, direction])

Converts a pycortex transform to an FSL transform.

Attributes

inv

The inverse of this transform, as a new Transform object with the same reference (or shape, if no reference is set).

reference_nifti

The reference as a loaded nifti image, for callers that need its affine/header.

shape

reference