-
Notifications
You must be signed in to change notification settings - Fork 25
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
Task support for ij macro language #303
base: master
Are you sure you want to change the base?
Conversation
* enables Tasks usage in ij macro language * adds Task example scripts in ij macro language and in groovy, with and without cancellation
My concerns for the review:
|
@SuppressWarnings("unused") | ||
public class TaskHelper { | ||
// Since the LegacyService exists only once, the LogService and the ObjectService can be accessed statically | ||
static { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make services load 'more lazily'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check double checked locking pattern
function taskCreate(name, maxSteps) { | ||
call("net.imagej.legacy.task.TaskHelper.removeAll", name); // Removes dangling tasks named identically generated during a macro crash for instance | ||
call("net.imagej.legacy.task.TaskHelper.createTask", name); | ||
call("net.imagej.legacy.task.TaskHelper.setProgressMaximum", name, maxSteps); | ||
call("net.imagej.legacy.task.TaskHelper.start", name); | ||
} | ||
|
||
function taskSetProgressValue(name, step) { | ||
call("net.imagej.legacy.task.TaskHelper.setProgressValue", taskName, step); | ||
} | ||
|
||
function taskFinish(name) { | ||
call("net.imagej.legacy.task.TaskHelper.finish", name); | ||
} | ||
|
||
function taskIsCanceled(name) { | ||
ans = call("net.imagej.legacy.task.TaskHelper.isCanceled", name); | ||
if (ans == "true") { | ||
return 1; | ||
} else { | ||
return 0; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Find a way to 'autorun' or auto import these functions -
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make a test that is a macro and that uses each functions of Tasks |
I need to test it |
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