Hi, I need to do some signed 3D Euclidean distance transform, and need the distance to be negative inside a closed surface. The 3D Euclidean Distance Transform for Variable Data Aspect Ratio in file exchange works well, but it only provides positive distance for all points that are not on the closed surface. Now I need to detect if a given point is inside the closed surface or not. Any hint to tell if a point is inside the closed surface? Or to signed 3D distance transform? Any help will be immensely appreciated. Erhong

1 Kommentar

Ziwei Wu
Ziwei Wu am 28 Nov. 2016
Hi Erhong, I am trying to make a 3D shape model using signed distance function but there are always some problems with my code. Would it be possible for you to share your code to me? Or just give me some hint of your idea? Thank you so much!

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Sean de Wolski
Sean de Wolski am 13 Apr. 2011

0 Stimmen

You could separately create a map of points inside a closed surface.
M = imfill(bw_image,'holes');
Now anything true in M will be inside a closed surface in bw_image.
D = your_distance_transform;
D(M) = -D(M);

3 Kommentare

Erhong
Erhong am 14 Apr. 2011
Thank you.
The imfill works fine, but how can I know a point(x,y,z) is within the map to make D(M)=-D(M)? The D is n*n*n in my case, and the M in 'D(M)' is required to be integer. Thanks again!
Sean de Wolski
Sean de Wolski am 14 Apr. 2011
M should be a logical 3-dimensional array.
Please tell me what the output from these commands is:
class(M)
size(M)
Thus D (your distance transform matrix) should be of class double and the same size as M.
Then the indexing assignment D(M) = -D(M) will work.
Erhong
Erhong am 14 Apr. 2011
Thanks so much for the hint. I replaced the M in D(M) with the corresponding cocordinates, and it works!
Thank you!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Community Treasure Hunt

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

Start Hunting!

Translated by