randomlyTransformImageData: Randomly transform image data (optional: with corresponding...

View source: R/randomlyTransformImageData.R

randomlyTransformImageDataR Documentation

Randomly transform image data (optional: with corresponding segmentations).

Description

Apply rigid, affine and/or deformable maps to an input set of training images. The reference image domain defines the space in which this happens.

Usage

randomlyTransformImageData(
  referenceImage,
  inputImageList,
  segmentationImageList = NULL,
  numberOfSimulations = 10,
  transformType = "affine",
  sdAffine = 0.02,
  deformationTransformType = c("bspline", "exponential"),
  numberOfRandomPoints = 1000,
  sdNoise = 10,
  numberOfFittingLevels = 4,
  meshSize = 1,
  sdSmoothing = 4,
  inputImageInterpolator = "linear",
  segmentationImageInterpolator = "nearestNeighbor"
)

Arguments

referenceImage

defines the spatial domain for all output images. If the input images do not match the spatial domain of the reference image, we internally resample the target to the reference image. This could have unexpected consequences. Resampling to the reference domain is performed by testing using antsImagePhysicalSpaceConsistency then calling resampleImageToTarget upon failure.

inputImageList

list of lists of input images to warp. The internal list sets contains one or more images (per subject) which are assumed to be mutually aligned. The outer list contains multiple subject lists which are randomly sampled to produce output image list.

segmentationImageList

list of segmentation images corresponding to the input image list (optional).

numberOfSimulations

number of output images. Default = 10.

transformType

one of the following options c( "translation", "rigid", "scaleShear", "affine"," deformation" , "affineAndDeformation" ). Default = \"affine\".

sdAffine

parameter dictating deviation amount from identity for random linear transformations. Default = 0.02.

deformationTransformType

one of the following options c( "bspline", "exponential" ) if deformation is specified in the transformType. Default = \"bspline\".

numberOfRandomPoints

number of displacement points for the deformation field. Default = 1000.

sdNoise

standard deviation of the displacement field noise (in mm). Default = 10.0.

numberOfFittingLevels

(bspline deformation only) number of fitting levels. Default = 4.

meshSize

(bspline deformation only) scalar or n-D vector determining fitting resolution. Default = 1.

sdSmoothing

(exponential deformation only) standard deviation of the Gaussian smoothing in mm. Default = 4.0.

inputImageInterpolator

one of the following options c( "linear", "gaussian", "bspline" ). Default = \"linear\".

segmentationImageInterpolator

one of the following options c( "nearestNeighbor", "genericLabel" ). Default = \"nearestNeighbor\".

Value

list (if no directory set) or boolean for success, failure

Author(s)

Avants BB, Tustison NJ

Examples


library( ANTsR )
image1 <- antsImageRead( getANTsRData( "r16" ) )
image2 <- antsImageRead( getANTsRData( "r64" ) )
segmentation1 <- thresholdImage( image1, "Otsu", 3 )
segmentation2 <- thresholdImage( image2, "Otsu", 3 )
data <- randomlyTransformImageData( image1,
  list( list( image1 ), list( image2 ) ),
  list( segmentation1, segmentation2 ) )
rm(segmentation1); gc()
rm(segmentation2); gc()
rm(image1); gc()
rm(image2); gc()

ANTsX/ANTsRNet documentation built on April 23, 2024, 1:24 p.m.