RelateObjects in Java

@aklemm @haesleinhuepf @imagejan @dlegland @simonfn

I am sorry if this has been asked before (I feel it almost must have been)…

Is there an equivalent to CellProfiler’s RelateObjects in Java?

I already asked here:

…but then I thought it is better to (also) as here in the forum.

4 Likes

Hey @Christian_Tischer,

in clij, there is generateBinaryOverlapMatrix which allows you to inspect relationships between label maps. If you tell us in more detail what you want to measure, I tell you how to derive this measurement from a binary-overlap-matrix :wink:

Cheers,
Robert

4 Likes

Hi @Christian_Tischer,

I agree that object-based aggregate statistics are very important in many biological analyses.

From the linked GitHub issue:

I’ve been doing this with KNIME a lot, I hope to be able to extract a small example workflow within the next days and post it here.

In general, I’d split the problem in two parts:

  • Getting the overlap information of which child object belongs to which parent object:

    • I guess that’s what CLIJ’s generateBinaryOverlapMatrix (suggested by @haesleinhuepf) is doing.
    • In ImgLib2 (specifically imglib2-roi) you now have an OverlappingLabels class (contributed by yours truly) that allows to get a co-occurrence matrix (i.e. overlap matrix) for any ImgLabeling (that by default allows for multiple labels per pixels, and therefore any number of overlap between objects), including the amount of overlap between partially overlapping objects (probably more than you need, depending on your use case).
  • Aggregating the statistics of children while grouping per parent object:

    • Aggregating statistics is not one of ImageJ’s strengths. While you certainly can do it, there are other frameworks such as R that allow achieving this more easily and/or more flexibly.

Because of these points, I actually like to use a data science framework such as #knime (and in particular KNIME Image Processing) because it provides both excellent handling of segmentations/label images (built on ImgLib2) as well as all the data handling tools (grouping, aggrgating, filtering, etc.) that a data scientist needs.

4 Likes

There is the Speckle Inspector of the @biovoxxel toolbox: https://imagej.net/BioVoxxel_Toolbox.html - which does summary statistics.

5 Likes

Hi @Christian_Tischer,

Yes this question was asked before by you, I think, during my NEUBIAS webinar on 3D Analysis with 3D ImageJ Suite.

My approach is to get the id of the parent for each child object :

  1. Object-based co-localisation, with the 3D MultiColoc plugin for instance.
  2. Quantification based approach using child as object image and parent as intensity image (intensity will be parent’s id) with the 3D intensity measure plugin.
  3. Qualitative relationship between objects with the 3D mereo-topology plugin.

Best,

Thomas

4 Likes

Pass. Not a Java person :upside_down_face:

1 Like

Dear @Christian_Tischer and all others,

Limitation of the Speckle inspector though is that it works 2D only.

I am happy to contribute in any way or change the code to make it better accessible from Java.
I think an implementation in 3D could mainly profit from using the 3D Suite library from @ThomasBoudier. On the other hand directly implementing this for Ops or generally for IJ2 makes obviously sense, where my coding abilities are quite limited still. In any case I am happy to add my 2 cents.

1 Like

I feel most answers tend towards a solution where such kind of aggregate statistics are better done in R than in Java. Thus, I think I would personally not push this further at the minute, but feel free to go ahead, I think it would be used, and for sure super nice for teaching courses :rocket:

1 Like

Hi All,

We realised that we need the RelateObjects functionality in Java, so I had to implement something. For me it is working now, but I thought for future reference a PR against MorphoLibJ is a good way to keep this in mind:

Here is a link to the class:

I am happy for any feedback and would love to see this merged in MLJ (and any other ImageJ plugin that uses ResultsTables) at some point.

cc @Alex_H

1 Like