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.

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

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()
#> used (Mb) gc trigger (Mb) limit (Mb) max used (Mb) #> Ncells 2590335 138.4 4570014 244.1 NA 4570014 244.1 #> Vcells 4582902 35.0 12255594 93.6 65536 12254504 93.5
rm(segmentation2); gc()
#> used (Mb) gc trigger (Mb) limit (Mb) max used (Mb) #> Ncells 2589399 138.3 4570014 244.1 NA 4570014 244.1 #> Vcells 4581378 35.0 12255594 93.6 65536 12254504 93.5
rm(image1); gc()
#> used (Mb) gc trigger (Mb) limit (Mb) max used (Mb) #> Ncells 2589389 138.3 4570014 244.1 NA 4570014 244.1 #> Vcells 4581383 35.0 12255594 93.6 65536 12254504 93.5
rm(image2); gc()
#> used (Mb) gc trigger (Mb) limit (Mb) max used (Mb) #> Ncells 2589379 138.3 4570014 244.1 NA 4570014 244.1 #> Vcells 4581388 35.0 12255594 93.6 65536 12254504 93.5