Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Results: cant output PDF results in a macro without user interaction to click ok. #34

Open
chalkie666 opened this issue Aug 8, 2015 · 16 comments

Comments

@chalkie666
Copy link
Collaborator

Running as macro need a method / GUI parameter to make the PDF file output saved without user interaction, since right now OK must be clicked... not sure how to work around that.

@etadobson
Copy link
Collaborator

@chalkie666 - just a general question... what was the original rationale for exporting the data as a single PDF file?

@chalkie666
Copy link
Collaborator Author

chalkie666 commented Aug 11, 2015

Hi

To try and make it a single robust sharable chunk of data that's ready to
publish in supplemental info.

Actually now I think HTML or XML plus images and histograms as png might be
better....

Has to scale for use in batch mode
Thoughts?
On 11 Aug 2015 20:18, "Ellen T Arena" [email protected] wrote:

just a general question... what was the original rationale for exporting
the data as a single PDF file?


Reply to this email directly or view it on GitHub
#34 (comment)
.

@etadobson
Copy link
Collaborator

as opposed to the log window... is it possible to display datasets in a results window? would then be more clear the slices and associate datasets, etc. these results are then easily transferred to .xls files. this type of output may be more useful for users in the end... ??

See Issue #45

@ctrueden
Copy link
Member

FWIW, there is an example here that generates an ImageJ2-style results table and displays it. So what you propose is certainly doable, @etarena. (As an aside though, that example is a little bit moldy and could do with some updating... but the results table part is still pretty much right on.)

See Issue #45

@chalkie666
Copy link
Collaborator Author

Indeed we should use the imagej2 results window not the log window. That
was just a lazy hack... But We digress. Maybe need anithervussue for that.

Here I need to figure out how to set the path for writing the PDF or
whatever output files in the setup gui. So it's a parameter of the plugin.
So it will work in a macro.

So.it is a input gui v2 thing really. Not results.... I will change the
title.

On 12 Aug 2015 17:40, "Curtis Rueden" [email protected] wrote:

FWIW, there is an example here
https://github.com/imagej/imagej-tutorials/blob/cec6e4d10d9cf066ef9152434295bbebb89e9931/call-modern-from-legacy/src/main/java/DisplayATable.java
that generates an ImageJ2-style results table and displays it. So what you
propose is certainly doable, @etarena https://github.com/etarena. (As
an aside though, that example is a little bit moldy and could do with some
updating... but the results table part is still pretty much right on.)


Reply to this email directly or view it on GitHub
#34 (comment)
.

@chalkie666
Copy link
Collaborator Author

Can't edit the issuebtitle in the pesky mobile version of the Github site... Sctuallybits very usable from a smartphone.

@ctrueden where do I see an example of a minimal plugin gui imagej2 style.?
No more imagej1 generic dialog?

@chalkie666
Copy link
Collaborator Author

And I can't edit my typos either!!!!

@ctrueden
Copy link
Member

@chalkie666 You can check out the widget-demo tutorial for an illustration of a rather involved GUI that does not need to use GenericDialog. This is explained a bit on the Script parameters wiki page, too.

Note that the parameter mechanism does have certain limitations, and is no substitute for a fully fleshed out UI written in Swing. But for exposing function parameters in a UI-agnostic way, it is a big step in the right direction.

@chalkie666
Copy link
Collaborator Author

@ctrueden
Awesome! Thanks.

My main worry is to make sure aby new input / setup gyu for the plugin is
fully macro/script-able.

Should I forget about IJ1 macro lang, and concentrate on making sure python
or beanshell can run the plugin with parameters set in a loop through files?

Is there still fun with building a parameters string for ij2 plugins to be
run, or is there some nicer mechanism?

To see how it works, Can you suggest a fully imagej2 plugin I can try to
record a macro / or python script with using the recorder? Does that work
yet?
On 12 Aug 2015 22:24, "Curtis Rueden" [email protected] wrote:

