passing path and filename to Analyze_Writer or Nifti_Writer

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

passing path and filename to Analyze_Writer or Nifti_Writer

Stephen Towler
In my macros, I'd like to pass a path and filename to the analyze
writer and nifti writer plugins.

run("Analyze 7.5") opens a save dialog box, but I can't seem to pass
path and filename arguments to it using the run() syntax.  A method
that excludes the save dialog box would be fine too, since I'm
pre-specifying the path and filename.

I'm new to imagej macros and plugins, so feel free to point me to
existing documentation if I've missed something obvious.

Thanks,
Stephen


--
Stephen Towler
[hidden email]
352-294-0048 office
352-682-5231 mobile (*NEW*)
352-392-8347 fax

Leonard Lab
Department of Neuroscience
PO Box 100244
University of Florida HSC
Gainesville, FL 32610
Reply | Threaded
Open this post in threaded view
|

Re: passing path and filename to Analyze_Writer or Nifti_Writer

Wayne Rasband
> In my macros, I'd like to pass a path and filename to the
> analyze writer and nifti writer plugins.
>
> run("Analyze 7.5") opens a save dialog box, but I can't seem
> to pass path and filename arguments to it using the run()
> syntax.  A method that excludes the save dialog box would
> be fine too, since I'm pre-specifying the path and filename.
>
> I'm new to imagej macros and plugins, so feel free to point
> me to existing documentation if I've missed something obvious.

Save an image with the command recorder (Plugins>Macros>Record)  
running and it will generate a run() function with the correct  
syntax. Here is an example:

    run("Analyze 7.5", "save=/Users/wayne/bridge.img");

Use string concatenation to pass the path as a variable:

    path = "/Users/wayne/bridge.img";
    run("Analyze 7.5", "save="+path);

Enclose the path in square brackets if it could possibly contain spaces:

    run("Analyze 7.5", "save=["+path+"]");

-wayne