索引数据的 Matlab 3d 图 [英] Matlab 3d plot of indexed data

查看:35
本文介绍了索引数据的 Matlab 3d 图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试绘制一个非常大的 CT 数据集的 3d 视图.我的数据位于 2000x2000x1000 尺寸的 3d 矩阵中.该对象被空气包围,在我的矩阵中设置为 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;

然后我可以用

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?

这篇关于索引数据的 Matlab 3d 图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