Posted by
Xiuxia Zhang on
Jul 23, 2015; 8:01am
URL: http://imagej.273.s1.nabble.com/questions-about-ImageJ-javascript-scripts-language-tp5013709p5013712.html
Thanks, Emanuele. You are right. Now my code works.
Here is the working code.
importClass(Packages.ij.IJ);
IJ.run("Text Image... ","open=/home/xiuxia/home2/result/predict_14img.txt");
imp = IJ.getImage();
IJ.run("Conversions...", " ");
IJ.saveAsTiff(imp, "/home/xiuxia/home2/result/predict_14img00xx.tif");
imp.close();
On Thu, Jul 23, 2015 at 3:36 PM, Emanuele Martini <
[hidden email]>
wrote:
> Hi Xiuxia,
> maybe I am wrong but I think that in your *not* imagej macro code, you are
> trying to getImage before opening it.
>
> So I think that you could try like that:
> ++++
>
> IJ.run("Text Image... ",
> "open=/home/xiuxia/home2/result/predict_14img.txt");
>
> *imp = IJ.getImage();*
>
> IJ.run("Conversions...", " ");
> IJ.saveAs(imp, "Tiff", "/home/xiuxia/home2/result/predict_14img0000.tif");
> imp.close();
> +++
>
> since the opening function is IJ.run("text image.....)
> and then you can get it via IJ.getImage
>
> but maybe I'm wrong...
>
> Have a nice day,
> Emanuele Martini
>
>
>
>
> -----
> Image Analyst @Ifom-IEO research campus -MI-
> --
> View this message in context:
>
http://imagej.1557.x6.nabble.com/questions-about-ImageJ-javascript-scripts-language-tp5013709p5013711.html> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
--
* Xiuxia **Zhang*
*Institute of Computing Technology Chinese Academy of Sciences*
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html