Generate segmentation-based augmentation data with on disk storage

generateDiskData(
  inputImageList,
  segmentationImageList,
  segmentationNumbers,
  selector,
  addCoordConv = TRUE,
  segmentationsArePoints = FALSE,
  maskIndex,
  smoothHeatMaps = 0,
  numpynames,
  numberOfSimulations = 16,
  referenceImage = NULL,
  transformType = "rigid",
  noiseModel = "additivegaussian",
  noiseParameters = c(0, 0.002),
  sdSimulatedBiasField = 5e-04,
  sdHistogramWarping = 5e-04,
  sdAffine = 0.2
)

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

of segmentation images corresponding to the input image list.

segmentationNumbers

the integer list of values in the segmentation to model

selector

subsets the inputImageList and segmentationImageList (eg to define train test splits)

addCoordConv

boolean - generates another array with CoordConv data

segmentationsArePoints

boolean - converts segmentations to points

maskIndex

the entry within the list of lists that contains a mask

smoothHeatMaps

numeric greater than zero will cause method to return heatmaps. the value passed here also sets the smoothing parameter passed to smoothImage in pixel/voxel space.

numpynames

the names of the numpy on disk files should contain something with the string mask if using maskIndex and something with the word coordconv if using CC. should include something with the word heatmaps if using heatmaps.

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

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 bias field.

sdAffine

Determines the amount of transformation based change

Value

list of array

Author

Avants BB

Examples

library( ANTsR )
#> Loading required package: ANTsRCore
#> ANTsRCore 0.7.5 #> For reproducible results, please set the environment variable ANTS_RANDOM_SEED, #> either in .Renviron or with a seed (e.g. XXX): #> Sys.setenv(ANTS_RANDOM_SEED = XXX) #> Sys.setenv(ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS = 1) #> may also be required for reproducible results. See #> https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues #> for more information
#> #> Attaching package: ‘ANTsRCore’
#> The following objects are masked from ‘package:stats’: #> #> sd, var
#> The following objects are masked from ‘package:base’: #> #> all, any, apply, max, min, prod, range, sum
ilist = list( list( ri(1) ), list( ri(2) ) ) slist = list( thresholdImage( ilist[[1]][[1]], "Otsu",3), thresholdImage( ilist[[2]][[1]], "Otsu",3) ) npn = paste0(tempfile(), c('i.npy','s.npy','heatmap.npy','coordconv.npy') ) temp = generateDiskData( ilist, slist, c(0:3), c(TRUE,TRUE), numpynames = npn ) temp = generateDiskData( ilist, slist, c(0:3), c(TRUE,TRUE), segmentationsArePoints=TRUE, numpynames = npn ) temp = generateDiskData( ilist, slist, c(0:3), c(TRUE,TRUE), segmentationsArePoints=TRUE, smoothHeatMaps = 3.0, numpynames = npn )