Created
November 5, 2014 11:03
-
-
Save ozooxo/cfca2c531824b6925260 to your computer and use it in GitHub Desktop.
Use ImageJ as a third party java library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget "http://imagej.nih.gov/ij/download/linux/ij148-linux64.zip" | |
unzip ij148-linux64.zip | |
cd ImageJ | |
jar -xvf ij.jar # simply do | |
# $ javac -classpath '.:ij.jar' Algorithm.java | |
# $ java Algorithm | |
# will cause run time error for not finding some particular classes | |
# (which are actually in the .jar file). Reason unknown. | |
cd .. | |
mv ImageJ/ij ij | |
rm -rf ImageJ | |
cat >Algorithm.java <<EOL | |
import ij.*; | |
import ij.process.*; | |
public class Algorithm { | |
public static void main(String[] args) { | |
ImageProcessor ip = new ByteProcessor(400, 400); | |
String title = "My new image"; | |
ImagePlus imp = new ImagePlus(title, ip); | |
IJ.saveAs(imp, "tif", "image.tif"); | |
} | |
} | |
EOL | |
javac Algorithm.java | |
java Algorithm # it will save a blank file "image.tif" in the current folder |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment