Matlab 3D 体积可视化 - dicom 文件 [英] Matlab 3D Volume visualization - dicom file
问题描述
我期待将 3D 矩阵从 dicom 文件可视化到 matlab 中.由于我对 matlab 不太熟悉,我设法从 这篇文章中获得帮助:
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:
不同之处在于我的矩阵不是由 1 和 0 组成,而是由负数组成,这些负数用 imshow(dicomeread(dicomFile))
The difference is that my matrix is not made of 1 and 0 but negative numbers that are correctly red with imshow(dicomeread(dicomFile))
如何获得相同的对比度但使用 3D 渲染?
How can I get to the same contrast but with a 3D rendering ?
我的代码:
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])
感谢您的帮助.
推荐答案
解决问题的两个选项:
天真,你为什么不设置
v=v+min(v(:))
这样图像将从零缩放到不同的最大值?
Naively, why won't you just set
v=v+min(v(:))
so the image will scale from zero to a different maximum value?
为什么带有负等值的 isosurface(V,isovalue)
不能为您解决这个问题?或者,如果您想循环 (-n:step_size:m) 中的 isovalues 以获得您想要的动态范围(使用一些 alpha(0.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)
这篇关于Matlab 3D 体积可视化 - dicom 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!