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
Configure Analyze Regions #60
Comments
Hi @tischi, |
Thanks! A very easy fix would be to make the boolean variables |
Hi, |
@dlegland any progress on this front? :-) |
Hi, best, |
Hi, It introduces an inner class "Features", that contains public boolean fields for selecting the features to compute. Example:
Feedback welcome! |
Proposition from @oburri: use a Builder type approach.
|
In case you're interested in this kind of Builder Pattern refactoring, I'd be happy to help, as I do love MorphoLibJ |
I finally arrived at a new refactoring of the AnalyzeRegions class! The main thing is that the computation part is now managed by the "MorphometricFeartures2D" class (within inra.ijpb.analyze.regions2d package). I was trying with builder type approach, but finally used a collection features (instances of the inner "Feature" enum). A typical call can be as follow:
An alternative with adequate static imports:
The AnalyzeRegions have been updated to call the MorphometricFeatures2D class. The AnalyzeRegions.Features class have been deprecated, and the code was adapted to use the MorphometricFeatures2D class. It seems to work as previously. I would lije to have a more generic approach, that would allow to add new user-defined features without having to change code in MorphoLibJ, but I could not yet find a simple enough solution... |
|
Thank you! I hope this will be more scriptable than the AnalyzeRegions plugin, and that this will not be too complicated to maintain by introducing new features...
One get an empty table. Only the region label is provided.
Yes! working on it... nearly ready, I just would like to enhance unit tests and general checks.
Sure! the main class is MorphometricFeatures2D.java. It encapsulates an enum class MorphometricFeatures2D.Feature. This enumeration lists the different features that can be computed with the AnalyzeRegions plugin. Then, the computeTable method populates the results table from an ImagePlus containing a 2D label map. |
I see!
I guess this does the trick?! Isn't that some kind of builder pattern? |
Yes! Works like classical methods from the Collections framework, but returns instance to "this".
To be honest, I do not really know... Returning an instance to this is typical from the Builder pattern, but the builder approaches I have seen often use two different classes: one for the builder, another one for the main class. Here, there is no "build()" method at the end. |
Hi! Everything seems to work fine: same behaviour as before, and it is now possible to choose features programmatically. On the roadmap is also the refactoring of the dialogs for analysis of regions. This may take some time however. |
@dlegland
How does one set those booleans from Java?
I mean without calling the UI, but programmatically....
The text was updated successfully, but these errors were encountered: