cortex.align.automatic¶
- cortex.align.automatic(subject, xfmname, reference, init='coreg', epi_mask=False, intermediate=None, reference_contrast='t2', noclean=False)[source]¶
Perform automatic alignment using Freesurfer’s boundary-based registration. The reference image and resulting transform called xfmname will be automatically stored in the database.
If noclean is set to True, intermediate files will not be removed from /tmp.
It’s good practice to open up this transform afterward in the manual aligner and check how it worked. Do that using the following code (passing the same subject and xfmname used here, no need for reference):
> cortex.align.manual(subject, xfmname)
- Parameters:
- subjectstr
Subject identifier.
- xfmnamestr
Name of the transform to be created and stored in the database.
- referencestr
Path to a nibabel-readable image that will be used as the reference for this transform. Usually, this is a single (3D) functional data volume.
- initstr, optional
One of “coreg”, “fsl”, “header”, or a path to a transform from the reference volume to the anatomical volume. Specifies the initialization method to obtain a first alignment that will be refined with bbregister. Default is “coreg”, which uses Freesurfer’s mri_coreg and it generally performs best. Other options include “fsl” to use FSL’s FLIRT or “header” to assume that the reference and the anatomical are already close enough (this option can be used when the reference and the anatomical are acquired in the same session). Finally, you can also specify a path to a transform file (in DAT or LTA format) that will be used as initialization.
- epi_maskbool, optional
If True, then the flag –epi-mask is passed to bbregister to mask out areas with spatial distortions. This setting recommended whenever the reference was not distortion corrected.
- intermediatestr
Path to a nibabel-readable image that will be used as intermediate volume for alignment. This is useful if the reference image has a small field-of-view and a whole-brain image was acquired in the same session.
- reference_contraststr
Contrast of the reference image. This is used to determine the appropriate contrast for the reference image in the bbregister command. Default is “t2” (for BOLD): gray matter is brighter than white matter. The alternative option is “t1”: white matter is brighter than gray matter.
- nocleanbool, optional
If True, intermediate files will not be removed from /tmp (this is useful for debugging things), and the returned value will be the name of the temp directory. Default False.
- Returns:
- None or path to temp directory if noclean is True.