http://imagej.273.s1.nabble.com/Batch-channel-splitter-tp5009575p5009586.html
and maybe many other places.
> Hi Jeff,
>
> I got the following code. Can you tell me what all to delete just to
> get the green and red channel. I want one code for green and one for
> red. And is this a java or a python language.
>
> dir=getDirectory("Choose a Directory"); print(dir); splitDir=dir +
> "\Split\\"; print(splitDir); File.makeDirectory(splitDir); list =
> getFileList(dir);
>
> for (i=0; i<list.length; i++) { if (endsWith(list[i], ".tif")){
> print(i + ": " + dir+list[i]); open(dir+list[i]);
> imgName=getTitle(); baseNameEnd=indexOf(imgName, ".tif");
> baseName=substring(imgName, 0, baseNameEnd);
>
> run("Split Channels"); selectWindow(imgName + " (blue)");
> rename(baseName + "-blue.tiff"); saveAs("Tiff", splitDir+baseName +
> "-blue.tif"); close(); selectWindow(imgName + " (green)");
> saveAs("Tiff", splitDir+baseName + "-green.tif"); close();
> selectWindow(imgName + " (red)"); saveAs("Tiff", splitDir+baseName +
> "-red.tif");
>
> run("Close All"); } }
>
>
>
> -- View this message in context:
>
http://imagej.1557.x6.nabble.com/Batch-channel-splitter-tp5009575p5009583.html>
>
Sent from the ImageJ mailing list archive at Nabble.com.