How to display the volume of a masked volume?

5 visualizaciones (últimos 30 días)
John
John el 22 de En. de 2025
Respondida: Walter Roberson el 3 de Abr. de 2025
For a 3D image or a stack of 2D images stored in a matrix format (Nx, Ny, Nz), there is a corresponding mask image of the same size that defines a 3D volume within the 3D image. How can I display only this masked volume using volshow or other functions to visualize the volume? Thank you.
  1 comentario
Rik
Rik el 23 de En. de 2025
Depending on what you want to do, simply multiplying the image by the mask (i.e. setting all non-mask voxels to 0) may already be enough.
What have you tried so far?

Iniciar sesión para comentar.

Respuestas (3)

Jaimin
Jaimin el 29 de En. de 2025
To visualize only the masked volume from a 3D image using "volshow" function. you should first apply the mask to the 3D image. This involves multiplying the 3D image by the mask, which will set all voxels outside the mask to zero.
Kindly refer following code snippet for undertanding.
% Apply the mask to the volume data
maskedVolume = volumeData .* mask;
% Visualize the masked volume using volshow
volshow(maskedVolume);
For more information kindly refer following MathWorks documentation.
Thanks.
  1 comentario
John
John el 5 de Feb. de 2025
This will not make the display only on the volume.

Iniciar sesión para comentar.


Ronit
Ronit el 3 de Abr. de 2025
Hello John,
If you want the visualization to focus specifically on the volume, you may need to adjust the view or the rendering options. Consider modifying the "Colormap" and "RenderingStyle" options:
vol = volshow(maskedVolume);
vol.Colormap = jet;
vol.RenderingStyle = 'VolumeRendering';
These adjustments can significantly improve the clarity and focus of the displayed volume.
Please refer to the documentation on "Volume Properties" for a better understanding of the options mentioned above:
Thanks,
Ronit

Walter Roberson
Walter Roberson el 3 de Abr. de 2025
Something like
vol1 = any(mask, [2 3]);
miny = find(vol1, 1, 'first');
maxy = find(vol1, 1, 'last');
vol2 = any(mask, [1 3]);
minx = find(vol2, 1, 'first');
maxx = find(vol2, 1, 'last');
vol3 = any(mask, [1 2]);
minz = find(vol3, 1, 'first');
maxz = find(vol3, 1, 'last');
vol = VolumeData(miny:maxy, minx:maxx, minz:maxz);
volshow(vol)

Productos


Versión

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by