Re: ImageJ opener / saver
Posted by
dscho on
Jan 02, 2014; 2:37pm
URL: http://imagej.273.s1.nabble.com/ImageJ-opener-saver-tp5006016p5006018.html
Hi Jiří,
On Thu, 2 Jan 2014, Jiří Borovec wrote:
> I have plugin which can save a segmentation into txt file on output. So
> in the end of the processing I run this peace of code to ask user for
> the output name:
>
> OpenDialog od = new OpenDialog("Save raw segmentation");
> if (od.getPath() != null) {
> ij.IJ.log(" -> export to file: "+od.getPath());
> sp.getSegmentation().exportToFile( od.getPath() );
> }
>
> But what I see as a problem is that in this case it cannot be run in
> bash automatically because there is no field which would specify the
> output file on the beginning and it always stop and ask for a name.
The OpenDialog works a bit like the GenericDialog with respect to macro
recording: It records the values specified by the user when run
interactively and fills in the values from the last parameter of IJ.run()
when run in macro mode.
So if you call
java -jar ij.jar -eval 'run("My Plugin", "save=[C:\\ding\\dong.txt]");'
things should work as expected. The key by which the value is referenced
is constructed from the OpenDialog's title. If in doubt, just fire up the
recorder and click through one run of your plugin.
Ciao,
Johannes
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html