@tpietzsch Thank you very much for all your work on this at the hackathon!
I was looking over your changes, and I noticed that in your scheme it is not possible to retrieve the operands used to create a
MaskPredicate which resulted from an or, and, etc. nor is it possible to tell which operation was performed. For example, if someone unions a rectangle and a circle there’s no way to retrieve the original circle and rectangle from the resulting
MaskPredicate or figure out that the new
MaskPredicate resulted from a union.
I need this functionality for my conversions in imagej-omero, though I did forget to add unit tests for this functionality on my imglib2-roi shape-rois branch . In imagej-omero if I’m given a
RealMaskRealInterval to upload to OMERO, I need to check if this
RealMaskRealInterval resulted from an operation between multiple
MaskPredicates and if so convert the original
MaskPredicates to their OMERO equivalent and then recombine them in the same way as before (but using OMERO data structures).
For example, if someone tries to upload a
RealMaskRealInterval which is actually four
Boxes union-ed together, then I need to be able to “unwrap” the
RealMaskRealInterval into the four original
Boxes and I need to know that these
Boxes were union-ed.
Do you have any thoughts on how to achieve this? My thoughts are:
- Add four new classes (
RealMaskRealIntervalOperationResult, etc.), and these would have methods for retrieving operands and operation types
– OR –
operationType() methods to
MaskPredicate. Then the question is what do these methods return for things like
operands() could return
Collections.singletonList(this), or …
operationType() could return
null, an Enum, or …
Please let me know your thoughts on this. And once again thank you very much for all the work you did at the hackathon, I think the changes are a big improvement!