2
votes

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.

1

1 Answers

3
votes

Two options for solving your problem:

  1. Naively, why won't you just set v=v+min(v(:)) so the image will scale from zero to a different maximum value?

  2. Why won't isosurface(V,isovalue) with negative isovlaue solve this issue for you? Or if you want loop over isovalues from (-n:step_size:m) to get the dynamic range you want (with some alpha(0.2) to see the layers you want)