Posted by
fiji-newbie on
May 31, 2021; 4:23pm
URL: http://imagej.273.s1.nabble.com/Help-writing-a-macro-to-merge-channels-save-with-sequential-names-tp5024674.html
First of all, I wanted to say I ahve searched this question in the group
before and I have copy-pasted the answers I have seen so far. However, this
does not seem to work for me and I am pretty sure that it has to do with my
ineptitude for understanding code.
I set up a 20x20 stitching of my sample for the 1st time and the microscope
software returned a single .czi file which, when opened with ImageJ, prompts
400 windows to open at the same time. I would like to save each of these as
an independent tiff "merged" file with sequential names so that I can stitch
them later using a tutorial I saw on YouTube.
But right now I have tried the snippets of code that I have seen in the
forum with no luck. I go to Plugins>New>Macro and write the code, save it in
a folder, and then go to Plugins>Run>Macro and click on it. It just saves a
single channel of the most recent image (number 400) in the output folder
and calls it a day.
This is the code I've tried so far:
dir = getDirectory("M:\Confocal\20210507\NewStitch");
ids=newArray(nImages);
for (i=0;i<nImages;i++) {
selectImage(i+1);
title = getTitle;
print(title);
ids[i]=getImageID;
saveAs("tiff", dir+title);
And I am not sure
1. Why it doesn't save 400 images in the output folder
2. How to add a line of code that merges both channels. In my case, channel
1 = red color & channel 2 = grey color.
Any help would be greatly appreciated!
<nabble_img src="Capture-ImageJ.png" border="0"
alt="Screenshot of ImageJ with 400 opened images and copy-pasted
code"/>
--
Sent from:
http://imagej.1557.x6.nabble.com/--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html