Mask overlay problem

Hi,

I am just starting to use ImageJ, so I am not really sure what to look for. If my question has been answered already, I would appreciate to point me towards it!

Here is the problem: I need to count GFP signals (green dots) in a microscopy picture.

However, it is necessary to only count signals from certain areas of the image. I do have a mask that defines the area.

We already used the Region of Interest Manager to apply those areas to the image. However, this only works manually and we need to analyse a huge amount of images.

Question: is there a macro to automate this task, e.g. by taking only the bright pixels from the mask and apply it to the image?

Hello,

What do you mean to ‘apply those areas’?

And in reply to your question. Yes there is always a macro :slight_smile: it just hasn’t been made yet, probably.

My recommendation here would be to take advantage of the Roi.contains(x,y) macro function.

So

  1. Keep the mask somewhere else
  2. Run your detection (You did not mention how you are doing this)
  3. You can get the centroid values of each point and query them and if they are inside the Mask Roi, then keep them.

Before writing a macro, you should fix your imaging setup a bit seeing as your green image is presenting some very nasty saturation, is in jpeg format and the green isn’t even really green… If you have a raw file to share using some filesharing service, I am sure that people will be willing to help out more (as long as there is no saturation)

The reason I recommend it this way is that if you start messing around with the intensities of the image (via ‘applying’ the mask) your detections might end up not looking too good.

Whereas this way, you detect everything in the same way, and just filter out what you do not need afterwards.

Best
Oli

1 Like

Hi Oli,

thanks for your reply and help.

With “apply” we just mean to select the ROIs with the wand tool on the mask image and then by clicking on the green dot image and selecting the ROIs again from the ROI manager to transfer them to it. The ROIs will then appear on the green dot image as well.
Basically, we only need the mask to give us the ROI on the green dot image to clear the outside of the ROIs so that we only count the green dots we are interested in.
The detection of the green dots is then done with the “find Maxima” function.

We will try the Roi.contains(x,y) macro function as you recommended.

I see your point in doing the detection first and the selection later. Thanks for that!

As for our images, I wanted to post some jpegs to demonstrate the problem. I didn’t expect anyone to a actually do something with it. I obviously understimated the community here :slight_smile:

Here are tifs of the images with less background:

Hi again…

Question: Why are the two images RGB? The mask should be binary and the green image should be an 8-bit or 16-bit single channel image. Are you using an RGB camera?

Now if you are doing the detection using Find Maxima there is a rather faster approach

  1. Take your mask image and create a selection from it. To do this with the image you gave me, you can
    a. Convert it to 8-bit (Image > Type > 8-bits)
    b. Set a threshold so that the red area represents where you want to measure the green dots
    c. use Edit > Selection > Create Selection
  2. Move to your green dots image and use Edit > Selection > Restore Selection
  3. Now you can run Find Maxima and it will only look for them inside the selection, which reflects the mask.

Best

1 Like

Hi,

thanks a lot, this seems to work pretty well! Let us try this a bit more and see how the counts look like in comparison to our reference.

Since you asked explicitly: Would you recommend Find Maxima or rather another function to quantify the GFP signals?

Cheers,

Bene