Skip to content

Instantly share code, notes, and snippets.

@rendicahya
Created October 11, 2012 14:13
Show Gist options
  • Save rendicahya/3872597 to your computer and use it in GitHub Desktop.
Save rendicahya/3872597 to your computer and use it in GitHub Desktop.
ImageJ Problem
File file = new File(path);
if (file.exists()) {
ImagePlus image = IJ.openImage(file.getAbsolutePath());
ImagePlus[] split = ChannelSplitter.split(image);
if (split != null) {
System.out.println("SPLIT OK");
} else {
System.err.println("SPLIT NULL");
}
}
@miura
Copy link

miura commented Oct 11, 2012

Hi,

here is an example Javascript to extract G channel.

imp = IJ.openImage('/Users/miura/Desktop/hela-cells.tif');
impsplit = ChannelSplitter.split(imp);
impG= impsplit[1];
impG.show();

'hela-cells.tif' is a RGB image you could download by File > Sample Images > hela-cells.tif.
You could test the above script by

Plugins > New > Javascript

and then copy& paste the code above, then

Macros > Evaluate Javascript

Kota

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment