how to form the volume from the single dicom image using isosurface in matlab
Mostrar comentarios más antiguos
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;
Respuestas (2)
Walter Roberson
el 30 de Nov. de 2016
Editada: Walter Roberson
el 30 de Nov. de 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 comentarios
andhavarapu lokesh
el 30 de Nov. de 2016
Walter Roberson
el 30 de Nov. de 2016
What is the error message?
andhavarapu lokesh
el 30 de Nov. de 2016
Editada: Walter Roberson
el 1 de Dic. de 2016
Walter Roberson
el 30 de Nov. de 2016
The volume formula I posted computes the number of occupied voxels directly. The answer is a vector of volumes, one for each file. It is not not something to run isosurface on, and it does not use any of the isosurface representation to calculate the volume (and does not care whether you have drawn the isosurface)
andhavarapu lokesh
el 30 de Nov. de 2016
Walter Roberson
el 30 de Nov. de 2016
Volume rendering is the process of creating a graphic display from a multidimensional data set. That might include lighting and transparency considerations. It is about making something look nice.
"getting the volume" refers to calculation the amount of space occupied by a 3 or more dimensional data set. For example if you wanted to calculate the relative size of a tumor to a heart then you would want to calculate the volume. It is a numeric calculation.
andhavarapu lokesh
el 1 de Dic. de 2016
Editada: Walter Roberson
el 1 de Dic. de 2016
Walter Roberson
el 1 de Dic. de 2016
for p = 1 : y
fig = figure();
ax = axes('Parent', fig);
v = squeeze(X(:,:,:,:,p));
hiso = patch( isosurface( v, isoval), ...
'Parent', ax, 'FaceAlpha', 0.74, ...
'FaceColor', [1,0.75,0.65],' EdgeColor', 'none', ');
lighting(ax, 'phong');
lightangle(ax, 45, 30);
rotate3d(ax, 'on');
title( sprintf('p = %d', p) )
end
andhavarapu lokesh
el 1 de Dic. de 2016
Editada: Walter Roberson
el 1 de Dic. de 2016
Walter Roberson
el 1 de Dic. de 2016
You still need
isoval=0.5;
before the "for p" loop.
andhavarapu lokesh
el 1 de Dic. de 2016
Editada: Walter Roberson
el 1 de Dic. de 2016
Walter Roberson
el 1 de Dic. de 2016
Which MATLAB version are you using?
andhavarapu lokesh
el 1 de Dic. de 2016
Walter Roberson
el 1 de Dic. de 2016
There definitely is an EdgeColor property for patch
https://www.mathworks.com/help/releases/R2015a/matlab/ref/patch-properties.html
andhavarapu lokesh
el 1 de Dic. de 2016
Editada: andhavarapu lokesh
el 1 de Dic. de 2016
0 votos
Categorías
Más información sobre Image Processing Toolbox en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!