Closed gselzer closed 1 year ago
You know, I should actually add support for BooleanType
and IntegerType
as well...
I pushed a commit cleaning up imagej-common's converter type hierarchy. It introduces a ConciseConverter
base class that makes it simpler to write converter plugins. It also fixes a bug in the ROITreeToMaskPredicateConverter
that was checking destination assignability in the wrong way, and I added comments explaining in detail why code is the way it is.
I still have to go through some of my other comments above. I also may want to change some details of how ConciseConverter
is laid out. Will keep working on it, but feedback on what I did so far (1f0e3c28578192778640789a9c983b0d09aa1875) is welcome.
There are two things left to resolve before this branch can be merged:
UnsignedLongTypeToBigIntegerConverter
is obsoleted by the more general IntegerTypeToBigIntegerConverter
.convertService.convert
in NumberAndTypeConversionTest
(there are three places where the return value is not currently captured).All above issues addressed! LGTM
This pull request has been mentioned on Image.sc Forum. There might be relevant details there:
This PR adds support for conversions from
Number
s intoRealType
s, for example:This PR does not support the following conversion:
That conversion is already handled by
DefaultConverter
.The motivation behind this PR lies with Ops: Ops that take a
RealType
cannot currently be called with someNumber
implementation. This PR should fix that.There is the question of whether we should be explicitly performing that conversion (i.e. writing dedicated
Converter
s for it). I don't feel strongly: it feels more correct, but it is also a lot of boilerplate code (especially if we want to support allRealType
implementations) and we'd have to get crafty with thePriority
of thoseConverter
s.