-
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
Converters with LabelingTypes #5
Comments
@dietzc I fear that there is no perfect solution for this. One way to go is the one you outlined: make your own Second option would be to have a more generic
which would be implemented by the current |
I already thought that it wouldn't be possible. So here are some use-cases where we used converters:
The more I think about it, the more I understand that in many of our use-cases we only need read-only access to a converted label. Also, I like the to introduce a more general interface for LabelingMapping. However, I fear that we just move the computation time which is lost by e.g. converting a |
@dietzc I thought about it some more. In principle you should be able to do what you would like to do using the
I think it is just a bad idea to do this. There should be better ways to do the things you mentioned. Perhaps you could think about making the Labels themselves a bit more powerful. For example in the UI example, a label does not have to be an Integer. It could be an object that has an Integer and a |
@dietzc I made a small example of what a more generic LabelingType (it doesn't even have a LabelingMapping) could look like. It is in the branch https://github.com/imglib/imglib2-roi/tree/revised-labeling-converters. Could you have a look and provide some feedback if that would be a useful direction for you? Note that as I said earlier LabelRegions etc will not (and cannot) work with arbitrary |
Sorry to revive this old issue, but just for the record:
I now submitted imagej/imagej-common#93 which adds a new |
I released imagej-common 0.33.0 containing @imagejan's new converters. |
@tpietzsch : I have a general question concerning the labeling implementations in https://github.com/imglib/imglib2-roi/tree/revised-labeling.
Assume I have a
RandomAccessibleInterval<ShortType>
as input. I want to have aRandomAccessibleInterval<LabelingType<ShortType>>
as output. The value at each position in input should be the 'label' of the output. It's obvious that aConverter<ShortType, LabelingType<ShortType>
would make sense. However, there are some problems. For example, I have to create aLabelingType<ShortType>
which I can pass to theConverter
. I can't passnull
for theLabelingMapping
of the desiredLabelingType
asgetMapping()
on theLabelingType
should return a validLabelingMapping
. I thought about implementing an ownLabelingMapping
for this particular use-case, but then I'm not sure how to implementgetLabels()
orlabelsAtIndex(int idx)
.I was thinking about the minimal interface for a
LabelingMapping
(e.g. aConverter
fromIntegerType
and someSet<L>
+Externalization
methods inside the mapping,). But I have no clue if this makes sense at all.Do you have any ideas how I could nicely use
Converter
in the case of Labelings?The text was updated successfully, but these errors were encountered: