Login  Register

Re: Batch channel splitter

Posted by Herbie-4 on Sep 11, 2014; 6:25pm
URL: http://imagej.273.s1.nabble.com/Batch-channel-splitter-tp5009575p5009586.html

No name,

the code is neither written in java, nor python but in the ImageJ-macro
language that is documented here
        <http://rsb.info.nih.gov/ij/developer/macro/macros.html>
there
        <http://fiji.sc/Introduction_into_Macro_Programming>
and there
        <http://rsb.info.nih.gov/ij/developer/macro/functions.html>
and maybe many other places.

HTH

Herbie

::::::::::::::::::::::::::::::::::
On 11.09.14 20:15, csadangi wrote:

> 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.
>
> -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html