#include <imgclass.hpp>
An eichkurve stores a 64k lookup table to do fast conversion from intensities to other quantities, such as height or concentration. It is an abstract base class that implements Newtons method and basic memory management as well as writing the lookup table to a file [table_write()]. Use the derived class tablekurve to read and use such datafiles.
If you derive this class and want to use the Newton iteration for the inversion of the calibration function, you need to implement
and call table_init() to start the iteration. Because this can take some time, you may want to store the lookup table in a file by calling table_write() from an instance and then use tablekurve for subsequent conversions which should load considerably faster.Definition at line 488 of file imgclass.hpp.
Public Member Functions | |
eichkurve () | |
virtual | ~eichkurve () |
double | operator() (bild16::data_t val) const |
Conversion operator. | |
virtual double | eichfun (double x) const =0 |
Calibration function, which will be inverted. | |
virtual double | deichfun_dx (double x) const =0 |
Derivative of the calibration function. | |
virtual double | initguess (bild16::data_t val) const =0 |
Starting point for the iteration. | |
void | table_write (const char *name) const |
Write the lookup table to a file. | |
Protected Member Functions | |
double | fsolve (bild16::data_t val, double hmin, double hmax) const |
void | table_init (double hmin, double hmax) |
Protected Attributes | |
double * | lookup |
Static Protected Attributes | |
static const char | magic [] = "EICHTABELLE" |
eichkurve::eichkurve | ( | ) |
eichkurve::~eichkurve | ( | ) | [virtual] |
double eichkurve::operator() | ( | bild16::data_t | val | ) | const [inline] |
Conversion operator.
The function evaluation operator looks up an element in the lookup table and returns it. Initially, it was meant for usage such as:
tablekurve tk("somecalib.data"); bild16 bild("someimage.his"); bildfloat bfl; MAP(bild) { bfl(y,x)=tk(bild(y,x)); }
But because of point-wise float corrections necessary to overcome the deficiencies of the detector, it must now be applied to floating point images. bildfloat features a special member function for this purpose.
Definition at line 530 of file imgclass.hpp.
References lookup.
virtual double eichkurve::eichfun | ( | double | x | ) | const [pure virtual] |
Calibration function, which will be inverted.
Implemented in expkurve, exp4kurve, tablekurve, and flatkurve.
Referenced by fsolve().
virtual double eichkurve::deichfun_dx | ( | double | x | ) | const [pure virtual] |
Derivative of the calibration function.
Implemented in expkurve, exp4kurve, tablekurve, and flatkurve.
virtual double eichkurve::initguess | ( | bild16::data_t | val | ) | const [pure virtual] |
Starting point for the iteration.
The implementation of initguess must return a starting value that triggers convergence to the solution. Otherwise table_init may hang.
Implemented in expkurve, exp4kurve, tablekurve, and flatkurve.
void eichkurve::table_write | ( | const char * | name | ) | const |
double eichkurve::fsolve | ( | bild16::data_t | val, | |
double | hmin, | |||
double | hmax | |||
) | const [protected] |
Definition at line 388 of file imgclass.cpp.
References abs(), eichfun(), and signum().
Referenced by table_init().
void eichkurve::table_init | ( | double | hmin, | |
double | hmax | |||
) | [protected] |
Definition at line 380 of file imgclass.cpp.
References fsolve(), and lookup.
Referenced by exp4kurve::exp4kurve(), and expkurve::expkurve().
const char eichkurve::magic = "EICHTABELLE" [static, protected] |
Definition at line 506 of file imgclass.hpp.
Referenced by table_write(), and tablekurve::tablekurve().
double* eichkurve::lookup [protected] |
Definition at line 507 of file imgclass.hpp.
Referenced by eichkurve(), flatkurve::flatkurve(), operator()(), table_init(), table_write(), tablekurve::tablekurve(), and ~eichkurve().