I am trying to understand how the module ComponentMeasurements in Mathematica works when the property Neighbors is called in order to find the neighbors of each component. In particular, this is asked in the context of processing particle microscopy images and using Neighbors property in order to find the neighbors of each detected particle. As an example, we can see how this function is efficiently employed in this post to find the adjacencies between particles.

As far as I've been able to explore, the documentation doesn't seem to say much on the type of criterion used to find the neighbors.

So the question in short is:

  • How does ComponentMeasurements[...,{"Neighbors"}] find the neighboring particles of each particle? In particular for the type of application of it we see in the linked post.

My guesses:

  • Given the obtained results in that post, I reckon a simple distance criterion is not used (like in random geometric graphs).
  • Instead, the descriptions in the post seem to suggest, as far as I understood, that the particles are enlarged uniformly until they come into contact (overlap) with nearby particles, and the so obtained first contacts are assigned as neighbors. So this would in fact describe an approach to find contact neighbors.
  • If the latter is the case, what method is used to enlarge the particles given that they tend to have arbitrary shapes? And are they grown as 3-dimensional objects?

Any additional explanations on how this function works for finding neighbors would very helpful.

  • 1
    $\begingroup$ Take a look at the documentation of the CornerNeighbors option. There, they explain what is considered a neighbor. Essentially, ComponentMeasurements gets a matrix where each entry is a label for a region. Regions are considered neighbors if they are directly adjacent to each other (or their corners touch, depending on the option). $\endgroup$ – Lukas Lang Aug 21 at 19:07
  • $\begingroup$ @LukasLang Thanks Lukas! I see, thanks for the link. Unfortunately this doesn't really tell us much because it reformulates the question into asking: how is the said matrix computed based on the detected regions? How is adjacent defined? in the pictures of the linked documentation, it is shown for perfect cubes where the neighbourhood is based on contact. So does that mean, even for arbitrarily shaped objects, like the ones you detected in the other post by processing the image, simply the regions overlapping (in contact) are assigned as neighbours? (are regions grown to detect contact?) $\endgroup$ – user929304 Aug 22 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.