Depth color coding using Volumeviewer/ Volshow

4 visualizaciones (últimos 30 días)
MechenG
MechenG el 2 de Jun. de 2025
Comentada: MechenG el 4 de Jun. de 2025
Hi,
I am uisng the below script to display focal stacks in 3D. May I know how to include colormap for depth?
filePattern = fullfile(fileFolder, '*.png');
all_images = dir(filePattern);
I = imread(all_images(1).name);
I= rgb2ind(I,256);
W=365;
H=365;
D = numel(all_tiff);
stack = zeros(W,H,D);
stack(:,:,1) = first_image;
for i = 2:D
II = imread(all_tiff(i).name);
II = rgb2ind(II,256);
stack(:,:,i) = II;
end
volumeViewer(stack);
I also tried below tutorial which involves Volshow(), However I got the below shown graphics error while running
Error using images.ui.graphics3d.Volume/validateData
Expected input to be finite.
Error in images.ui.graphics3d.Volume/setData
Error in images.ui.graphics3d.GraphicsContainer/set.Data
Error in images.ui.graphics3d.internal.AbstractContainer/set
Error in images.ui.graphics3d.GraphicsContainer
Error in images.ui.graphics3d.Volume
Error in volshow (line 32)
hVolume = images.ui.graphics3d.Volume(viewer, 'Data', V, remainingInputs{:});
Error in depthVolumeColorCoder (line 83)
V = volshow(arr,...
clear; close all; clc;
%% Display Grayscale Spiral
%set colormap to use for depth coding
colormap = hsv;
%load data from MATLAB
load('spiralVol.mat');
vol = spiralVol;
%display grayscale volume
volshow(vol)
%snap pic of the grayscale volume for publishing
snapnow
close;
%% Display Color Coded Spiral
%colorcode the spiral
depthVolumeColorCoder(vol,colormap)
  3 comentarios
MechenG
MechenG el 3 de Jun. de 2025
Thanks for the suggestion. Unfortunately, it didn't solve the issue. I am getting the same error.. Here is the tutorial (https://uk.mathworks.com/matlabcentral/fileexchange/92208-depth-volume-color-coder) I have tried out.
Walter Roberson
Walter Roberson el 3 de Jun. de 2025
Did all three lines return 0?

Iniciar sesión para comentar.

Respuesta aceptada

Gayathri
Gayathri el 3 de Jun. de 2025
To view the volume with the colormap, please use the following lines of code
clear; close all; clc;
%% Display Grayscale Spiral
%set colormap to use for depth coding
colormap = hsv;
%load data from MATLAB
load('spiralVol.mat');
vol = spiralVol;
%display grayscale volume
volshow(vol,Colormap=colormap)
I hope this is your expectation. Let me know if you need something more!
Please refer to the below example, which illustrates the usage of 'volshow' funtion with 'Colormap' argument.
openExample('images/VisualizeVolumeOfMRIDataExample')

Más respuestas (0)

Categorías

Más información sobre Color and Styling en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by