R/randomImageTransformBatchGenerator.R
randomImageTransformParametersBatchGenerator.RdThis R6 class can be used to generate parameters to affine and other
transformations applied to an input image population.
The class calls randomImageTransformParametersAugmentation.
bgen = randomImageTransformParametersBatchGenerator$new( ... ) bgen$generate( batchSize = 32L )
imageDomain defines the spatial domain for all images.
imageList List contains k images.
transformType random transform type to generate;
one of the following options
c("Translation","Rigid","ScaleShear","Affine","DeformationBasis" )
NOTE: if the input images do not match the spatial domain of the domain
image, we internally resample the target to the domain. This may have
unexpected consequences if you are not aware of this.
This operation will test
antsImagePhysicalSpaceConsistency then call
resampleImageToTarget upon failure.
spatialSmoothing spatial smoothing for simulated deformation
numberOfCompositions number of compositions
deformationBasis list of basis deformations
txParamMeans vector of basis deformations means
txParamSDs vector of basis deformations sds
center center the parameters before passing to Y
$new() Initialize the class in default empty or filled form.
$generate generate the batch of samples with given batch size
library( ANTsR ) i1 = antsImageRead( getANTsRData( "r16" ) ) i2 = antsImageRead( getANTsRData( "r64" ) ) s1 = thresholdImage( i1, "Otsu", 3 ) s2 = thresholdImage( i2, "Otsu", 3 ) # see ANTsRNet randomImageTransformAugmentation predictors = list( i1, i2, i2, i1 ) trainingData <- randomImageTransformParametersBatchGenerator$new( imageList = predictors, transformType = "Affine", imageDomain = i1, txParamMeans=c(1,0,0,1,0,0), txParamSDs=diag(6)*0.01 ) testBatchGenFunction = trainingData$generate( 2 ) myout = testBatchGenFunction( )