我期待将 3D 矩阵从 dicom 文件可视化到 matlab 中。由于我对matlab不太熟悉,因此我设法从这篇文章中获得了帮助:
不同之处在于我的矩阵不是由 1 和 0 组成,而是由正确红色的负数组成imshow(dicomeread(dicomFile))
如何获得相同的对比度但使用 3D 渲染?
我的代码:
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])
谢谢您的帮助。