Conversation
* enables Tasks usage in ij macro language * adds Task example scripts in ij macro language and in groovy, with and without cancellation
Contributor
Author
|
My concerns for the review:
|
NicoKiaru
commented
Dec 11, 2023
| @SuppressWarnings("unused") | ||
| public class TaskHelper { | ||
| // Since the LegacyService exists only once, the LogService and the ObjectService can be accessed statically | ||
| static { |
Contributor
Author
There was a problem hiding this comment.
Make services load 'more lazily'
Contributor
Author
There was a problem hiding this comment.
Check double checked locking pattern
NicoKiaru
commented
Dec 11, 2023
Comment on lines
+22
to
+44
| 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; | ||
| } | ||
| } No newline at end of file |
Contributor
Author
There was a problem hiding this comment.
Find a way to 'autorun' or auto import these functions -
Contributor
Author
Contributor
Author
There was a problem hiding this comment.
Contributor
Author
There was a problem hiding this comment.
Contributor
Author
|
Make a test that is a macro and that uses each functions of Tasks |
Contributor
Author
I need to test it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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