Page MenuHomePhabricator

ProportionalTimeGeometry::TimeStepToTimePoint incorrect implemented for FirstTimePoint <= 0.0
Closed, ResolvedPublic

Description

mitk::ProportionalTimeGeometry::TimeStepToTimePoint( TimeStepType timeStep)
returns the passed timestep as timepoint when m_FirstTimePoint == 0.0 instead of relay converting it.

This leads to wrong conversion outputs for all time series that starts at <=~0.0.

Reason is the wrong usage of "std::numeric_limits<TimePointType>::min()" (Line 74, mitkProportionalTimeGeometry.cpp).

std::numeric_limits<double>::min() is not the smallest negative value (as assumed in the if statement; this goes only for integers). It is defined as the smallest positive value of the type (thus its max resolution).

In C++11 we have std::numeric_limits<double>::lower() in C++99 we must use other trait informations:
e.g.

BOOST: bounds<double>::lowest():: http://www.boost.org/doc/libs/1_38_0/libs/numeric/conversion/doc/html/boost_numericconversion/bounds___traits_class.html

or

ITK: itk::NumericTraits<double>::NonpositiveMin()

Event Timeline

bug fix proposal added via git hub pull request.

The solution look good. I will integrate the patch today. Right now it is not possible because our dashboard is locked.

User metzger has pushed new remote branch:

bug-17520-CorrectLimitationOfFirstTimePoint

[79b066]: Merge branch 'bug-17520-CorrectLimitationOfFirstTimePoint'

Merged commits:

2014-03-23 22:09:23 Ralf Floca [1538ae]

  • fixed T17520
  • kept min() (minimal positive values) for m_StepDuration check, because negative or zero duration makes no sense

Signed-off-by: Ralf Floca <r.floca@dkfz-heidelberg.de>