Ticket #389 (closed defect: moved)

Opened 8 years ago

Last modified 6 years ago

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 7 years ago by bdezonia

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.

Last edited 7 years ago by bdezonia (previous) (diff)

comment:2 Changed 7 years ago 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 7 years ago by bdezonia

  • Blocking 1595 added
  • Milestone changed from imagej-2.0.0 to imagej-2.5.0

comment:4 Changed 6 years ago by bdezonia

The DataType classes support some of what we need here to avoid working in RealType.

comment:5 Changed 5 years ago by curtis

  • Status changed from new to closed
  • Resolution set to moved
Note: See TracTickets for help on using tickets.