View source: R/imaging-ants-io.R
| write_ants_warp | R Documentation |
'ANTs' deformation (warp) fieldwrite_ants_warp stores a dense displacement field (such as the
forward_field / inverse_field from
register_volume3d) as an 'ANTs' 5-D warp 'NIfTI'
(intent_code 1007, LPS vectors) readable by
antsApplyTransforms; read_ants_warp reads it back. Requires the
suggested freesurferformats package.
The field is stored on disk with displacement vectors in LPS (the x
and y components are negated relative to the RAS field) and an
sform equal to vox2ras, so the file describes the fixed grid's
physical space exactly as 'ANTs' expects. Optionally the RAS
affine can be hidden in the header text fields
(descrip/aux_file); 'ANTs' ignores those, and recovery on
read is opt-in.
write_ants_warp(
field,
file,
vox2ras = attr(field, "vox2ras"),
affine = NULL,
direction = c("forward", "inverse")
)
read_ants_warp(file, recover_affine = FALSE)
field |
a |
file |
path to the warp |
vox2ras |
the fixed-grid |
affine |
optional |
direction |
|
recover_affine |
logical; if |
write_ants_warp returns file invisibly;
read_ants_warp returns the (nx, ny, nz, 3) RAS field with
a "vox2ras" attribute (and, if recovered, "transform" /
"direction" attributes).
register_volume3d, save_registration
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.