randomlyTransformImageData.RdApply 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"
)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.
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.
list of segmentation images corresponding to the input image list (optional).
number of output images. Default = 10.
one of the following options
c( "translation", "rotation", "rigid", "scaleShear", "affine"," deformation" ,
"affineAndDeformation" ). Default = \"affine\".
parameter dictating deviation amount from identity for random linear transformations. Default = 0.02.
one of the following options
c( "bspline", "exponential" ) if deformation is specified in the
transformType. Default = \"bspline\".
number of displacement points for the deformation field. Default = 1000.
standard deviation of the displacement field noise (in mm). Default = 10.0.
(bspline deformation only) number of fitting levels. Default = 4.
(bspline deformation only) scalar or n-D vector determining fitting resolution. Default = 1.
(exponential deformation only) standard deviation of the Gaussian smoothing in mm. Default = 4.0.
one of the following options
c( "linear", "gaussian", "bspline" ). Default = \"linear\".
one of the following options
c( "nearestNeighbor", "genericLabel" ). Default =
\"nearestNeighbor\".
list (if no directory set) or boolean for success, failure
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 4284344 228.9 6338411 338.6 NA 6338411 338.6
#> Vcells 7250267 55.4 16439144 125.5 102400 16439144 125.5
rm(segmentation2); gc()
#> used (Mb) gc trigger (Mb) limit (Mb) max used (Mb)
#> Ncells 4283799 228.8 6338411 338.6 NA 6338411 338.6
#> Vcells 7248018 55.3 16439144 125.5 102400 16439144 125.5
rm(image1); gc()
#> used (Mb) gc trigger (Mb) limit (Mb) max used (Mb)
#> Ncells 4283787 228.8 6338411 338.6 NA 6338411 338.6
#> Vcells 7248020 55.3 16439144 125.5 102400 16439144 125.5
rm(image2); gc()
#> used (Mb) gc trigger (Mb) limit (Mb) max used (Mb)
#> Ncells 4283775 228.8 6338411 338.6 NA 6338411 338.6
#> Vcells 7248022 55.3 16439144 125.5 102400 16439144 125.5