phi-max / skeleton3d-matlab

MATLAB code to calculate the 3D skeleton of a binary volume using parallel medial axis thinning
BSD 2-Clause "Simplified" License
43 stars 17 forks source link

about the second argument mask #8

Closed rmd13 closed 3 years ago

rmd13 commented 4 years ago

Hi, I am a little bit confused about the second argument mask: It seems that mask is another layer of binary operation. If so, does the three commands below are equivalent?

skel = Skeleton3D(bin,mask)

skel = Skeleton3D(bin) .* mask

skel = Skeleton3D(bin.*mask)

Thanks

phi-max commented 4 years ago

Hi, the second argument is a mask of voxels that are to be spared, i.e. will not be removed. They are still included in the neighbourhood checking, so the results of all three commands will be different: 1) use "mask" to mark voxels to be excluded, but use them for checking 2) compute skeleton, then apply "mask" to skeleton 3) apply "mask" to original data, then skeletonize masked data

We used the second argument e.g. to mark cell bodies vs. cell processes - with variants 2) and 3), the result would be incorrect.

rmd13 commented 4 years ago

Hi, If so, then Skeleton3D(bin,mask) is same with Skeleton3D(bin) + mask? Is there a demo for the 2nd argument? Thanks

rmd13 commented 4 years ago

Suppose bin is a shape of oval, mask is also a oval, and they overlap. The region can be named as: A: bin-specific binary volume B: bin and mask shared binary volume C: mask specific volume.

Then Skeleton3D(bin,mask) will generate a structure that with A thinned to a thread, but B and C remains the same?

phi-max commented 4 years ago

Yes, that should be the case - A gets thinned, but B not because it is not masked. C is not processed at all since it is only in the mask argument. Regarding the previous question, the second case is different, since the result of the skeletonization may differ in the voxels directly neighbouring the mask (the mask is not thinned, which may affect the neighbourhood queries in later iterations.)