Documentation Center

  • Trial Software
  • Product Updates


Default display range of image based on its class


range = getrangefromclass(I)


range = getrangefromclass(I) returns the default display range of the image I, based on its class type. The function returns range, a two-element vector specifying the display range in the form [min max].

Code Generation

getrangefromclass supports the generation of efficient, production-quality C/C++ code from MATLAB. To see a complete list of toolbox functions that support code generation, see List of Supported Functions with Usage Notes.

Class Support

I can be uint8, uint16, int16, logical, single, or double. range is of class double.


For single and double data, getrangefromclass returns the range [0 1] to be consistent with the way double and single images are interpreted in MATLAB®. For integer data, getrangefromclass returns the default display range of the class. For example, if the class is uint8, the dynamic range is [0 255].


Read in the 16-bit DICOM image and get the default display range.

CT = dicomread('CT-MONO2-16-ankle.dcm');
r = getrangefromclass(CT)
r =

      -32768       32767

See Also


Was this topic helpful?