-
Notifications
You must be signed in to change notification settings - Fork 17
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
Simplify command classes and examples #106
Conversation
1c9284f
to
91247fe
Compare
This PR misses the Tracking demo because data files used in the old demo are not included in the project resources. This demo, along with other workflows, will be added later in another PR. |
983117d
to
c58444d
Compare
* Merge commands and executors for less indirection * Move subprocess running, temporary file management and common parameters to the CommandBase class * Simplify and merge together demo classes * Add a simple pixel classification ImageJ macro
c58444d
to
94506df
Compare
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.
Hey @emilmelnikov,
sorry for taking some time to look at this. It looks really nice, I appreciate the cleanup and simplification, as, e.g. with handling of temporary files and the more elegant way of extending/creating new commands!
I still need to do some testing, like, if some old macros that I have still work :)
It would be nice to add a paragraph about running the plugin from java (as in demo.java
) to the readme.
For future development:
- in order to have a little more uniform flow:
- add output types to workflows other than Pixel Classification, e.g.
Probabilities
,Predictions
,ObjectIDs
to object classification - add stage 1 outputs to Autocontext command
- add output types to workflows other than Pixel Classification, e.g.
Okay I ran a few macros and they all still seem to work as before 👍 |
Do you know how to read a "non-standard" (e.g. probabilities) image in a macro? For me it did not work because it needed to be imported via BioFormats that shows a pop-up dialog which doesn't work properly in the macro environment. |
After discussing this issue with @k-dominik, it turns out that some of our test TIFF files in this repo are not ImageJ-compatible. Re-exporting them with ImageJ should solve the problem. |
Co-authored-by: Dominik Kutra <[email protected]>
OptionsPlugin uses Java Preferences system for persisting options. This system uses fully qualified class names as keys for data persistence. Co-authored-by: Dominik Kutra <[email protected]>
* Show progress bars and spinners in StatusService during potentially lengthy operations * Instead of using LogService directly, log to a class-name-scoped logger
Now everything that ilastik prints (both stdout and stderr) goes into the INFO log level. This prevents a log window from popping up when ilastik prints warnings to stderr, which is very common (it occurs if ilastik cannot find any solvers in the system). |
We have other non-workflow commands that should not derive from CommandBase.
Also add more docstrings and comments.
928baa0
to
780c506
Compare
GitHub now shows headings in Markdown files, so it's not necessary to create table of contents manually
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.
I've had a browse through the code changes, and this looks like a really good refactor. I haven't actually gone through the setup to try running this now, so let me know if I should as that will probably take me a couple more days...
One leftover question from me regarding the compatibility note in the readme:
Compatibility note:: We try to keep the plugin backwards compatible. Some versions of ilastik are not compatible with the current plugin: 1.3.3b2, 1.3.3rc2, 1.3.3, 1.3.3post1, 1.3.3post2. We recommend to update to the latest stable version!. If you need to stick with 1.3.3x for some reason, please use 1.3.3post3.
Is that still accurate now; are we able to make statements about compatibility or lack thereof after these changes? As far as I can follow, we are calling ilastik pretty much in the same way as before, so I guess most likely the compatibility hasn't changed. But I also don't really know why the plugin is incompatible with certain 1.3.3 subversions anyway :)
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.
the spinner is pretty cool :) Especially that it updates the status bar, so even on mouse moves one will be reminded of the fact that ilastik is running!
Let's bump version to at least 1.9.0
when we release this.
@@ -205,11 +205,11 @@ private void createMDArray(IHDF5Writer writer, long[] datasetDims, int[] blockSi | |||
} | |||
|
|||
private void writeARGB(IHDF5Writer writer, long[] datasetDims) { |
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.
not your code, I know, just curious what one would ever do with an argb image, and also how or why we would treat it differently than any other multi channel image 🤷 .
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.
I'm not completely sure, but a cursory look at writeARGB
tells me that this is because ARGBType
is a possible element type on an image which encodes 4 channels in an element itself, not in the shape of an image, hence the special handling.
|
||
@Parameter(label = "Number of Threads ilastik is allowed to use.\nNegative numbers means no restriction") | ||
private int numThreads = -1; | ||
public int numThreads = -1; |
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.
More a question: previously, options were accessed with getters and setters to private variables, now everything is public. So... OptionsPlugin
seems to support both styles?
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.
Values of all fields annotated with @Parameter
are somehow populated by the system.
Previously getters just called load()
before returning field values, but didn't find the reason to do this because load()
and save()
are a part of options API, and I think it's better to just read/write them directly. We can't change their names anyway.
|
||
import net.imagej.Dataset; | ||
import net.imagej.ImageJ; | ||
import org.ilastik.ilastik4ij.workflow.ObjectClassificationCommand; |
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.
I'm not sure if anyone used this from java before, but we should at least mention in some release notes, that the structure has changed a bit and point to the demo file that you have provided so nicely before releasing :)
return Collections.singletonMap("prediction_maps", inputProbOrSegImage); | ||
} | ||
if (ROLE_SEGMENTATION.equals(secondInputType)) { | ||
return Collections.singletonMap("binary_image", inputProbOrSegImage); |
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.
it might be more useful to have segmentation_image
here already - I can't imagine that more people are using the tracking with learning workflow, than the "normal" one (or animal tracking).
xref: ilastik/ilastik#2730
|
||
@Override | ||
public final void run() { | ||
logger = logService.subLogger(getClass().getCanonicalName(), LogLevel.INFO); |
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.
what is the reason to not use the logger
declared above, but now use something from logService
? What is the difference using one vs. the other?
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.
LogService#log
logs into the root logger, Logger#log
logs into some defined namespace (it our case it's fully-qualified class name). Unfortunately, log prefixes are not visible in the Info tab, but the Log tab (or some other log destination) shows them.
This reverts commit b96ae0d.
Partially supersedes #84 without adding the features table feature.