Learn R Programming

radiomics (version 0.1.3)

discretizeImage: Image Discretization.

Description

discretizeImage Scales the grey values of an image into a specified number of values.

Usage

discretizeImage(data, n_grey = 32, verbose = TRUE)

Arguments

data

A numeric 2D matrix.

n_grey

an integer value, the number of grey levels the image should be quantized into.

verbose

Logical, a message is given when the user supplies more grey values than exist in the image. Setting this value to FALSE will suppress this message.

Value

A matrix of the same dimensions as the input matrix. The entries of the matrix will be set to begin at 1, and go up to the specified value. There is no guarantee that each gray level between 1 and n_grey will have pixels of that value (for example, although n_grey = 32 may be specified, certain images may contain fewer than 32 grey levels).

Details

This function is called in glcm, glrlm, glszm, and mglszm.

If n_grey is greater than the number of unique grey levels in the matrix then no action is taken.

Examples

Run this code
# NOT RUN {
image(psf)
image(discretizeImage(psf, n_grey=5, verbose=F))

image(tumor)
image(discretizeImage(tumor, n_grey=8, verbose=F))
# }

Run the code above in your browser using DataLab