Easy question for you geniuses, what is wrong with my input for this matlab function?

2 ビュー (過去 30 日間)
Ok so I have done a delaunay triangulation on a 3d point cloud.
tri=delaunay(x,y,z);
and graphed it with trisurf(tri,xval,yval,zval)
which is giving me this error:
>> [k V] = convexHull(tri)
Undefined function 'convexHull' for input arguments of type 'double'.
here is my question. What am I doing wrong, and what is the tri array actually mean? It looks like a huge array of numbers. Will the volume calculation in the convexHull function work without having the x,y,z values which are measured in millimeters?
Thank you!!!

採用された回答

Sven
Sven 2012 年 7 月 9 日
編集済み: Sven 2012 年 7 月 9 日
I believe you've gotten (understandably) confused with:
delaunay()
and
DelaunayTri()
The first one does a delaunay triangulation and returns the vertices as numerical output.
The second one returns a triangulation object, from which you can do other fun stuff as specified in the DelaunayTri docs (such as convexHull).
If your only goal is to get the convex hull of your points, then you could go directly there with:
k = convhull(x,y,z);
figure, patch(struct('vertices',[x y z],'faces', k),'FaceColor','c')
However I think you're trying to get the volume of this convex hull too, so you can just do:
DT = DelaunayTri(x,y,z);
[k, vol] = DT.convexHull;
And if your original coordinates (x,y,z), are mm coordinates in space, then your vol will also be in mm^3. If your original coordinates are pixel indices of some 3D image you have, then you should either:
  1. Convert pixel indices into mm coordinates to send to DelaunayTri
  2. Calculate the volume of 1 3D "voxel". Beware, this will only make sense if your voxels are "isotropic".
  2 件のコメント
Sean de Wolski
Sean de Wolski 2012 年 7 月 9 日
Fun stuff indeed!
Daniel Sufficool
Daniel Sufficool 2012 年 7 月 9 日
Thank you so much!! You are my hero!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDelaunay Triangulation についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by