-
Notifications
You must be signed in to change notification settings - Fork 8
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 construction and decomposition of ImgLabeling #38
Conversation
final RandomAccessibleInterval< I > img, | ||
final List< T > labels) | ||
{ | ||
List<Set<T>> labelSets = Stream.concat(Stream.<Set<T>>of(Collections.emptySet()), |
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 find this much less readable than
List<Set<T>> labelSets = new ArrayList<>(Collections.emptySet());
labelSets.addAll( labels );
Please change
I explicitly made it hard to construct an Extending AbstractList is okay, but also it should be made clear in the javadoc that it is an unmodifiable list. And should be formatted with imglib2 code style |
b6e95b9
to
2d8280b
Compare
I added javadocs & fixed the coding style. I tried to completely remove the SerializationAccess, but I think that would invite people to much to shoot their foot. It would add the method imgLabeling.getMapping().setLabelSets(...). I cannot think of a consistent way to use this method after initialization. |
* To easily setup and ImgLabeling from given data use: imgLabeling = ImgLabeling.fromImageAndLabelSets(img, labelSets) * To decompose a ImgLabeling use: List< Set< T > > labelSets = imgLabeling.getMapping(); RandomAccessibleInterval< IntegerType > img = imgLabeling.getIndexImg();
2d8280b
to
cae3253
Compare
It has been a todo comment, and it makes a lot of sense.
If you only have an index image and no Would a new method |
Hey all, there are some people on the forum asking for the functionality behind this PR. Is there a way to pull this PR through as requested? Thanks! Cheers, |
@haesleinhuepf The people formally responsible for reviewing PRs for this component are @tpietzsch, @StephanPreibisch and @axtimwalde. See the |
@tpietzsch reviewed the PR already. I will make the requested changes:
|
We don't need it as there is the getLabelSets method. And users might be confused by the List is not modifiable.
@tpietzsch I made the changes that you asked for. Remark: I don't think this PR makes it more likely for user to shut themself in their foot. Previously users could have created malfunctioning ImgLabelings when they used non zero index images. The situation stays exactly the same: If you create an ImgLabeling, you need to have a matching index image. |
Thanks @maarzt |
imgLabeling = ImgLabeling.fromImageAndLabelSets(img, labelSets)
Set labelSets = imgLabeling.getMapping();
RandomAccessibleInterval img = imgLabeling.getIndexImg();