imglib / imglib2

A generic next-generation Java library for image processing
http://imglib2.net/
Other
293 stars 93 forks source link

More specific type hierarchy for volatile types #332

Open bogovicj opened 1 year ago

bogovicj commented 1 year ago

Currently, VolatileIntType extends AbstractVolatileNativeRealType, and is therefore a RealType. It is not currently an IntegerType, and probably should be.

The same is true for other Volatile types:

Adding AbstractVolatileNativeIntegerType and having the appropriate volatile types extend that would be a good step, and would be similar to the type hierarchy for non-volatile types (see AbstractIntegerType for example).

Some specific motivation

This issue came up in n5-viewer https://github.com/saalfeldlab/n5-viewer/issues/34

one fix to that issue is with this PR in imglib2-ij https://github.com/imglib/imglib2-ij/pull/35

but this is the deeper issue. Some, maybe all of the changes in the above PR would not be necessary if the type hierarchy for volatile types were more fine-grained. e.g., if volatile types implemented IntegerType, the explicit checks using volatile types in the PR would not be necessary, because there is currently a check for IntegerType.