Cuts a numeric image into an integer factor, with the option of a mask.

# S3 method for class 'antsImage'
cut(x, breaks, ..., mask)

Arguments

x

Object of class antsImage

breaks

either a numeric vector of two or more unique cut points or a single number (greater than or equal to 2) giving the number of intervals into which x is to be cut. Passed to cut)

...

Arguments passed to cut

mask

object to subset the image. If missing, then all values of the image are used

Value

Object of class antsImage with an attribute of levels

Examples

img <- makeImage(c(10, 10), rnorm(100))
mask <- img > 0
cut(img, mask = mask, breaks = 4)
#> antsImage
#>   Pixel Type          : float 
#>   Components Per Pixel: 1 
#>   Dimensions          : 10x10 
#>   Voxel Spacing       : 1x1 
#>   Origin              : 0 0 
#>   Direction           : 1 0 0 1 
#> 
cut(img, breaks = 4)
#> antsImage
#>   Pixel Type          : float 
#>   Components Per Pixel: 1 
#>   Dimensions          : 10x10 
#>   Voxel Spacing       : 1x1 
#>   Origin              : 0 0 
#>   Direction           : 1 0 0 1 
#>