Assessing DNA Damage within each Nuclei

I’m using a 2-stack image where the FITC stain within each nucleus corresponds to the amount of damage within that nucleus. I have tried entering a published code for the macro (see pdf file after references), but the language is confusing and though I’m almost there, I’m still far away. Essentially, the point of the code is to outline each individual nuclei and then attain the area of the FITC stain within each individual nucleus and record in a table. Maybe there is a plugin to do this and I’m doing it the hard way, I just don’t know. Please help if you know how to do this. After having to upload the images as .TIFF, I’m not sure this will work for anyone to try in FIJI. Thank you in advance.

advpub_0609010004.pdf - Code is after the references
New Text Document (2).txt - Where I’m at with the code from the publication above

advpub_0609010004.pdf (902.3 KB)
New Text Document (2).txt (2.5 KB)
ChS1.tif (1.0 MB) Ch2.tif (1.0 MB)

Hi @sjr07130,

can you tell us what’s not working? I guess you entered your TIF file name in the macro on top? Is there an error message showing up when you execute the macro?


No, I could not upload the .lsm file, this program doesn’t recognize that file name and won’t allow me to upload. Essentially what happens is that I can get the first half complete where we get an outline around each individual nuclei and then it consecutively numbers each nuclei with the dapi stain. What it should then do is go to each nuclei and calculate the area of FITC stain within each of the outlines for each numbered nucleus consecutively and generate those results in a separate table. However, what happens is that it gets stuck on the first nuclei and makes all the calculations for the one generating a list of the same nucleus. I do not know how to get it to move to #2, #3, #4… to calculate the FITC, it just stays stuck on #1. I just don’t know where in the code to make this work. Does that make sense? Sorry for the .tiff file, don’t know what else to do about that.

I should say that this forum does not allow me to upload .lsm files.


The reason that the macro does not move to the next nucleus is here:

roiManager("select", 0);

This needs to be corrected to:

roiManager("select", i);



Sweet, I’ll give it whirl. Thank you.

So I did what you said, and it worked!! However, another problem was encountered. When I get the area for FITC it is somehow greater than the area of the dapi, which is obviously not true as all the FITC stain is contained within each nucleus. Any ideas? Thank you again for your assistance.


This will depend on the setting for the segmentation for the DAPI and the FITC signal.

You define the segmentation for the DAPI channel here:

run("Subtract Background...", "rolling=60");
run("Gaussian Blur...", "radius=8");
setThreshold(20, 255);
run("Threshold", "thresholded remaining black");

For the FITC channel the segmentation is defined here:

setThreshold(1180, 4095);

Depending on your images you need to define the segmentation parameters properly. The segmentation in the given macro is anyways a rather poor choice. One should avoid manual thresholding when possible:

So I deleted those lines of manual thresholding and did the command setAutoThreshold(), however then instead of generating the area of FITC within each nucleus, it generated data for the area of each foci, so it gave me 900 areas on the result page. So if I get 20 nuclei on one image (20 results for dapi), then it should come out with 20 different results for FITC that would align with the dapi. I don’t know much about segmentation if that is my issue. I think the macro tries to do an overlay of the nuclei and then generates the FITC within that nuclei. If you have any other ideas, please let me know. I did not mess with the subtract background or gaussian blur commands. Thank you again for your help, we are soooo close.


A post was split to a new topic: Outline DAPI nuclei in CellProfiler

Hi sjr07130,

you need to select an Autothresholding Method. Like so:


Of course select a thresholding method that actually does the job.

If you want to modify the methods in a macro just record the commands you use when manually using Fiji:
Plugins > Macros > Record…
Opens the Macrorecorder.
Then perfom the thresholding on your images:
Image > Adjust > Threshold…

See here for more information:

Anyways the macro you have there is weird. So I rewrote it and made it a bit cleaner. You just have to make sure your image is loaded the channels are split and renamed correctly. You can repackage this into a batch but make sure that the result table is saved with an appropriate name:
AreaFraction.txt (2.1 KB)

A word of warning! Your images are highly problematic. The FITC channel as well as the DAPI channel are clipped. Thus high intensities are just cut off. Also the offset in your microscope is too large. Good images have noise in the background. Do not attempt any intensity measurements on such images! Area measurements might be also problematic since one does not know what has been actually cut off from your images.

1 Like

@sjr07130 If you encounter this issue again in the future: you can ZIP it first—then you will be able to attach it.

1 Like

Thank you for helping me to clean that up. It did seem that there was a bunch of other fancy unnecessary things occurring in there. However, after running your cleaner version I discovered that the problem lies somewhere in the overlay. I don’t believe it has anything to do with the threshold, but I did change to a more automated one as opposed to a manual one (thank you). Earlier I was running a “set scale” command for just the FITC, which was obviously wrong. Doesn’t matter. In the end I plan on getting a percentage of area covered by FITC within each nucleus, so units shouldn’t be an issue. However, after not running any units I get the same exact values for area for both FITC and DAPI. This tells me that the code is somehow not distinguishing the differences between DAPI outline from the FITC granular area when we are running the latter half of the code. In the past I have measured FITC, but I would get total area for over 1000 different points. I can get that to happen with the code as well but the problem is that then it does not tell me the area of FITC per nucleus, it just gives me a total area and honestly that is all I could do with it. What do you think? I did try several different thresholds and in the end I was still getting the same area for FITC as I was for DAPI, which is still incorrect. If you have any additional insight or code that would help I’d greatly appreciate it. If you run it do you get the same values for FITC as with DAPI for area. Or is this an imaging problem. I didn’t quite understand all the lingo you used. I’m still fairly new to all of this. Thank you again.


I am sorry I don’t understand your problem.
In the Result table of the script I provided you see the Area of the nuclei and a %Area that is the Area of the FITC within the nucleus of the ROI.

Depending on the threshold that you use for the FITC area these percentages do change. If you change the DAPI threshold than of course the total area of the nucleus changes. But you will be interested in the area fraction.
I think the script does exactly what you want as can be seen here:

Using the default threshold

Using the Huang threshold:

You would need to send me some results, maybe there is a different problem…


Upon further review. The entire for loop is not necessary. I also made sure the actual mask is selected for the measurement explicitly and you can review the results for further checking.

AreaFraction.txt (2.1 KB)

If you want to use it in a batch just remove the // for the following lines to close the intermediate files:


Thank you, thank you, thank you!!! I was looking at the wrong measure. I was looking at the area not the %area. Then when you look at the dapi, as I also tweeked the code a little to show dapi, it reads at 100%. What you did initially was correct. Thank you for all of your assistance, now I can do this fast and easy. Thank you.


1 Like

Happy to be of help :slight_smile: