bonej-org / BoneJ2

Plugins for bone image analysis
BSD 2-Clause "Simplified" License
20 stars 12 forks source link

Make Ellipsoid Factor macro recordable #235

Closed mdoube closed 4 years ago

mdoube commented 4 years ago

Describe the bug Ellipsoid Factor (IJ2 style) is not macro recordable. No entry appears in the Macro Recorder when Ellipsoid Factor completes.

To Reproduce Steps to reproduce the behaviour:

  1. Run the Macro Recorder
  2. Run Ellipsoid Factor

Expected behavior An Ellipsoid Factor command should appear in the Macro Recorder

Screenshots image

Additional context Reported on the forum https://forum.image.sc/t/using-ellipsoid-factor-in-a-macro/36975

It is possible to record run("Ellipsoid Factor"); but only if you cancel the run from the dialog box. There should be a long string of variables listed in the recorded macro command.

Also, all the other recorded commands are noisy and should be hidden from the user.

Other IJ2 ('Modern') plugins can record, for example Anisotropy:

run("Anisotropy", "inputimage=net.imagej.ImgPlus@274042d9 directions=2000 lines=10000 samplingincrement=1.73 recommendedmin=true printradii=true printeigens=true displaymilvectors=false")
rimadoma commented 4 years ago

I don't think this is a quick fix. Maybe a workaround is possible, but AFAIK ImageJ2 style commands are intended to be scripted with Python. I know it's a big ask to let go of macros, but my working assumption during the project was always that they were going to be a thing of the past. And I assumed macro-recording would get replaced by something else as well. It was a mistake not to discuss this more though.

mdoube commented 4 years ago

I don't think this is a quick fix.

Is there not a pattern we can copy from Anisotropy, which is also a pure IJ2 plugin and is perfectly recorded by the macro recorder?

mdoube commented 4 years ago

ImageJ2 style commands are intended to be scripted with Python

In that case it would for us to give users a hint in the docs about what commands to include. The beauty of the macro recorder is that users don't have to do much and the code is written for them, which is a nice bump to get started with simple procedural programming.

rimadoma commented 4 years ago

Is there not a pattern we can copy from Anisotropy, which is also a pure IJ2 plugin and is perfectly recorded by the macro recorder?

That's good news then! I pessimistically assumed that this affected all the commands in Modern.

rimadoma commented 4 years ago

In that case it would for us to give users a hint in the docs about what commands to include. The beauty of the macro recorder is that users don't have to do much and the code is written for them, which is a nice bump to get started with simple procedural programming.

Bottom line is I know little about macros / scripting in ImageJ. If macro recording does work, then that's great, but we should investigate how the other commands fare. @mdoube Since you know most about macros, could you do that at some point? If there are problems, we'll try to fix them like this one. If not, we could at least add macro snippets to documentation that users could add to their otherwise recorded macros.

mdoube commented 4 years ago

Fixed by #238