Distance Transform in 3D
1 view (last 30 days)
Show older comments
Hello everyone!
Background:
Let us say I have 4 binary 5x5 matrices:
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
0 0 0 0 0
0 1 1 0 0
0 1 1 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 1 1 0 0
0 1 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 1 1 0 0
0 1 0 0 0
0 0 0 0 0
0 0 0 0 0
Imagine that we stack all of them on top of each other (first one is at the bottom).
The propuse of them is they explain the density of each position in a 5x5 image:
If we sum the 1's for each position, that gives us the density of that position.
For example:
- the density of the position where the bolded 1 is will be 2 (it appears in the first matrix and second matrix)
- for the underlined 1's will be 4 for all three positions (they apears in all 4 matrices)
- all of the other position's density is 1 (apears only in first matrix).
resulting in the following 5 x 5 matrix with maximum density of 4:
1 1 1 1 1
1 4 4 1 1
1 4 2 1 1
1 1 1 1 1
1 1 1 1 1
Quesiton:
If have 100 binary 512x512 matrices and I want to calculate the distance transform for each one of the 100, how can I do that?
I found the following figure online and I will use it as another example:
Imagine here that we have 11 matrices and the first one is all 1 (that's why the bottom row in the following figure is all colored).
The tail of the arrow is assigned the distance to the boundary of the object as indicated by the tip of the arrow.
Guidelines:
- All positions have a value of 1 in the first matrix.
- If a position value changed from 1 to 0, it will not change back to 1 later.
Thanks in advance.
And in case you're wondering ..
I'm trying to implement the interpolation exaplained in "Shape-Based Interpolation of Multidimensional Grey-Level Images" By George J. Grevera.
0 Comments
Answers (1)
Image Analyst
on 24 Apr 2021
The distance transform is not just the summing along the third dimension. Since you say you want to sum along the third dimension of your 512 x 512 x 100 matrix, why not simply do
image2DSum = sum(image3D, 3); % Sum along dimension #3.
1 Comment
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!