DENSITY_SLICE Function
Performs color density slicing on individual 2D images.
Usage
result = DENSITY_SLICE(image, nbands)
Input Parameters
image—A 2D image array.
nbands—A scalar integer indicating the number of color bands with which to slice image. (nbands 1)
Returned Value
result—An array of the same size, type, and dimensions as image.
Keywords
Bands—A scalar value or an array with the number of elements (up to nbands) identifying the amplitude ranges for slicing the input image. If Bands is not used to define the individual bands, the value of the Band_Step keyword is used as the step size.
Band_Step—A scalar value specifying the step-size between bands, when the number of bands defined is less than nbands. If Band_Step isn’t defined, the difference between the first two bands is used as the step size.
Levels—A scalar value or an array with the number of elements (up to nbands) identifying the color values for the result image bands. If the keyword Levels is not defined, then Levels = Bands. If a level number is not defined for each band, then Level_Step is used as the step size.
Level_Step—A scalar value specifying the step-size between levels, when the number of levels defined is less than nbands. If Level_Step is not defined, the difference between the first two levels is used as the step size. Otherwise, if only one level is defined, the step size is the
image (max – min + 1)/nbands.
Discussion
Density slicing is a form of pseudo-color image processing in which the input image is treated as a 2D intensity function. The output image is produced by “slicing” the 2D intensity function using slicing planes that are parallel to the image coordinate plane.
 
note
Density slicing is defined for 2D images only.
A different level, or color, is assigned to values in the input image that fall between each slicing plane. Values on the face of the upper plane are assigned the color level corresponding to the area between the plane and the one below it.
Example
; Read in an 8-bit color image.
image = IMAGE_READ(!IP_Data + 'xray.tif')
; Density-slice the image into 5 bands.
density_image = DENSITY_SLICE(image('pixels'), 5, $
bands=[20, 60, 120, 160, 200])
; Set the device to 8 bit.
DEVICE, pseudo = 8
; Load the prism color table.
LOADCT, 6
; Display the density image.
TV, density_image
See Also