Retrieving objects from ImageJ (reverse of ConvertObjectsToImage)

Dear all,
I’ve got an ImageJ plugin that does a further segmentation of objects. The operation is morphological only - gery vaklues are irrelevant.
ImageJ receives an image from ConvertObjectsToImage, where the pixel value corresponds to object number. Now, the returned image also has its values set to object numbers and I need to convert it to objects. That is, the exact reverse of ConvertObjectsToImage.
I’ve been playing with IdentifyPrimary objects but cannot find a way to do this: all segmentation strategies I’ve tried fail to retrieve the exact objects.
Any help will be appreciated.

Allow me to ask a clarification- are you doing this with the RunImageJ module to try to do the whole thing in a single pipeline? I’m guessing yes, and the advice is therefore based on that- apologies if I’m incorrect.

Without knowing more details about what exactly you’re trying to do and how exactly it’s failing, here’s an idea- however it will only work if your ImageJ manipulation returns the same number or fewer number of objects (and if they roughly spatially correspond with the originals)- it won’t work for example if you were trying to split the objects into multiple pieces or rotate it 180 degrees.

-Use ExpandOrShrinkObjects to shrink your original objects down to single pixel seeds
-If your ImageJ operation gets rid of some of the original objects, use MaskObjects to keep only the seeds that correspond to some new object
-Use IdentifySecondaryObjects on the seeds and your ImageJ image to try to get the correct borders returned

Other ideas would be to use IdentifyPrimary to get the closest-but-not-perfect segmentation and then something like MaskObjects with your ImageJ image thresholded to try to clarify some borders, to try to raise your image to an exponent in ImageMath if it’s having a difficult time declumping the objects based on intensity after the fact- it’s hard to know exactly what to suggest without knowing the exact problem. Feel free to provide a pipeline and some images, along with what you think it’s not doing correctly, and I may be able to help you troubleshoot it further.

If all of the above fails, the last resort would be not to use a single pipeline, and to just break your pipeline in half at that point- save your ImageJ output and then load it into a new pipeline with NamesAndTypes set to Objects. I believe this is very likely to work.

Finally, FWIW, RunImageJ is only partially functional in CP 2.2 and 2.3 and officially doesn’t exist in CP 2.4 and on, so you may want to try to figure out how to do your operation within CP itself.

Hi Beth,
Thanks very much.
I’m trying to segment heavily clumped nuclei, such as:

And the objects I’ve initially identified are:

None of those things will work well, because the algorithm I’m running splits objects (nuclei) morphologically (concavity), so I’ll end up with more objects than the seeds that I put in IdentifySecondaryObjects.
As you say, saving and reloading in a second project works, and I’ll probably do that.
Incidentally, why is RunImageJ being removed?
Thanks very much for your help

It was apparently a huge hassle to maintain compatibility- see here for more details.

Is it possible to use the “Objects” option in “Select the image type” in NamesAndTypes when loading the images of interest, so they are recognized as objects?

Yup! Great minds think alike.

1 Like

Ah, absent minds skim prior posts :smiley:

And lazy minds would prefer to run one pipeline only… :slight_smile:
Yes, that’d solve the problem. I just posted wondering if there was a module to do that with images created within the pipeline. But I guess it’d only be useful for RunImageJ which, as Beth says, will be discontinued.
Thanks anyway

No problem. If you want to explain in more detail what exact ImageJ functions you’re using, and maybe an input image set or two (having the ImageJ output wouldn’t hurt) and your pipeline, we might be able to help you figure out a one-pipeline way to do things; even if not , we can make a request for the functionality to be added to CP if it seems like it’s something that’ll be broadly useful.