Resolve the half-life: use the caller-supplied value if finite, otherwise fall back to item 0 of the Radiopharmaceutical Information Sequence. Returns NaN if neither source yields a half-life. Multi-tracer callers should always supply the resolved half-life explicitly so the selection matches their tracer-index choice.
| 558 | // callers should always supply the resolved half-life explicitly so the |
| 559 | // selection matches their tracer-index choice. |
| 560 | double ResolveHalfLifeSeconds(const mitk::IPropertyProvider* provider, |
| 561 | double providedHalfLifeSeconds) |
| 562 | { |
| 563 | if (std::isfinite(providedHalfLifeSeconds) && providedHalfLifeSeconds > 0.0) |
| 564 | { |
| 565 | return providedHalfLifeSeconds; |
| 566 | } |
| 567 | const auto infos = mitk::GetRadiopharmaceuticalInfos(provider); |
| 568 | if (infos.empty()) |
| 569 | { |
| 570 | return std::numeric_limits<double>::quiet_NaN(); |
| 571 | } |
| 572 | return infos[0].halfLifeSeconds; |
| 573 | } |
| 574 | } |
| 575 | |
| 576 | // "Step 1" .. "Step 4" in the comments below refer to the canonical |
no test coverage detected