how to form the volume from the single dicom image using isosurface in matlab
2 views (last 30 days)
Show older comments
want to do volume rendering for the data containing dicom images . Each dicom contains again 72 frames can any one help me how to get the volume from the below code
rojectdir = 'E:\SHIVA BACKUP\THYROID\P1\newcodes\data1\13002';
% y = length(projectdir);
y=72;
X = zeros(128, 128, 1, 72, y, 'uint8');
% Read the series of images.
for p=1:1:y
thisfile = sprintf('IM_%d.dcm', p);
filename = fullfile( projectdir, thisfile );
imdata = dicomread(filename);
imsize = size(imdata);
if ~isequal( imsize, [128 128 1 72] )
fprintf('file is unexpected size %s instead of [128 128 1 72], skipping "%s"\n', mat2str(imsize), filename);
else
X(:, :, :, :, p) = imdata;
end
end
isoval=0.5;
hiso=patch(isosurface(X,isoval),...
'FaceColor',[1,0.75,0.65],'EdgeColor','none');%this is for volume display
set(hiso,'FaceAlpha',0.74);
lighting phong;
lightangle(45,30);
rotate3d on;
0 Comments
Answers (2)
Walter Roberson
on 30 Nov 2016
Edited: Walter Roberson
on 30 Nov 2016
volumes_of_objects = squeeze( sum(sum(sum(X,1),2),3) );
Note: this assumes, though, that voxels are cubic. If your distance between z slices is different than the size of the pixels in the x and y directions, then you should multiply the above by the ratio of the z slice distance compared to the x distance. Or multiply by the physical X pixel width, physical Y pixel width, and physical Z distance: you can extract those parameters from the DICOM information structure.
14 Comments
Walter Roberson
on 1 Dec 2016
There definitely is an EdgeColor property for patch
https://www.mathworks.com/help/releases/R2015a/matlab/ref/patch-properties.html
See Also
Categories
Find more on Lighting, Transparency, and Shading in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!