Load & convert objects - images


#1

I’ve been using CP to perform object ID based on staining of cells. As an output of this pipeline I have the objects converted to RGB images where each color corresponds to an object class. Once a stack of theses is finished I like to go through them and correct any false positives in photoshop. (please see attached image)
Once the images are corrected, I’d like to re-process them with CP to map them out in XYZ as well as other measurements like size etc. If I load the image as objects - it is able to ID the objects but clumps all three classes into one. It seems the only way to do this would be to load them as images - split the RGB image, then re-identify the objects from scratch either using Apply Threshold + binary or straight into ID primary objects with manual .1 or something - This is rather inefficient though as the channels are essentially binary and reprocessing a stack can take many hours on a high performance machine due to the very high resolution of the images.

Is there a better way to do this? It seems surprising to me there isn’t a “convert image to objects” module I can use after splitting the RGB image. I’m not complaining by a stretch as CP is already an amazing software that is extremely useful for my work but I had to assume there’s something wrong with my perception or knowledge of CP before accepting this isn’t possible…

either way, many many thanks for producing a fantastic piece of software and your continued development and support!!!



#2

Hi,

Yes, if I understand correctly, it should be straightforward to use ApplyThreshold, after LoadImages and ColorToGray/Split. In ApplyThreshold, use the Manual method with a threshold of 0.5, and this should be the fastest method available. In fact, segmentation methods like Identify* or ApplyThreshold are exactly “ConvertImageToObjects” algorithms, just with a different name, so you are correct in your intuition.

Of course, if you could reduce/eliminate the false positives with your original pipeline, then your whole procedure obviously would be markedly more efficient. Feel free to post that pipeline and an example troublesome image and we can perhaps help with that.

Cheers,
David


#3

Thanks for the quick reply.
unfortunately I have already put in quite a bit of work to optimize the pipeline. The signal consists of GFP or RFP and unfortunately in some cases just isn’t very strong. I already try to compensate by imaging secondary channels that I subtract to compensate for autofluorescence and do some fancy DAPI cell density (threshold -> Morph -> Morph -> ID primary with size restrictions to identify the correct layer and mask the image to limit the potential sources of false positives - unfortunately some get through. I guess I could be more stringent but then I’d get more false negatives - a difficult balance. Soon I will be switching to ISH rather than GFP for the signal so hopefully some amplification will help alleviate these problems, I’ll be posting here for more help otherwise!

Regarding the Apply Threshold -> ID primary via binary, unfortunately this isn’t 1/10th as quick as loading the image as objects. even with binary images, ID primary takes 78seconds per channel, if I had the images split and loaded them as objects right away - this is less than 5 seconds. I have the ID primary set to the simplest possible settings the input image is the channel I had originally split off, discard objects, try to merge, fill holes is all turned off. Thresholding method is binary, and it still takes >70 sec.

Thanks!


#4

Wow, that is slow. Your images must be big, and/or you must be using a 32-bit machine.

In any case, let me just make sure I understand. (BTW - it is much easier for me to help if you post your pipeline early, otherwise we’re often left guessing your intent)

  • By what method/module did you define each channel? Separate IDPrimary modules, or are you doing this or any other processing in Photoshop?
  • Have you tried:
    (1) Saving each object class as a separate grayscale label matrix image (I suggest using PNGs to minimize the file size) using SaveImages’ “Select the type of image to save” = Objects. i.e. not a composite RGB like you posted originally
    (2) In your 2nd pipeline, LoadImages -> “Load the input as Images or Objects” = Objects. One channel per label matrix.

This ought to be much faster than loading and ID’ing again.

David


#5

Hey was there ever anything that was done about this? I am currently trying to do an object resize, from 2048x2048 to 1024x1024, while still being able to gather data for an export to spreadsheet module for both objects (i need to ensure the same amount of objects are in both 2048x2048 and 1024x1024)

You can see what i’ve done up in my module, from lines 17-22.

Thank you.

170227.2048 image. 1024 dapi gfp tritc end.cpproj (1.6 MB)


#6

Can you explain your use case or your problem a little more? I’m seeing where you’re doing Convert Objects to Image ->Resize->SaveImages on your ROI object, but can you explain the problem that you’re having after that?


#7

I would like to load the new 1024x1024 image back into the pipeline as objects. Will i need to run a new pipeline in order to do that?

thanks, lee


#8

If you need to absolutely ensure 1:1 correspondence on the number of objects then yes, you’ll have to split your pipeline at this point so that you can reload this image as objects. There’s no way to add new images into a pipeline halfway through.


#9

Great. Thanks for clarifying. Wasn’t sure if i missed a module.