% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/imaging-ants-io.R
\name{save_registration}
\alias{save_registration}
\alias{save_registration.ravetools_register_volume3d}
\alias{save_registration.default}
\alias{load_registration}
\title{Save or load a registration result in \verb{'ANTs'}-compatible files}
\usage{
save_registration(x, path, ...)

\method{save_registration}{ravetools_register_volume3d}(x, path, prefix = "registration", compress = TRUE, ...)

\method{save_registration}{default}(x, path, prefix = "registration", ...)

load_registration(file, recover_affine_from_header = FALSE)
}
\arguments{
\item{x}{a \code{ravetools_register_volume3d} object (or, for the default
method, a \eqn{4\times 4} matrix)}

\item{path}{output directory, or the manifest (\code{.dcf}) path}

\item{...}{passed to methods}

\item{prefix}{file-name prefix; defaults to \code{"registration"}}

\item{compress}{logical; write warp fields as \code{.nii.gz} (default) or
\code{.nii}}

\item{file}{a \code{.mat}, \code{.nii}/\code{.nii.gz}, or \code{.dcf} path}

\item{recover_affine_from_header}{logical; only used as a last resort when
loading. If \code{TRUE} and the \verb{affine} \code{.mat} is missing (or a warp
file is loaded directly), the \verb{affine} is recovered from the warp
header's hidden encoding. Off by default because that encoding is
reduced-precision}
}
\value{
\code{save_registration} returns the manifest path invisibly.
\code{load_registration} returns a \eqn{4\times 4} matrix, a field array
(with a \code{"vox2ras"} attribute), or a \code{ravetools_register_volume3d}
object, depending on the file type.
}
\description{
\code{save_registration} writes a \code{\link{register_volume3d}} result to
disk as \pkg{'ANTs'}-style files: an \verb{'ITK'} \verb{affine} \code{.mat}, the
forward/inverse warp \code{'NIfTI'}(s) when present, and a small
\verb{'DCF'} manifest (the same key-value format as \code{'DESCRIPTION'})
recording what each file is plus the registration parameters.
\code{load_registration} reads any of those back: a \code{.mat} returns a
\eqn{4\times 4} \verb{RAS} matrix, a warp \code{.nii}/\code{.nii.gz} returns
the field, and a \code{.dcf} manifest reassembles the full object.
}
\seealso{
\code{\link{register_volume3d}}, \code{\link{write_ants_transform}},
\code{\link{write_ants_warp}}
}
