STIR  6.2.0
decay_correction_factor.h
Go to the documentation of this file.
1 //
2 //
3 /*
4  Copyright (C) 2005- 2009, Hammersmith Imanet Ltd
5  This file is part of STIR.
6 
7  SPDX-License-Identifier: Apache-2.0
8 
9  See STIR/LICENSE.txt for details
10 */
11 #ifndef __stir_decay_correction_factor_H__
12 #define __stir_decay_correction_factor_H__
13 
23 #include "stir/common.h"
24 #include <cmath>
25 
26 START_NAMESPACE_STIR
27 
29 
35 inline double
36 decay_correction_factor(const double isotope_halflife, const double start_time, const double end_time)
37 {
38  assert(end_time - start_time > 0);
39  const double lambda = std::log(2.) / isotope_halflife;
40 
41  return std::fabs(lambda * (end_time - start_time)) < .01
42  ? std::exp(start_time * lambda) // if very short frame, we can ignore the duration
43  : lambda * (end_time - start_time) / (std::exp(-start_time * lambda) - std::exp(-end_time * lambda));
44 }
45 
47 
51 inline double
52 decay_correction_factor(const double isotope_halflife, const double rel_time)
53 {
54  return std::exp(rel_time * std::log(2.) / isotope_halflife);
55 }
56 
57 END_NAMESPACE_STIR
58 
59 #endif
double decay_correction_factor(const double isotope_halflife, const double rel_time)
Computes the decay-correction factor for activity at a given time point.
Definition: decay_correction_factor.h:52
basic configuration include file