Sample image and/or code
(Example output first batch; mac3, ‘green’)
(Example output second batch; mac3 ‘red’)
Our general script (same is used for both, except for altered names of colors)
run("Close All");
run("Clear Results");
dir = getDirectory("Choose the Directory");
Dialog.create("red");
Dialog.addChoice("Select green", newArray("red", "blue"));
Dialog.show();
redblue = Dialog.getChoice();
list=getFileList(dir);
for (i=0; i<list.length; i++){ // for loop to parse through names in main folder
if(endsWith(list[i], "_m00.tif")){ // if the filename ends with _m00.tif file, we enter the following part:
input = dir + list[i];
input_ROI = replace(input,"_m00.tif",".zip");
print("now processing: "+input);
print("together with: "+input_ROI);
open(input);
//get image title for later use
currentTitle = getTitle();
roiManager("reset");
run("Select None");
roiManager("open", input_ROI);
roiManager("Show All");
//waitForUser("Press OK to continue","press ok to continue!");
//selecteren ROI -> area(0), hyperplasia(1), lumen(2)
roiManager("Select", 0);
run("Measure");
roiManager("Select", 1);
run("Measure");
roiManager("Select", 2);
run("Measure");
//solely ROI hyperplasia without lumen
roiManager("Select", newArray(1,2));
roiManager("XOR");
roiManager("Add");
roiManager("Select", 3);
setBackgroundColor(0, 0, 0);
run("Clear Outside");
//split the channels in the image into different windows
run("Split Channels");
//titles verduidelijken voor programma
greenTitle = currentTitle +" (green)";
//select the window with nuclear staining (green)
selectWindow(greenTitle);
//correct for background in nuclear staining (green)
run("Subtract Background...", "rolling=50");
//threshold based on the nuclear staining and convert to a binary image
setAutoThreshold("Default dark");
setOption("BlackBackground", true);
run("Convert to Mask");
//erode and dilate (for both Close- and Open) for better signal -> make smoother
run("Close-");
run("Open");
//watershed to split up nuclei that are lying against each other
run("Watershed");
run("Analyze Particles...", "size=50-500 pixel show=Overlay summarize add");
//overlay the ROIs from the nuclear channel (green) with the CD206 channel
roiManager("Combine");
// clear outside of nuclear channel (red) to make sure non-nuclei will not be measured after dilation
run("Clear Outside");
//select all ROIs and dilate in order to catch all potential CD206 signal
run("Select All");
run("Dilate");
run("Dilate");
//watershed to split up dilated ROIs that are lying against each other
run("Watershed");
//get rid of nuclei ROIs, they are already counted
roiManager("Delete");
//ROIs of potential CD206 signal
run("Analyze Particles...", "size=50-500 pixel show=Overlay summarize add");
//ROIs selecteren en overzetten op CCR2 signal
run("Select All");
if(redblue == "red"){
print("selected channel is red");
redTitle = currentTitle +" (red)";
selectWindow(redTitle);
run("Restore Selection");
//measure the signal intensity of the areas
roiManager("multi-measure measure_all append");
//get area, integrated density, area fraction and mean gray values
run("Summarize");
saveAs("Results", dir+redTitle+"_results"+i+".csv");
//saveAs("Results", dir+"results/"+imageTitle+"_results.csv");
run("Clear Results");
selectWindow(greenTitle);
close();
selectWindow(redTitle);
close();
blueTitle = currentTitle +" (blue)";
selectWindow(blueTitle);
close();
}else{
print("selected channel is blue");
blueTitle = currentTitle +" (blue)";
selectWindow(blueTitle);
run("Restore Selection");
//measure the signal intensity of the areas
roiManager("multi-measure measure_all append");
//get area, integrated density, area fraction and mean gray values
run("Summarize");
saveAs("Results", dir+blueTitle+"_results"+i+".csv");
run("Clear Results");
selectWindow(greenTitle);
close();
selectWindow(blueTitle);
close();
redTitle = currentTitle +" (red)";
selectWindow(redTitle);
close();
}
}
}
Background
In order to analyse double positive macrophages in stained murine vein grafts, we use the above script. While this script works perfectly in a context of analysis of a certain batch of images (nucleus = red, mac3 signal = green, ccr2 signal = blue), on a second batch of images (nucleus = green, mac3 signal = red, CD206 signal = blue) the results integrated density and area seem to differ by factor 10^X.
While difference can be expected between cd206 and ccr2 signal, the remaining signals should at least lie within the same amount of numbers.
Analysis goals
We are interested in obtaining the amount of double positive macrophages (either mac3/ccr2 or mac3/cd206) in two separate batches of stained murine vein grafts
Challenges
The script on the second batch (mac3/cd206) does seem to give the right output, only do the results seem to differ too much from the first batch (mac3/ccr2). This is only the case for integrated density and area measurements, the other results seem to lie within the same range.
We have already tried to reset imageJ and reinstall imageJ. Moreover, we tried to reset severall settings such as scale.
We did not find any related topics.