I am looking forward to visualize a 3D matrix into matlab from dicom files. As I am not quite familiar with matlab, i managed to get help from this post:
The difference is that my matrix is not made of 1 and 0 but negative numbers that are correctly red with imshow(dicomeread(dicomFile))
How can I get to the same contrast but with a 3D rendering ?
My code :
dicomFilesZm = dir(fullfile(myDcmFolder, 'SLZ-*.dcm')); %Get files name
dicomFilesZp = dir(fullfile(myDcmFolder, 'SLZ+*.dcm')); %~
Z = dicomFilesZm(end:-1:1); % sort
dicomFilesZ = [Z ; dicomFilesZp]; % recompose final array with files name
Iz1 = fullfile(myDcmFolder, dicomFilesZ(1).name);
v = NaN([size(dicomread(Iz1)) numel(dicomFilesZ)]); % creation of empty matrix with the good size
for i = 1 : numel(dicomFilesZ)
Iz = fullfile(myDcmFolder, dicomFilesZ(i).name);
v(:,:,i) = dicomread(Iz); % fill the matrix with each image
end
p = patch( isosurface(v,0) );
isonormals(v, p)
set(p, 'FaceColor','r', 'EdgeColor','none')
daspect([1 1 1])
Thank you for your help.