seung-lab / connected-components-3d

Connected components on discrete and continuous multilabel 3D & 2D images. Handles 26, 18, and 6 connected variants; periodic boundaries (4, 8, & 6)
GNU Lesser General Public License v3.0
374 stars 43 forks source link

Adjacent Connected Domains #132

Open liweizhong666 opened 1 month ago

liweizhong666 commented 1 month ago

How Do I Obtain Information About Adjacent Connected Domains?

william-silversmith commented 1 month ago

Hi! I'm not sure what information you are looking for exactly, but take a look at cc3d.contacts for measurements of contact surface area between adjacent regions.

# Compute the contact surface area between all labels.
# Only face contacts are counted as edges and corners
# have zero area. To get a simple count of all contacting
# voxels, set `surface_area=False`. 
# { (1,2): 16 } aka { (label_1, label_2): contact surface area }
surface_per_contact = cc3d.contacts(
  labels_out, connectivity=connectivity,
  surface_area=True, anisotropy=(4,4,40)
)