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", "rotation", "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  4250981 227.1    7574517 404.6         NA  7574517 404.6
#> Vcells 12444021  95.0   22785357 173.9     102400 22785327 173.9
rm(segmentation2); gc()
#>            used  (Mb) gc trigger  (Mb) limit (Mb) max used  (Mb)
#> Ncells  4250802 227.1    7574517 404.6         NA  7574517 404.6
#> Vcells 12442382  95.0   22785357 173.9     102400 22785327 173.9
rm(image1); gc()
#>            used  (Mb) gc trigger  (Mb) limit (Mb) max used  (Mb)
#> Ncells  4250790 227.1    7574517 404.6         NA  7574517 404.6
#> Vcells 12442384  95.0   22785357 173.9     102400 22785327 173.9
rm(image2); gc()
#>            used  (Mb) gc trigger  (Mb) limit (Mb) max used  (Mb)
#> Ncells  4250778 227.1    7574517 404.6         NA  7574517 404.6
#> Vcells 12442386  95.0   22785357 173.9     102400 22785327 173.9