Depth color coding using Volumeviewer/ Volshow
8 ビュー (過去 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!