STIR 6.4.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__
22
23#include "stir/common.h"
24#include <cmath>
25
26START_NAMESPACE_STIR
27
29
35inline double
36decay_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
51inline double
52decay_correction_factor(const double isotope_halflife, const double rel_time)
53{
54 return std::exp(rel_time * std::log(2.) / isotope_halflife);
55}
56
57END_NAMESPACE_STIR
58
59#endif
basic configuration include file
double decay_correction_factor(const double isotope_halflife, const double start_time, const double end_time)
Compute decay-correction factor for a time frame.
Definition decay_correction_factor.h:36