fiji / Colocalisation_Analysis

Fiji's plugin for colocalization analysis
http://imagej.net/Coloc_2
GNU General Public License v3.0
24 stars 18 forks source link

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

Open chalkie666 opened 9 years ago

chalkie666 commented 9 years ago

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 commented 9 years ago

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

chalkie666 commented 9 years ago

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" notifications@github.com 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 https://github.com/fiji/Colocalisation_Analysis/issues/34#issuecomment-130001624 .

etadobson commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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" notifications@github.com 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 https://github.com/fiji/Colocalisation_Analysis/issues/34#issuecomment-130346506 .

chalkie666 commented 9 years ago

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 commented 9 years ago

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

ctrueden commented 9 years ago

@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 commented 9 years ago

@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" notifications@github.com 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 https://github.com/fiji/Colocalisation_Analysis/issues/34#issuecomment-130436088 .

ctrueden commented 9 years ago

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 commented 9 years ago

@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" notifications@github.com 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 https://github.com/fiji/Colocalisation_Analysis/issues/34#issuecomment-130758982 .

ctrueden commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

OK. That's very cool! The way forward is then clear On 14 Aug 2015 04:08, "Curtis Rueden" notifications@github.com 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 https://github.com/fiji/Colocalisation_Analysis/issues/34#issuecomment-130922698 .

trasse commented 4 years ago

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 commented 4 years ago

Ping @chalkie666 @etadobson for support. :smile:

(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.)