tablekurve Class Reference

#include <imgclass.hpp>

Inheritance diagram for tablekurve:

Inheritance graph
base refererrect $classeichkurve.html 9,18 76,42
[legend]

List of all members.


Detailed Description

Simple table lookup eichkurve.

tablekurve reads in data files previously written by eichkurve::table_write() and uses the lookup table as the sole source for the conversion. It is used mainly as a means of caching, since computing lookup tables from complex function often lasts a bit and needs not be repeated for every run of the program.

Example:

        eichkurve *ek;
        char *eichtable="eichtabelle.dat";
        if (file_exists(eichtable)) {
          ek = new tablekurve(eichtabelle);
        } else {
          ek = new exp4kurve(0.978973*65535, 0.0366894, 0.147402, 
              0.636229, 9.74557, 0.735425, 0.157447, 0.0323291);
          // This innocent looking statement lasts several seconds, since it
          // computes the inverse of an exponential function
          ek->table_write(eichtable);
        }

This code example generates a lookup file if not already existent. In the latter case, it just loads the data from the file

Definition at line 609 of file imgclass.hpp.


Public Member Functions

 tablekurve (const char *fname) THROWSPEC
double eichfun (double x) const
 Calibration function, which will be inverted.
double deichfun_dx (double x) const
 Derivative of the calibration function.
double initguess (bild16::data_t val) const
 Starting point for the iteration.
double operator() (bild16::data_t val) const
 Conversion operator.
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"

Constructor & Destructor Documentation

tablekurve::tablekurve ( const char *  fname  ) 

Definition at line 540 of file imgclass.cpp.

References eichkurve::lookup, eichkurve::magic, and STHROW.


Member Function Documentation

double tablekurve::eichfun ( double  x  )  const [virtual]

Calibration function, which will be inverted.

Implements eichkurve.

Definition at line 559 of file imgclass.cpp.

References STHROW.

double tablekurve::deichfun_dx ( double  x  )  const [virtual]

Derivative of the calibration function.

Implements eichkurve.

Definition at line 563 of file imgclass.cpp.

References STHROW.

double tablekurve::initguess ( bild16::data_t  val  )  const [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.

Implements eichkurve.

Definition at line 568 of file imgclass.cpp.

References STHROW.

double eichkurve::operator() ( bild16::data_t  val  )  const [inline, inherited]

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 eichkurve::lookup.

void eichkurve::table_write ( const char *  name  )  const [inherited]

Write the lookup table to a file.

Definition at line 462 of file imgclass.cpp.

References eichkurve::lookup, and eichkurve::magic.

double eichkurve::fsolve ( bild16::data_t  val,
double  hmin,
double  hmax 
) const [protected, inherited]

Definition at line 388 of file imgclass.cpp.

References abs(), eichkurve::eichfun(), and signum().

Referenced by eichkurve::table_init().

void eichkurve::table_init ( double  hmin,
double  hmax 
) [protected, inherited]

Definition at line 380 of file imgclass.cpp.

References eichkurve::fsolve(), and eichkurve::lookup.

Referenced by exp4kurve::exp4kurve(), and expkurve::expkurve().


Member Data Documentation

const char eichkurve::magic = "EICHTABELLE" [static, protected, inherited]

Definition at line 506 of file imgclass.hpp.

Referenced by eichkurve::table_write(), and tablekurve().

double* eichkurve::lookup [protected, inherited]


The documentation for this class was generated from the following files:

Generated on Fri Jul 24 12:49:18 2009 for Xgrayimg Library by  doxygen 1.5.5