dataAugmentation: Randomly transform image data.

View source: R/dataAugmentation.R

dataAugmentationR Documentation

Randomly transform image data.

Description

Given an input image list (possibly multi-modal) and an optional corresponding segmentation image list, this function will perform data augmentation with the following augmentation possibilities: spatial transformations, added image noise, simulated bias field, and histogram warping.

Usage

dataAugmentation(
  inputImageList,
  segmentationImageList = NULL,
  pointsetList = NULL,
  numberOfSimulations = 10,
  referenceImage = NULL,
  transformType = "affineAndDeformation",
  noiseModel = "additivegaussian",
  noiseParameters = c(0, 0.05),
  sdSimulatedBiasField = 1,
  sdHistogramWarping = 0.05,
  sdAffine = 0.05,
  sdDeformation = 0.2,
  outputNumpyFilePrefix = NULL,
  verbose = FALSE
)

Arguments

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).

pointsetList

list of pointsets (matrices) corresponding to the input image list (optional). If using this option, the transformType must be invertible.

numberOfSimulations

number of output images. Default = 10.

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.

transformType

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

noiseModel

one of the following options c( "additivegaussian", "saltandpepper", "shot", "speckle", or "random" ). Alternatively, one can specify an array or list of one or more of the options and one is selected at random with reasonable, randomized parameters. Note that the "speckle" model takes much longer than the others. #' @param noiseParameters 'additivegaussian': c( mean, standardDeviation ), 'saltandpepper': c( probability, saltValue, pepperValue) , 'shot': scale, 'speckle': standardDeviation. Note that the standard deviation, scale, and probability values are max values and are randomly selected in the range 0, noise_parameter. Also, the "mean", "saltValue" and pepperValue" are assumed to be in the intensity normalized range of 0, 1.

sdSimulatedBiasField

Characterize the standard deviation of the amplitude.

sdHistogramWarping

Determines the strength of the histogram transformation.

sdAffine

Determines the amount of affine transformation.

sdDeformation

Determines the amount of deformable transformation.

outputNumpyFilePrefix

Filename of output numpy array containing all the simulated images and segmentations.

Value

list of lists of transformed images and/or outputs to a numpy array.

Author(s)

Tustison NJ

Examples


library( ANTsR )
image1 <- antsImageRead( getANTsRData( "r16" ) )
image2 <- antsImageRead( getANTsRData( "r64" ) )
segmentation1 <- thresholdImage( image1, "Otsu", 3 )
segmentation2 <- thresholdImage( image2, "Otsu", 3 )
points1 = getCentroids( segmentation1 )[,1:2]
points2 = getCentroids( segmentation2 )[,1:2]
data <- dataAugmentation(
  list( list( image1 ), list( image2 ) ),
  list( segmentation1, segmentation2 ),
  list( points1, points2 ), transformType = 'scaleShear' )
rm(segmentation1); gc()
rm(segmentation2); gc()
rm(image1); gc()
rm(image2); gc()

ANTsX/ANTsRNet documentation built on April 28, 2024, 12:16 p.m.