image thumbnail


version (2 KB) by payel ghosh
Creates a 4D rgb image from a 3D label image.


Updated 25 Aug 2005

No License

RGB = LABEL2RGB3D(L) converts a 3D label matrix L, such as returned by WATERSHED, into a color RGB image.

RGB = LABEL2RGB3D(L, MAP) defines the colormap to be used in the RGB image. MAP can either be an n x 3 colormap matrix, a string containing the name of a colormap function (such as 'jet' or 'gray'), or a function handle of a colormap function (such as @jet or @gray).

LABEL2RGB3D evaluates MAP so that there is a different color for each region in L.If MAP is not specified, 'jet' is used as the default.

RGB = LABEL2RGB3D(L, MAP, ZEROCOLOR) defines the RGB color of the elements labeled 0 in the input label matrix L. ZEROCOLOR can either be an RGB triple, or one of the following: 'y' (yellow), 'm', (magenta), 'c' (cyan), 'r'(red), 'g' (green), 'b' (blue), 'w' (white), or 'k'(black). If ZEROCOLOR is not specified, [1 1 1] is used as the default.

RGB = LABEL2RGB3D(L, MAP, ZEROCOLOR, ORDER), controls how colormap colors are assigned to regions in the label matrix. If ORDER is 'noshuffle' (the default), then colormap colors are assigned to the label matrix regions in numerical order. If ORDER is 'shuffle', then colormap colors are pseudorandomly shuffled.

Class Support
The input label matrix L can have any nonsparse numeric class. It must contain finite nonnegative integers. The output of LABEL2RGB3D is ofclass uint8.

MATLAB does not have the capability to visualize 4D data. But the image can be exported to other softwares for visualization.

Cite As

payel ghosh (2021). label2rgb3D (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14SP2
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!