This function is primarily intended for developer use (it is
used inside xform_brain
) but may be useful for end users.
bridging_sequence(
sample,
reference,
via = NULL,
imagedata = FALSE,
checkboth = !imagedata,
mustWork = FALSE
)
Source template brain (e.g. IS2) that data is currently in.
Specified either as character vector or a templatebrain
object.
Target template brain (e.g. IS2) that data should be transformed into.
(optional) intermediate template brain that the registration sequence must pass through.
Whether x
should be treated as image data (presently
only supported as a file on disk) or 3D object vertices - see details.
whether to look for registrations in both
directions. The default (checkboth=FALSE
) will only return
registrations in the forward direction (see details).
whether to error out if appropriate registrations are not found.
When checkboth=FALSE
, only registrations that can be directly
used to map image data from sample to reference are returned. When working
with 3D points, use checkboth=TRUE
. Note that all possible
directories will first be scanned for registrations in the preferred
direction and then rescanned for the opposite direction if nothing is
found.
When mapping points from JFRC2 -> IS2 -> FCWB
(i.e. sample=JFRC2, via=IS2, ref=FCWB) the command line passed to CMTK's streamxform
should look like:
streamxform -- JFRC2_IS2.list --inverse FCWB_IS2.list
However when mapping image data
the command line for CMTK's reformatx should look like:
reformatx -o out.nrrd --floating JFRC2.nrrd FCWB.nrrd FCWB_IS2.list --inverse JFRC2_IS2.list
bridging_sequence
produces output like
list(JFRC2 = structure(
"/GD/dev/R/nat.flybrains/inst/extdata/bridgingregistrations/JFRC2_IS2.list",
swap = TRUE),
IS2 = "/GD/dev/R/nat.flybrains/inst/extdata/bridgingregistrations/FCWB_IS2.list")
in these circumstances, which xformpoints.cmtkreg turns into "-- JFRC2_IS2.list --inverse FCWB_IS2.list".
if (FALSE) {
bridging_sequence(sample=JFRC2, ref=FCWB, checkboth = TRUE)
bridging_sequence(sample=JFRC2, via=IS2, ref=FCWB, checkboth = TRUE)
}