On 7/8/13 12:33 PM, Angus G wrote:
> Hello!
>
> I have been using the record function to write some macros and for some functions it is obviously important the correct window is selected. Is there a way to make the macro always select the window of a particular channel of an RBG image? At the moment it will only run properly if on the image I recorded the macro on but I would like to make it more generic so I can analyse many images with the same macro.
>
> I hope that makes sense!
If you have an RGB image, you can make it a composite image with:
run("Make Composite");
Then you have a some choices.
You can split the channels, and each will be named
C1-originalName, C2-originalName , C3-originalName.
Or you can select the channel, eg
Stack.setChannel(n)
(and see the other useful Stack.whatever functions)
You can use getTitle() various string functions to get your original
input name, and then use that in subsequent processing. For example:
inputName = getTitle() //assume desired image is active
run("Split Channels");
ch1Name = "C1-"+inputName;
ch2Name = "C2-"+inputName;
and so on.
You can select your image from file -- this snippet may be useful:
path = File.openDialog("Click on input image");
print(path);
inputDir=File.getParent(path);
print(inputDir);
inputName = File.getName(path);
print(inputName);
open(path);
Hope this helps...
--aryeh
--
Aryeh Weiss
Faculty of Engineering
Bar Ilan University
Ramat Gan 52900 Israel
Ph: 972-3-5317638
FAX: 972-3-7384051
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html