Login  Register

a simple question: using imagej source code and macros

Posted by Chris Clarin on Feb 12, 2008; 11:37am
URL: http://imagej.273.s1.nabble.com/a-simple-question-using-imagej-source-code-and-macros-tp3697208.html

Good day,

I need to access imagej source codes via my own java program. i was able to
do it using the API until i discovered that i could just put everything in a
macro and just run the macro from my java program. this is what i'm trying
to do now but can't. I'm thinking that what I'm doing may be too simple, is
this correct:

public static void main (String args[]) {
        File blobs = new File ("blobs.txt");
        MacroRunner macro2 = new MacroRunner (blobs);
        macro2.run();
    }

this is the exception that I am getting: NullPointerException and this is
what gets printed out in the console:

File is not in TIFF, JPEG, GIF, BMP, DICOM, FITS, PGM,
ZIP, LUT, ROI or text format, a reader plugin for this
format is not installed, or it was not found.

Why is this so? I am sure that blobs.txt exist though and am hoping that
whatever is in blobs.txt gets run.

I tried to use the string constructor as well, doing this:

MacroRunner macro = new MacroRunner (" run(\"Blobs (25K)\");  \n
setAutoThreshold();");

and it runs perfectly. I'm just a little puzzled with why the one where i am
using a file is not working.

Thank you, hoping to have your help on this one

-- christine
-------------------------------------------------------------------
Christine T. Clarin
UP Department of Computer Science
Work/Fax: (02) 434-3877
Mobile: (+63917) 482-3606
Email: [hidden email]