Index
Contents
Name
lta_convert
Description
Converts between different linear transform formats.
Some formats may require you to pass an image if the geometry information is missing from the transform file format.
Formats called "inverse" below transform coordinates from the space of the target image to the space of the source image.
Synopsis
lta_convert [options]
Arguments
Required Flagged Arguments
Exactly one input is required
Flag |
Description |
--inlta <in.lta> |
input transform of LTA type |
--infsl <in.fslmat> |
input transform of FSL type |
--inmni <in.xfm> |
input transform of MNI / XFM type |
--inreg <inreg.dat> |
input transform of TK REG type (deprecated format) |
--inniftyreg, --inras <inniftyreg.dat> |
input transform of NiftyReg type (inverse RAS2RAS) |
--inniftyreg2d <inniftyreg2d.dat> |
input transform of NiftyReg type for an image (2D) |
--initk, --inlps <initk.txt> |
input ITK transform (inverse LPS2LPS). Convert ANTS .mat binary to ITK format with ConvertTransformFile (in ANTS). |
--invox <invox.txt> |
input transform in source image space (inverse VOX2VOX) |
Exactly one output is required
Flag |
Description |
--outlta <out.lta> |
output linear transform (LTA FreeSurfer format) |
--outfsl <out.mat> |
output transform in FSL format (set FSLOUTPUTTYPE env var to, e.g., "NIFTI" or "ANALYZE" to determine type of flipping) |
--outmni <out.xfm> |
output transform in mni/xfm format |
--outreg <reg.dat> |
output transform in reg dat format |
--outniftyreg, --outras <outniftyreg.txt> |
output transform in NiftyReg format (inverse RAS2RAS) |
--outitk, --outlps <outitk.txt> |
output transform in ITK txt format (inverse LPS2LPS) |
--outvox <outvox.txt> |
output transform in source image space (inverse VOX2VOX) |
Optional Flagged Arguments
--invert |
inverts transform |
--ltavox2vox |
(with --ltaout) output type VOX2VOX (default RAS2RAS) |
--ltatkreg |
(with --ltaout) output type REGISTER_DAT (default RAS2RAS) |
While LTA contains src and trg information, other file formats are missing this information and you need to explicitly pass it via --src and/or --trg.
You can also use this if you want to inform the transform to reslice your image differently (i.e. to modify the geometry information without changing RAS coordinates).
For TKREG/register.dat type matrices, src=mov and trg=ref/targ.
--src |
specify src image geometry (mov volume for TKREG/register.dat) |
--trg |
specify trg image geometry |
--subject |
specify subject name (overrides if input has subject name defined). |
LTA src/trg geometry options
LTA is converted to SCANNER_RAS to SCANNER_RAS. The source and/or target VOL_GEOM is changed depending upon the desired operation(s).
None of the operations will change the RAS2RAS matrix.
--srcconform |
conform src image geometry (COR standard). Will be done before inversion, if specified. |
--srcconform-dc |
keep src image directional cosine |
--srcconform-min |
conform src image geometry to min direction size |
--srcconform-size size_in_mm |
conform src image geometry to the size given in mm |
--srcupsample N |
upsample src image geometry by factor of N |
--srcdownsample N |
downsample src image geometry by factor of N |
--trgconform |
conform trg image geometry (COR standard). Will be done before inversion, if specified. |
--trgconform-dc |
keep trg image directional cosine |
--trgconform-min |
conform trg image geometry to min direction size |
--trgconform-size size_in_mm |
conform trg image geometry to the size given in mm |
--trgupsample N |
upsample trg image geometry by factor of N |
--trgdownsample N |
downsample trg image geometry by factor of N |
--regheader |
Same as --inlta identity.nofile (make lta from src and trg volumes) |
Examples
Example 1
Convert FSL transform to LTA (FreeSurfer):
lta_convert --infsl fsl.mat --outlta my.lta --src src.nii --trg trg.nii
converts FSL matrix to FreeSurfer LTA, adding missing src and target geometry info (the images used when fsl.mat was created).
Example 2
Convert ANTS/ITK transform to LTA (FreeSurfer):
First convert the ANTS binary mat file to ITK text file format and then to lta (adding src and trg geometry info, from images that were used to create the transform in ANTS):
$ANTSPATH/ConvertTransformFile 3 3D_antsAffine.mat 3D_antsAffine.txt
lta_convert --initk 3D_antsAffine.txt --outlta 3D_antsAffine.lta --src nsrc.nii --trg trg.nii
Example 3
Invert transform:
lta_convert --inlta in.lta --outlta out-inverse.lta --invert
Reads in.lta, inverts it and saves it as out-inverse.lta
Example 4
Conform target geometry:
lta_convert --inlta in.lta --outlta out-conform.lta --trgconform
Reads in.lta, conforms trg geometry and saves it as out-conform.lta
Example 5
Create transform from header geometries only:
lta_convert --regheader --src src.nii --trg trg.nii --outlta out.lta
lta_convert --inlta identity.nofile --src src.nii --trg trg.nii --outlta out.lta
Creates LTA from SRC and TRG header geometies, e.g. to convert SPM results to LTA (SPM stores its transforms in the header).
Similarly you can create a lta for conform reslicing when specifying --trgconform instead of --trg trg.nii.
See Also
mri_warp_convert (similar functionality for warp fields)
mri_concatenate_lta (concatenate or invert LTA transforms)
mri_concatenate_gcam (concatenate or invert warp fields)
mri_convert -at or -ait (apply transforms to an image)
Reporting Bugs
Report bugs to < analysis-bugs@nmr.mgh.harvard.edu >
