Home Image-Pro General Discussions

How to count objects containing a defined region of interest? (Parent/Child Batch Processing)

Hi all,

I am trying to measure a percentage of cells which have certain morphological features using ImagePro Premier 9.3. I have working macros to outline the GFP+ cells of interest and isolate the features. I defined the cells as a "parent" and the features as a "child" using the Parent/Child App but I haven't been able to get automation working in order to get a readout of the percentage of cells with features.

My question is, how can I get this workflow to be fully automated? I tried to both record a macro normally when using the parent/child app as well as messed around with the batch feature in the app itself, but nothing seemed to work. Ideally I would load up all my images and have output straight to excel as with my other macros, but if there are extra steps required that's certainly OK too. I currently run two macros to do this analysis, the first to select and count cells of interest and the second to isolate and record the features themselves. Also, if anyone has an easier solution to this issue I would be very open to suggestions.

I've attached two images, the raw unaltered starting image (raw image.tif) and the processed final image with red features on green cells (example parent child snap.tif). 

Any help would be much appreciated! Thanks!

Best Answer

  • Accepted Answer

    Spencer --

    Please see below for images that I think will lead you to a process that will do your job.

    There are probably much more sophisticated tools but I think this will work.

    In the example image you sent, without any CELL SPLITTING (manually or automatically), there were

        33 CELLS in the WITH CLASS (33 / (33+67) = 33%)
        67 CELLS in the WITHOUT CLASS (67 / (33+67) = 67%)

    This does not count any CELLS that are touching the edge of the IMAGE.

    I hope this information is helpful.

    -- Matt


    Original images on left (A and B)
    Mask images in middle (C = Mask A and D = Mask B)
    Mask image / 2 on right (E = C/2 and F = D/2)

    E and F on left
    G = E + F on right









  • Hi Spencer,

    The operations in the app are not recordable, so you should try recording a macro using operations in the application itself.
    If I understand correctly, you do get the result by running 2 macros one after another on every image. If you want to automate this procedure and use batch processing, you can create another macro manually, like this:

        Public Sub AllSteps
        End Sub

    and then set this macro (AllSteps) as the "Loop On" in the batch dialog.

  • 2017-11-02-143345

    Spencer --

    I am not sure that I understand your challenge completely and I cannot see what your PARENT / CHILD IMAGE looks like without an overlay but I believe that you are attempting to determine which RED OBJECTS contain GREEN OBJECTS.

    I believe this is an example of CO-LOCALIZATION and perhaps this is a path you can take to the results you need.

    I believe another path is via the LEARNING CLASSIFIER TOOL that is within PREMIER

    I have attempted to illustrate this TOOL with the images below.

    In the first image, I show that I took an image with 3 COOKIES of 3 TYPES that were easy to THRESHOLD from their BACKGROUND.  I took that image and duplicated it into a 3 x 3 matrix.

    In the second image, I show that the LEARNING CLASSIFIER can be TRAINED on the 3 COOKIE IMAGE and run on the 27 COOKIE IMAGE.

    The LEARNING CLASSIFIER determines which measurements CLASSIFY the COOKIES into the correct CLASS.

    In the third image, I show the DATA TABLE that results from COUNTING, MEASURING, and CLASSIFYING the 27 COOKIE IMAGE.

    You can certainly see that you could determine the TOTAL COOKIE COUNT and the PERCENTAGE of each type of cookie from this DATA TABLE.

    I have attached the original 3 COOKIE IMAGE (JPG) and the 27 COOKIE IMAGE (TIF) should you like to work through this example to learn how to set up the THRESHOLD, FILTER RANGES, and LEARNING CLASSIFIER to generate this DATA TABLE.

    I hope this information is helpful.

    -- Matt


  • Hi Yuri and Matt,

    Thank you both very much for your help. I've tried both suggestions and while I'm not quite there yet, I do think they have moved me forward. I may have been a bit unclear with my problem so before I address each of your potential fixes, let me try to reiterate what it is I'm trying to do. 

    Basically I am looking to determine the percentage of GFP cells that contain a morphological feature. This first image shows several cells one with the feature (arrowhead) and one without (in a circle).

    My current strategy to analyze the arrowhead protrusions is to isolate GFP cells, filter based on area to remove debris and count. Here is that same image initially processed:

    Finally I will mask the image and apply some morhplogical filters to isolate the protrusions themselves. After filtering to remove debris, I am left with these features selected, which I currently output as my data:

    So, this is what I've been able to do myself. As you can see, the cell that was circled initially does not have any selected area while I have selected the star. My challenge now is to output the percentage of cells that do have some sort of protrusion (as compared to those that do not). I recently discovered the parent/child feature which allows me to aquire this data one image at a time but I can't seem to get working for a batch.

    So for your suggestions; Yuri, I did combine the macros and it did work for my standard analysis. However, as you said, any actions within the parent/child app do not record, so even though I can run the single combined macro as a batch, there is no way to define the parent/child relationships. I haven't been able to figure out a way to get each image's set of parents or children to load in batch in order to do the parent/child analysis.

    Matt, I played around with the Learning Classifier and while I think it will be able to help me I haven't quite got it figured out. Again, I am trying to take one set of objects (cells) and determine what percentage of those objects contain a second set of objects (protrusions). I think that co-localization would be perfect, but I can't figure out how to get the learning classifier to work properly. I need a readout when one larger object has at least one smaller object. With the cookie example there are different types of larger objects, here it's all one type of cell and I just need to be able to measure when there are one or more smaller protrusion present. 

    I apologize if my initial post was unclear. I'm attaching several files in order to be able to replicate my workflow; the raw file again (raw_image.tif), the selected cells (cells.tif) and the isolated protrusions (protrusions.tif). I tried to also attach the filtration files to follow the workflow, but the forum wouldn't let me attach the .iqo files so please feel free to email me ([email protected]) if those are needed.

    Thanks again for all your help!

  • Spencer,

    Regarding batch processing in Parent/Child app: When you have parent and child images, you have to activate Grouping in the batch processing dialog to create image groups per experiment (Parent, child1, child2,...). You may use file names/indices for grouping or may put experiment images into different sub-folders and then group by folder. It's described in the Help PDF of the app (which is accessed from the tooltip over the app's icon). Here is the screenshot with that page (pdf attached):

  • Hi Yuri and Matt,

    Thank you both very much for all the help working through this process. Matt, your suggestion worked perfectly. I never would have thought to divide the images by two in order to add them together again, but it is exactly what I needed in order to be able to automate the entire process. I am now able to reliably in a single macro go from the starting image to a percentage of cells with and without protrusions.

    Thanks again for your help!

  • 2017-11-08-174654

    Spencer --

    Thank you for your message.

    This forum has been very helpful to me and I am glad that my suggestion was helpful to you.

    Holler when we can assist you further.

    When appropriate, include example images.

    Perhaps you will be able to help another PREMIER USER in the future.

    Thanks again.

    -- Matt

Sign In or Register to comment.