Quantification of a signal and excluding areas?


I search for a method to quantify Fibrosis in heart tissue.The method I found quite useful is: RGB-Stack → Adjust → Threshold

The only problem is that:

Changing the lower threshold doesn’t change the results, I wonder why…(?). It should represent the whole area, which should change if there are black areas for example. I therefore need a method to exclude bl13452 3.tif (5.4 MB) ack areas (which are due to the tissue ripping apart)

If anyone has a guide how to do the quantification differently, I would really appreciate that … It would be also quite helpful to find a method to exclude black areas in the images :slight_smile:

Here the Image:

  • red is the signal of the fibrosis
  • green is just tissue
  • blue can be ignored

I see two shades of red: one is brighter than the other.
Not being a biologist, I opted for the bright red color.
It gives me this:

Can this be correct for your requirements?

1 Like

Hello Mathew!

that might be, I would probably analyze both shades. The bigger problem is that there are black areas which should be excluded.

My goal is to quantify fibrosis through the calculation:

Fibrosis = red signal/ whole area

The whole area is mostly tissue. The black areas in the picture is just due to ripping of the tissue, therefore it should be excluded from the analysis. Unfortunetly I don’t know how to exclude this area via imagej/FIJI. I am happy for any suggestion :slight_smile:

Black areas should generally not be a problem in analyzing fluorescent images, since each channel is independent.

Assuming you do not have significant background problems, it should be fairly straightforward to use the red mono channel and do a single channel threshold. It sounds like you are trying to do that with the stack.

If you do not have the original image (mono-channel of the red signal), then the red channel may be the best you can do.


If you are manually adjusting the threshold, you cannot have “calculate for each image” checked when you “Apply” or else you are overwriting your manual adjustments. If you Split the stack so you only have the R of the RGB 3 channel image, you no longer have this issue since FIJI does not need to know how to handle your threshold for the green and blue channels.
This will go straight back to the first value shown when the threshold dialog box was opened.

1 Like

I’ll drop you off here where I left off.
If that helps …

macro " Fibrosis"

//Copy and select
run("Duplicate...", "title=1 ");
// Start processing

setMinAndMax(10, 45);
run("Duplicate...", "title=2");
run("RGB to CMYK");
run("Stack to Images");
setAutoThreshold("Shanbhag dark");
run("Convert to Mask");

run("Set Measurements...", "area area_fraction limit display redirect=None decimal=3");
run("Analyze Particles...", "display summarize add");

// End of processing

roiManager("Set Color", "yellow");
roiManager("Set Line Width", 1);
roiManager("Show All without labels");
exit("All is done !");}


Wow thanks Mathew!

Can you perhaps explain how you use that? I entered the text in: Macros → Start-Up-Macros → entered the code

I get these notifications:

3 4

In the end, unfortunately, I don’t see the Macro called fibrosis, did I miss any step?

Hello MicroscopyRA!

So you think that the way I did it is a valid method?

I don’t know what you mean by original image? I have the images in multicolor format. I can get the monochanel of the red signal by RGB-Stack → Threshold right? It automatically recognizes the red signal.

I don’t see the option “calculate threshold for each image” as I don’t do do “Convert Stack to Binary” - Do I have to do that?

Sorry I am quite confused…

I assumed you were working with the result of RGB->stack which is a 3 color stack of images. When you use Adjust->Threshold on that stack and hit Apply, you get a popup, which, if you do not pay attention to the settings, will revert the manually selected threshold to the automatic threshold.

Macros → Start-Up-Macros is something different that I am not familiar with, but generally when creating a macro I think you go through Plugins>New>Macro

Macros can be in several different languages, so you may need to ensure the correct language is selected for processing in the Language menu. Regardless, I was not able to get the macro to work due to other lines later in the script.

Your description was a little bit unclear to me, but reading it again it sounds like you want to threshold Green for total area, then Red for fibrosis area, and subtract the two? I am a bit more familiar with Qupath, but that should be relatively straightforward after you split the stack. Threshold the green and red images independently, then either subtract or divide the area sums.
Sum of red areas/sum of green areas = some percentage.

1 Like

Thank you for you answer again.

Sorry for being unclear, I want to measure percentage of the red signal in the tissue. The tissue is the red, green and blue signal, so everything besides the black areas.

I couldn’t install the macro either, because I can’t update to more than the version 1.53c… There are no more updates shown.

Dear Mathew,

I installed ImageJ again and managed to install your macro.

In the end I get an area fraction of about 1-2% which seems a bit low for that picture. With the eye I would estimate an area of at least 10%…

Dear MicroscopyRA,

When I am adjusting the threshold I click on “Set” rather on “Apply”, therefore I didn’t get the window that you mentioned.

1 Like

Regarding the script - you may need to change the threshold, @Mathew mentioned that their threshold was a first guess. That is up to you, use what you want. I was a little nervous about the conversion to CMYK since that seems a bit weird for a fluorescent image. I prefer to keep things in the IF space, but as long as it works for your project.

I think as long as you have one ROI area for the Red image (possibly off of a duplicate image) and one merged ROI for the other three images, you should get two area values that you can use for your experimental goals. The command OR in the ROI manager or
might work for this?

1 Like

I get around 1-2% again, so it is not right :frowning:

macro " Fibrosis"

//Copy and select
run(“Duplicate…”, “title=1 “);
// Start processing

setMinAndMax(10, 45);
run(“Duplicate…”, “title=2”);
run(“RGB to CMYK”);
run(“Stack to Images”);
setAutoThreshold(“Shanbhag dark”);
run(“Convert to Mask”);

run(“Set Measurements…”, “area area_fraction limit display redirect=None decimal=3”);
run(“Analyze Particles…”, “display summarize add”);

// End of processing

roiManager(“Set Color”, “yellow”);
roiManager(“Set Line Width”, 1);
exit(“All is done !”);}

I hope that’s right?

No, I was discussing a completely different analysis method, treating the images a independent IF channels. It would not work for the CMYK conversion - for that you would need to change the threshold or perform some other processing.

oh ok I will try that out :slight_smile:

1 Like

Hey both of you… Sorry but, Unfortunately, I have not yet made sufficient progress.

So for the ROI area I don’t get why I should do that. I think RGB stack +threshold is good enough to measure area fraction of the red signal. I just need a method to substract black areas from the whole area. I hope you can explain me that :frowning:

Did I do everything right?

After reflection, I agree with the position of @Research_Associate. The use of Brightness and Contrast is not necessary (and annoying), if one does not want to use CMYK. The use of

run("Enhance Local Contrast", "blocksize=127 histogram=256 maximum=6");
run("Duplicate...", "title=3");
run("RGB Stack");
run("Stack to Images");
setAutoThreshold("MaxEntropy dark");
//setThreshold(109, 255);

is much simpler.
The quantified result is about 1.6% (similar to the previous result). As for the tears (tissue ripping apart ), … I do not succeed …

Okay thank you both a lot for your help!!