Ticket #389 (closed defect: moved)
Opened 2011-03-22T15:59:28-05:00
Last modified 2013-08-27T15:16:04-05:00
Be able to pull data out of a Dataset without precision loss
Reported by: | bdezonia | Owned by: | bdezonia |
---|---|---|---|
Priority: | major | Milestone: | imagej-2.5.0 |
Component: | Data Model | Version: | |
Severity: | serious | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | #1595 |
Description
In the long run it would be nice to pull numbers out of a Dataset at a given location. At the time this ticket was written there is a method in Dataset called getDoubleValue() that can do this. And it may have made its way into the ProbeTool. However using this method would result in some precision loss if the backing image is of type long. Come up with a way to pull numbers out of Imglib images and/or Datasets that can keep from losing precision.
Change History
comment:1 Changed 2012-03-07T16:01:19-06:00 by bdezonia
comment:2 Changed 2012-03-14T14:07:46-05:00 by bdezonia
If we do worry about it you can extend RealType in Imglib. Each type would implement things like:
- byte byteValue();
- long longValue();
- float floatValue();
This is similar to the Number abstract class.
Then API users can query of the type to see if its integer or real and use appropriate methods. Plus we'd need to provide integral analogues to type.getMaxValue() and type.getMinValue() (like getMaxIntegralValue(), etc.)
comment:3 Changed 2012-12-06T11:46:14-06:00 by bdezonia
- Blocking 1595 added
- Milestone changed from imagej-2.0.0 to imagej-2.5.0
comment:4 Changed 2013-08-27T15:16:04-05:00 by bdezonia
The DataType classes support some of what we need here to avoid working in RealType.
comment:5 Changed 2014-05-14T16:59:19-05:00 by curtis
- Status changed from new to closed
- Resolution set to moved
I think that doubles can represent the middle 252 integers in the long range exactly. We might not need to worry about this as long as we make it clear to users.