索引数据的Matlab的3D图索引、数据、Matlab

2023-09-08 10:52:40 作者:回不去的苍白

我想绘制一个非常大的数据集的CT的三维视图。我的数据是在2000x2000x1000尺寸的三维基质。该目的是通过空气,其设置为NaN在我的基质包围。

I am trying to plot a 3d view of a very large CT dataset. My data is in a 3d matrix of 2000x2000x1000 dimension. The object is surrounded by air, which is set to NaN in my matrix.

我希望能够看到该对象(无等值面)的表面的灰度值,但我不能完全解决如何做,在Matlab的。任何人都可以帮助我吗?

I would like to be able to see the greyscale value of the surface of the object (no isosurface) but I cannot quite work out how to do that in Matlab. Can anyone help me please?

考虑到我一个处理一个巨大的矩阵,我感兴趣的只是物体的表面,没有人知道一个良好的把戏如何减少我的数据集的大小?

Given that I a dealing with a huge matrix and I am only interested in the surface of the object, does anyone know a good trick how to reduce the size of my dataset?

推荐答案

我设法得到它的工作:

function [X,Y,Z,C] = extract_surface(file_name,slice_number,voxel_size)
LT          = imread(file_name);%..READ THE 2D MAP
BW          = im2bw(LT,1);%..THRESHOLD TO BINARY
B           = bwboundaries(BW,8,'noholes');%..FIND THE OUTLINE OF THE IMAGE
X           = B{1}(:,1);%..EXTRACT X AND Y COORDINATES
Y           = B{1}(:,2);
indices     = sub2ind(size(LT),X,Y);%..FIND THE CORRESPONDING LINEAR INDICES
C           = LT(indices);%..NOW READ THE VALUES AT THE OUTLINE POSITION
Z           = ones(size(X))*slice_number;

我就可以绘制这个以

I can then plot this with

figure
scatter3(X,Y,Z,2,C)

现在我唯一可以改善是有所有这些问题,在散点图与表面相连。 @upperBound你的建议 delaunay3 为了这个目的 - 我不能完全弄清楚如何做到这一点。你有一个提示?

Now the only thing I could improve is to have all these points in the scatter plot connected with a surface. @upperBound you suggested delaunay3 for this purpose - I cannot quite figure out how to do this. Do you have a tip?