Hello,
I am trying to merge images of a dead/live coloring.
I am doing it, based on the guide shown by Duke University:
Webpage: microscopy.duke.edu/guides/overlay-images-imageJ
- Open the images in ImageJ
- Adjust the contrast if neceesary: Image/Adjust/BrightnessConstrast
- Change or check all Images are in 8-bit format. Image/Type/8-bit
- Image/Color/Merge Channels and the Merge Channels box will appear
- Select the fluorescent images in the appropriate R, G and B channels and the DIC or similar image in gray channel. Select “Create Composite” and click “OK”
- Click on the new ‘composite’ image to activate it
- Image/Type/RGB Color
- Save it as “Tiff” file
When I do it by hand like the guide tells, I get as result the following image:
Composite (RGB).tif (14.4 MB)
I found a script in the forum Topic that I modified a little.
macro "batch_merge_channels"{
setBatchMode(true);
file1 = getDirectory("Dead");
//you can change the name of the inquiry to whatever wavelength you need, e.g. CY5
list1 = getFileList(file1);
//gets the list of files in the folder DAPI
n1 = lengthOf(list1);
//gets the number of files in folder DAPI, it should be the same as the number
//of files in folder GFP
file2 = getDirectory("Live");
list2 = getFileList(file2);
file3 = getDirectory("Live-And-Dead");
//the output folder. When started first the number of files is 0
list3 = getFileList(file3);
n2 = lengthOf(list3);
small = n1;
//condition for for-loop
for(i = n2 + 1; i < small; i++) {
//i will always follow the aborted number of merges, you might not have the problem,
//but with small memory and a huge set of images it is useful
name = list2[i];
//not to lose your track, though you can change it to anything else
open(file1 + list1[i]);
run("8-bit");
open(file2 + list2[i]);
run("8-bit");
run("Merge Channels...", "c1=[" + list1[i] + "] c2=[" + list2[i] + "] keep ignore");
run("RGB Color");
saveAs("tiff", file3 + name);
close();
}
}
The folder “Dead” should be on the red and “Live” on the green channel.
When I let run the script, I get as result the following image:
007__2.tif (14.4 MB)
Can someone tell me why I got different pictures as a result, and how I can modify the script, that the result is the same as doing it by hand?
Here are the basic images:
for red:
007__2.tif (9.3 MB)
for green
007__2.tif (5.9 MB)
By the way, there is a second problem in the script. The first result of each folder (Dead or Live) will not be saved. e.g. in each folder are 4 images (1.tif, 2.tif… ) the result will only be 2.tif, 3.tif and 4.tif. The number 1 in that case will not be done. Any ideas?
Thanks for your help.