Depth color coding using Volumeviewer/ Volshow
조회 수: 15 (최근 30일)
이전 댓글 표시
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
채택된 답변
Gayathri
2025년 6월 3일
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')
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Color and Styling에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!