color map based on area

A 3D volume is constructed from a stack of 2D masks (slices). How to color each slice based on the area of the object inside. Suppose the volume is a trunk.

2 comentarios

Walter Roberson
Walter Roberson el 25 de Jul. de 2018
Do you want all the pixels selected by the mask of a slice to be the same color? Or do you want to shade by value, different brightness of the color according to pixel value?
Yazan
Yazan el 25 de Jul. de 2018
I have the volume as 3D matrix (n by n by 500) and the area as a separate 1 by 500 vector.

Iniciar sesión para comentar.

Respuestas (2)

Yazan
Yazan el 25 de Jul. de 2018

0 votos

Thanks Walter for your comment. All pixels should have the same color based on the area of the mask at that slice. The maximum area is 12 unit square and the minimum is 4 unit square and the volume (or isosurface) was constructed from 500 slices.
Walter Roberson
Walter Roberson el 25 de Jul. de 2018

0 votos

colorval = repmat( sum( sum( masks3d, 1), 2) ), size(masks3d, 1), size(masks3d, 2), 1 ) .* masks3d;
vol3d('CData', colorval', 'alpha', double(masks3d))

Etiquetas

Preguntada:

el 25 de Jul. de 2018

Respondida:

el 25 de Jul. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by