Login  Register

Re: Can a command line call to a macro reference a url instead of a local file?

Posted by Wayne Rasband on Oct 28, 2009; 3:06pm
URL: http://imagej.273.s1.nabble.com/Can-a-command-line-call-to-a-macro-reference-a-url-instead-of-a-local-file-tp3690632p3690633.html

 > Wayne and others,
 >
 > Can a command line call to a macro reference a url instead
 > of a local file for the macro code?
 >
 > Thanks,
 > Bill

Macros can open files using a URL. This example opens an image and a  
text file using URLs:

   open("http://rsb.info.nih.gov/ij/images/clown.jpg");
   open("http://rsb.info.nih.gov/ij/macros/examples/Grid_Overlay.txt");

Text files can be opened as a string. This example opens a macro as a  
string and then runs it:

    s =  
File.openUrlAsString("http://rsb.info.nih.gov/ij/macros/examples/ 
Grid_Overlay.txt");
    eval(s);

The Grid_Overlay macro requires the v1.43j daily build, which adds an  
Image>Overlay submenu with seven new commands.

Scripts and plugins can open an image using a URL without displaying  
it. This JavaScript example opens an image, enlarges it, and then  
displays it:

   imp = IJ.openImage("http://rsb.info.nih.gov/ij/images/clown.jpg");
   IJ.run(imp, "Size...", "width=640 height=400 interpolation=Bicubic");
   imp.show();

-wayne