From: Troy on 7 Jul 2010 16:01 "W. Dale Hall" <wdunderscorehallatpacbelldotnet(a)last> wrote in message <VuWdnWUuevd6rOfXnZ2dnUVZ_gydnZ2d(a)giganews.com>... > Jonas wrote: > > I have a list of coordinates (~50) that lie on a closed surface. I > > would like to have a list of all the pixels that are inside this > > surface. I can create a reasonable approximation to the surface using > > convhulln.m, but there does not seem to be a 3D version of poly2mask. > > Is there a function I have been overlooking? > > If you can form a list of the supporting hyperplanes (that is, the > planar surfaces that form the boundary of the convex hull), then > you can. Suppose each of these planes is of the form > > V'x = k > > where x denotes a point in R^3, V the normal vector pointing > towards the half-space containing your data, and k the common value > of V'x along the plane. > > Let W = [V_1 V_2 ... V_n] be the concatenation of all the V's > describing the supporting hyperplanes, and K = [k_1; k_2; ... k_n] > a vector containing all the k's. Then your masking function is > > all(W'x >= K) > > or > > all(W'x - K >= 0) > > for a single point x, and for a list X = [x_1 ... x_N] of points, > it's > > all( bsxfun(@minus, W'X ,K) >= 0) > > You'll get an array of size 1 x N containing ones for the points > within the volume, and zeros for those points not in it. > > Replace >= by > for the points strictly in the interior. > > BTW, I'm not sure how to get that list of hyperplanes from the > output of convhulln.m, so I'll go check on that. > > Dale I am attempting to create a logical mask as well, but I do not fully understand the process you outlined above. I have the following matrices at my disposal: the hull faces (connectivity matrix), the co-ordinates of the hull vertices, the co-ordinates of the centroid of each triangle, and the normal vectors (located at the centroid of each triangle). My main problem is that I do not understand the apostrophe notation that you used above (examples: V'x and W'x). Can you please explain what this notation means? MATLAB does not recognize it. Lastly, 'V' is an N-by-3 matrix for N normal vectors and 'x' is an M-by-3 sized matrix for M points of interest, correct? Thank you for your help!
From: Matt J on 7 Jul 2010 16:15 "Troy " <meal0016(a)umn.edu> wrote in message <i12me6$q02$1(a)fred.mathworks.com>... > I am attempting to create a logical mask as well, but I do not fully understand the process you outlined above. I have the following matrices at my disposal: the hull faces (connectivity matrix), the co-ordinates of the hull vertices, the co-ordinates of the centroid of each triangle, and the normal vectors (located at the centroid of each triangle). ============ All you need are the hull vertices to implement the solution in Message #4. vert2con will give you equations representing the hull A*x<=b You can use these equations to populate your logical mask
From: Troy on 7 Jul 2010 17:03 "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <i12n8r$k9l$1(a)fred.mathworks.com>... > "Troy " <meal0016(a)umn.edu> wrote in message <i12me6$q02$1(a)fred.mathworks.com>... > > > I am attempting to create a logical mask as well, but I do not fully understand the process you outlined above. I have the following matrices at my disposal: the hull faces (connectivity matrix), the co-ordinates of the hull vertices, the co-ordinates of the centroid of each triangle, and the normal vectors (located at the centroid of each triangle). > ============ > > All you need are the hull vertices to implement the solution in Message #4. > > vert2con will give you equations representing the hull > > A*x<=b > > You can use these equations to populate your logical mask I'm sorry - I misspoke when I described my volume as a convex hull. The volume to be masked is a model of an artery in the shape of an 'L' with closed ends. I am afraid vert2con will connect the two ends of the model and output equations for a convex hull with a shape similar to a 30-60-90 triangle (sort of like 'L\'). I know how to create a mask using the DelaunayTri class. However, as I described above, many of the vertices are incorrectly connected. This is because the hull functions create faces from the outermost points, whereas my volume requires specific connections (given by the 'faces' matrix that I described earlier). I felt that the solution in message #4 would allow me to define a more specific and appropriate mask, but I don't understand the apostrophe notation that was being used. Any help would be appreciated!
From: Matt J on 7 Jul 2010 17:30 "Troy " <meal0016(a)umn.edu> wrote in message <i12q2o$m8s$1(a)fred.mathworks.com>... > I felt that the solution in message #4 would allow me to define a more specific and appropriate mask, but I don't understand the apostrophe notation that was being used. ===== I think you mean Message #2. The apostrophe notation V'x in message #2 is V'*x, i.e., the dot product of the normal vector V to one of the face with a vector x. Message #4 proposes the same solution as in Message #2 with the only difference being that vert2con would do much of the work in setting up the equations. All of this is moot for you, however, because all of the techniques proposed in this thread are applicable only for a convex hull.
|
Pages: 1 Prev: Reassign values Next: Wha's up w/ field width in parsing input??? |