cmtk.reformatx: Reformat an image with a CMTK registration using the...

View source: R/cmtk-reformat.R

cmtk.reformatxR Documentation

Reformat an image with a CMTK registration using the reformatx tool

Description

Reformat an image with a CMTK registration using the reformatx tool

Usage

cmtk.reformatx(
  floating,
  registrations,
  output,
  target,
  mask = FALSE,
  direction = NULL,
  interpolation = c("linear", "nn", "cubic", "pv", "sinc-cosine", "sinc-hamming"),
  dryrun = FALSE,
  Verbose = TRUE,
  MakeLock = TRUE,
  OverWrite = c("no", "update", "yes"),
  filesToIgnoreModTimes = NULL,
  ...
)

Arguments

floating

The floating image to be reformatted

registrations

One or more CMTK format registrations on disk

output

The path to the output image (defaults to "<targetstem>_<floatingstem>.nrrd")

target

A character vector specifying an image file on disk, an im3d object (or an object that can be coerced to im3d) or a 6-or 9-vector defining a grid in the form Nx,Ny,Nz,dX,dY,dZ,[Ox,Oy,Oz].

mask

Whether to treat target as a binary mask (only reformatting positive voxels)

direction

Whether to transform image from sample space to reference space (called forward by CMTK) or from reference to sample space (called inverse by CMTK). Default (when NULL is forward).

interpolation

What interpolation scheme to use for output image (defaults to linear - see details)

dryrun

Just print command

Verbose

Whether to show cmtk status messages and be verbose about file update checks. Sets command line --verbose option.

MakeLock

Whether to use a lock file to allow simple parallelisation (see makelock)

OverWrite

Whether to OverWrite an existing output file. One of c("no","update","yes"). When OverWrite='update' RunCmdForNewerInput is used to determine if the output is older than any of the input files.

filesToIgnoreModTimes

Input files whose modification time should not be checked when determining if new output is required.

...

additional arguments passed to CMTK reformatx after processing by cmtk.call.

Details

Note that if you are reformatting a mask then you will need to change the interpolation to "nn", since interpolating between e.g. mask levels 72 and 74 with 73 may have unintened consequences. Presently we have no way of knowing whether an image should be treated as a mask, so the interpolation must be handled manually.

Value

the path to the ouput image (whether or not it was re-created afresh) or NA_character_ if no output was possible.

See Also

cmtk.bindir, cmtk.call, makelock, RunCmdForNewerInput

Examples

## Not run: 
cmtk.reformatx('myimage.nrrd', target='template.nrrd',
  registrations='template_myimage.list')

# get full listing of command line options  
system(cmtk.call('reformatx', help=TRUE))

## End(Not run)

nat documentation built on Aug. 25, 2023, 5:16 p.m.