discretizeImage: Image Discretization.

Description Usage Arguments Details Value Examples

View source: R/ImageQuantize.R

Description

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

Usage

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

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.

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

Examples

1
2
3
4
5
image(psf)
image(discretizeImage(psf, n_grey=5, verbose=F))

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

Example output

radiomics: Functions for texture analysis of greyscale images.
Enter ?calc_features to see available texture features.

radiomics documentation built on May 2, 2019, 3:36 p.m.