imagej / imagej-legacy

ImageJ+ImageJ2 compatibility layer
https://imagej.net/libs/imagej-legacy
BSD 2-Clause "Simplified" License
16 stars 25 forks source link

Task support for ij macro language #303

Open NicoKiaru opened 8 months ago

NicoKiaru commented 8 months ago

This PR adds the class net.imagej.legacy.task.TaskHelper which allows to use Tasks in the IJ1 macro language via the call function.

Demo scripts are provided for Tasks in the macro language and in the groovy language, with or without cancellation handling.

To enable the use of Task in the ij macro language all Tasks are stored in the ObjectService while they are not finished.

See forum post https://forum.image.sc/t/demo-and-proposal-new-progress-bars-for-fiji/64956/10 for context about the need

NicoKiaru commented 8 months ago

My concerns for the review:

NicoKiaru commented 8 months ago

Make a test that is a macro and that uses each functions of Tasks

NicoKiaru commented 8 months ago
  • In the TaskWithCancel.ijm example script, the function taskIsCanceled is a bit weird: it is converting a String ("true", "false") into a number (0,1) that acts as a Boolean. Is there a better way ? Can I directly return a Boolean in TaskHelper#isCanceled ?

I need to test it