This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


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.


collapse all

Read 16-bit DICOM image into the workspace.

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

Get the display range from the image.

r = getrangefromclass(CT)
r = 1×2

      -32768       32767

Input Arguments

collapse all

Input image, specified as a numeric array or logical array.

Output Arguments

collapse all

Display range, returned as a 2-element numeric vector of the form [min max].

  • 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 minimum and maximum representable values for that integer class. For example, if the class is uint8, the dynamic range is [0 255].

  • For logical data, getrangefromclass returns the range [0 1].

Data Types: double

Extended Capabilities

Introduced before R2006a