DanielPlayne / playne-equivalence-algorithm

MIT License
20 stars 2 forks source link

Connectivity on neighborhood #1

Open andmax opened 4 years ago

andmax commented 4 years ago

Hi Daniel,

How your algorithm handles connectivity on the neighborhood? In 3D, the connectivity = 6 means direct neighbors only, like the structure appearing in scipy label example: https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.label.html In file playne_equivalence_direct_3D_clamp.cu, looking at your init_label() it seems 6 but looking at your label_reduction() it seems 18. Do you have support for different connectivities (like scipy label structure) in your algorithm?

Thanks, Andre.

DanielPlayne commented 4 years ago

Hi Andre,

The implementations in this repository are just using 6-connected neighbours. For the playne_equivalence implementations the label_reduction() kernel accesses pixels (x-1, y-1, z), (x-1, y, z-1) and (x, y-1, z-1) to identify cases where the reduction will be redundant to avoid unnecessary computation.

These implementations don't support other connectivities (18/26 etc), I have written an 8-connected version for 2D and experimented with other connectivities in 3D but don't have anything released.

The general approach for the algorithm remains the same and just requires the identification of whether nearest neighbours are connected through next-nearest neighbours (with a lesser label).

Thanks

andmax commented 4 years ago

Ok Daniel, thank you! I've read your paper but did not understand what you just explained.

Is it just a matter of adding more neighbour connections in your init_labels() ? Or do I need to also change the comparisons in label_reduction() ? You mention in your answer that the reduction is to avoid unnecessary computation, so I'm wondering if I can achieve 18- or 26-connected neighbours with your algorithm with just the init labeling.

Best, Andre.