我期待着从DICOM文件可视化3D矩阵到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 ?
我的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])
感谢您的帮助。
两个选项来解决你的问题:
Two options for solving your problem:
天真,你为什么不只是设置 V = V +分(V(:))
因此图像会从零扩展到不同最大价值呢?
Naively, why won't you just set v=v+min(v(:))
so the image will scale from zero to a different maximum value?
为什么不等值面(V,等值)
负isovlaue解决这个问题的吗?
或者,如果你想遍历从(-n:STEP_SIZE:M)isovalues得到你想要的动态范围(在某些α(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)