ImageJ opener / saver

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

ImageJ opener / saver

Jirka
This post was updated on .
Good morning,
may I have brief question about the saving in an ImageJ plugin. 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. What would be
another way how to ask for a name on the beginning (for instance to be seen
when I use marco record), to be part of the plugin calling. Or should I
create another method in the plugin which would handle this case for usage
in bash?

Thanks
--
Best regards, Jiří Borovec
----------------------------------------------------------------------------------------------------
Jiří Borovec <jiri.borovec@fel.cvut.cz>
PhD student at CMP CTU, ISC member
http://cmp.felk.cvut.cz/~borovji3

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: ImageJ opener / saver

dscho
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