@chalkie666 https://github.com/chalkie666 You can check out the widget-demo
tutorial
https://github.com/imagej/imagej-tutorials/blob/cec6e4d10d9cf066ef9152434295bbebb89e9931/widget-demo/src/main/java/WidgetDemo.java
for an illustration of a rather involved GUI that does not need to use
GenericDialog. This is explained a bit on the Script parameters
http://imagej.net/Script_parameters wiki page, too.

Note that the parameter mechanism does have certain limitations, and is no
substitute for a fully fleshed out UI written in Swing. But for exposing
function parameters in a UI-agnostic way, it is great.


Reply to this email directly or view it on GitHub
#34 (comment)
.

@ctrueden
Copy link
Member

If you use @Parameter fields, then it should fully work in the Macro Recorder... did you try it?

As for longer term, the goal is to reduce the nastiness of the parameter string being generated, yeah. But that's in the future, still. It will fundamentally be doable though (e.g., we won't have problems with arguments that contain both spaces and square brackets being impossible to use).

@chalkie666
Copy link
Collaborator Author

@ctrueden
Do you mean the input gui being recorded should have Parameter fields for
all the input parameter gui fields?

But then these all pop up in a window to ask user for parameters?

What if you want to programmatically code the input parameters in the
script to process eg a directory of input files or test a bunch of
different parameters on the same input file. But have no user interaction
eg for headless mode?

What's the right way to implement the gui so its recordable in ij2 and will
work in headless mode?
On 13 Aug 2015 18:53, "Curtis Rueden" [email protected] wrote:

If you use @parameter fields, then it should fully work in the Macro
Recorder... did you try it?


Reply to this email directly or view it on GitHub
#34 (comment)
.

@ctrueden
Copy link
Member

What's the right way to implement the gui so its recordable in ij2 and will work in headless mode?

Using @Parameter annotations is the right way. Both for Commands (i.e., Java code; see e.g. widget-demo tutorial) and for scripts (see Script parameters page).

When you do it this way, and execute the command/script in the ImageJ UI, it will pop the dialog. But if you execute it via a call to CommandService.run passing in the input parameter values, no dialog will be shown. When you launch the IJ1 Macro Recorder and execute such a command/script and input the desired values into the dialog, you should see a line of code appear in the Recorder that will reproduce that execution with those same input values, but without a dialog popping the second time.

You can call the command/script from other tools besides ImageJ as well, such as KNIME and OMERO and CellProfiler. Each of those will harvest the parameter values in its own way.

You can run the thing headless—usually this is done by running a script which passes the parameter values you want. This can certainly be in a loop over all files in a directory, for example.

@ctrueden
Copy link
Member

Basically, all that's missing is a better and more modern "Script Recorder" that integrates with all script language plugins properly to record these command/script executions, producing a proper line of code that does not suffer from the shortcomings of the IJ1 macro language approach. It's planned.

@chalkie666
Copy link
Collaborator Author

OK. That's very cool!
The way forward is then clear
On 14 Aug 2015 04:08, "Curtis Rueden" [email protected] wrote:

Basically, all that's missing is a better and more modern "Script
Recorder" that integrates with all script language plugins properly to
record these command/script executions, producing a proper line of code
that does not suffer from the shortcomings of the IJ1 macro language
approach. It's planned.


Reply to this email directly or view it on GitHub
#34 (comment)
.

@trasse
Copy link

trasse commented Jan 22, 2020

I just encountered the same issue as i want to use Coloc2 in headless batch mode,

It would be really great if there were an option just to pass on a filename and then
save the PDF instead of displaying it.

For the actual values, i use a modified version of the groovy script described at image.sc
But it would be nice to have the PDF in addition.

Would that be a lot of effort?

Thanks a lot &
Kind regards
Tobias

@ctrueden
Copy link
Member

ctrueden commented Jan 23, 2020

Ping @chalkie666 @etadobson for support. 😄

(Aside: you two are currently listed with support role—see SciJava team roles—for this component, and @etadobson also has developer role. Does this reflect reality? If so, could one of you look into this? Or if you don't have time for this component anymore, let's fix the roles to be more accurate.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants