imgclass.hpp File Reference

#include <iostream>
#include <valarray>
#include <string>
#include <sstream>
#include "matrixutil.hpp"
#include "vc6compat.h"

Include dependency graph for imgclass.hpp:

base refererrect $matrixutil_8hpp.html 325,198 410,222rect $vc6compat_8h.html 325,246 410,270

This graph shows which files directly or indirectly include this file:

base refererrect $xgrayimg_8hpp.html 650,33 909,57rect $stdalgorithm_8hpp.html 325,57 600,81rect $xgray__tcl_8hpp.html 650,107 909,130rect $guithread_8cpp.html 960,132 1218,156rect $imgclass_8cpp.html 333,206 592,230

Go to the source code of this file.

Classes

class  imgbase< s_x, s_y, T >
 Base class for images. More...
class  bild16
 Class that deals with 16bit grayscale images from the X-ray device. More...
struct  bild16::header_t
 Header data structure of HIS files. More...
class  rawfloat
 Stream output manipulator for writing binary floats. More...
class  irawfloat
 Stream input manipulator for reading binary floats. More...
class  eichkurve
 Base class for calibration function. More...
class  expkurve
 Multi-exponential decay with 3 timescales. More...
class  exp4kurve
 Multi-exponential decay with 4 timescales. More...
class  tablekurve
 Simple table lookup eichkurve. More...
class  flatkurve
 linear transform eichkurve, deprecated More...
class  bildfloat
 Class that stores intensities as floats. More...
class  interpol
 Deprecated pixel by pixel interpolation between individual reference images. More...
class  QRfit
 Polynomial fit to correct pixel differences. More...

Defines

#define TRACE(x)
 Trace macros not yet implemented.
#define TRACEX(x, y)
#define STHROW(msg)
 Throw exceptions.
#define THROWSPEC   throw(std::string)
#define MAP(img)
 MAP iterates over an image.
#define MAP_CIRCLE(img, radius)
 Iterate over the area of a circle centered in the image.
#define MAP_REGION(region)   MAP(region) if (region(y,x))
 Iterate over the image, cover only points contained in region.
#define MAP_CIRCLE_XY(img, radius, xm, ym)
 Iterate over the area of a circle centered at xm, ym.
#define MAPF(img, Functor)   MAP(img) { Functor(img(y,x)); }
 call a function or functor for every point in the image
#define MAPFXY(img, Functor)   MAP(img) { Functor(x, y, img(y,x)); }
 call a function or functor for every point in the image

Typedefs

typedef imgbase
< 512, 512, unsigned short > 
bild16_base
 Instantiation of imgbase for raw X-ray images (16bit).
typedef imgbase< 512, 512, bool > region_base
 Base class for region_t.
typedef region_base region_t
 Regions on an X-ray image.
typedef imgbase< 512, 512, float > bildfloat_base
 bildfloat_base is the base class for bildfloat derived from imgbase
typedef std::valarray< float > lut
typedef imgbase< 512, 512, lutinterpol_base

Functions

template<typename T>
SQR (T x)
 Simple template function to square the input argument, used everywhere.
template<int s_x, int s_y, typename T>
average (const imgbase< s_x, s_y, T > &img)


Define Documentation

#define MAP ( img   ) 

Value:

for (int y=0; y<img.SIZEY; y++) \
                  for (int x=0; x<img.SIZEX; x++)
MAP iterates over an image.

An often used pattern is to iterate over the hole image in scanline-order. This is accomplished by two nested for-loops. It makes the code somewhat clearer, if one uses these macros instead of directly writing out the loops.

Example:

      bild16 rb("Test.his");
      long sum=0;
      MAP (rb) { 
        sum+=rb(y,x);
      } 

Definition at line 55 of file imgclass.hpp.

Referenced by bildfloat::apply_eichkurve(), bild16::bild16(), bildcomplex::bildcomplex(), bildfloat::bildfloat(), bildcomplex::decompose(), execute_region(), bildfloat::from_bild16(), bild16::fromfloat(), getimage(), getimage_contrast(), bildcomplex::Hamming_unwindow(), bildcomplex::Hamming_window(), bildcomplex::norm(), imgbase< s_x, s_y, T >::operator*=(), imgbase< s_x, s_y, T >::operator+=(), imgbase< s_x, s_y, T >::operator-=(), imgbase< s_x, s_y, T >::operator/=(), and imgbase< s_x, s_y, T >::operator=().

#define MAP_CIRCLE ( img,
radius   ) 

Value:

MAP(img) \
                     if (SQR(x-img.SIZEX/2)+ SQR(y-img.SIZEY/2) <= SQR(radius))
Iterate over the area of a circle centered in the image.

MAP_CIRCLE does the same like MAP, except that it includes only points that are inside a circle of radius radius

Definition at line 61 of file imgclass.hpp.

#define MAP_CIRCLE_XY ( img,
radius,
xm,
ym   ) 

Value:

for (int y=ym-radius; y<=ym+radius; y++) \
                  for (int x=xm-radius; x<=xm+radius; x++) \
                     if ((x>=0) && (x<img.SIZEX) && (y>=0) && (y<img.SIZEY)) \
                      if (SQR(x-xm)+ SQR(y-ym) <= SQR(radius))
Iterate over the area of a circle centered at xm, ym.

MAP_CIRCLE_XY does the same like MAP, except that it includes only points that are inside a circle of radius radius

Definition at line 72 of file imgclass.hpp.

#define MAP_REGION ( region   )     MAP(region) if (region(y,x))

Iterate over the image, cover only points contained in region.

MAP_REGION does the same like MAP, except that it includes only points that are set in the region

Definition at line 67 of file imgclass.hpp.

#define MAPF ( img,
Functor   )     MAP(img) { Functor(img(y,x)); }

call a function or functor for every point in the image

MAPF runs the Functor argument on every point in the image img This maybe useful with functors such as hydrodynamic sum or so.

Definition at line 83 of file imgclass.hpp.

#define MAPFXY ( img,
Functor   )     MAP(img) { Functor(x, y, img(y,x)); }

call a function or functor for every point in the image

Same as MAPF, but hands the coordinates to the functor, too. The functor must accept three arguments: Coordinates x and y and the value of the image at that position

Definition at line 89 of file imgclass.hpp.

#define STHROW ( msg   ) 

Value:

{ \
         std::ostringstream err;\
         err<<msg; \
         throw err.str(); }
Throw exceptions.

This macro allows to conveniently throw exceptions with parameters. It inserts the argument into a strinstream so it is easy to compose the error message from parts. For example:

    try {
    std::cerr<<"Da kommt jetzt was\n";
    int a=5;
    STHROW("Something awkward happens for a="<<a<<" !");
  } catch (std::string& s) {
    std::cerr<<"Error: "<<s<<std::endl;
  }

Definition at line 31 of file imgclass.hpp.

Referenced by bildfloat::convolve(), tablekurve::deichfun_dx(), bild16::drawx(), bild16::drawy(), tablekurve::eichfun(), Parabelzentrum::estimate(), QRfit::get_coeff(), getimage_contrast(), getminmax(), tablekurve::initguess(), bild16::kreuz(), Parabelzentrum::operator()(), QRfit::read(), bildfloat::read_gnuplot(), bild16::read_his(), bild16::read_pgm(), tablekurve::tablekurve(), Voronoischnitt::Voronoischnitt(), bild16::write_his(), and bild16::write_pgm8_bounds().

#define THROWSPEC   throw(std::string)

Definition at line 36 of file imgclass.hpp.

#define TRACE (  ) 

Trace macros not yet implemented.

Definition at line 12 of file imgclass.hpp.

Referenced by QR().

#define TRACEX ( x,
 ) 

Definition at line 13 of file imgclass.hpp.

Referenced by QR().


Typedef Documentation

typedef imgbase<512,512,unsigned short> bild16_base

Instantiation of imgbase for raw X-ray images (16bit).

Definition at line 341 of file imgclass.hpp.

typedef imgbase<512, 512, float> bildfloat_base

bildfloat_base is the base class for bildfloat derived from imgbase

Definition at line 656 of file imgclass.hpp.

typedef imgbase<512, 512, lut> interpol_base

Definition at line 741 of file imgclass.hpp.

typedef std::valarray<float> lut

Definition at line 740 of file imgclass.hpp.

typedef imgbase<512,512,bool> region_base

Base class for region_t.

Definition at line 648 of file imgclass.hpp.

Regions on an X-ray image.

region_t is currently only a typedef to the basic imageclass holding booleans. Later on there may come additional member functions like file I/O. Regions are heavily used in image processing algorithm like floodfill. Another good application could be badpixel masks, which are currently implemented as bild16

Definition at line 654 of file imgclass.hpp.


Function Documentation

template<int s_x, int s_y, typename T>
T average ( const imgbase< s_x, s_y, T > &  img  )  [inline]

Template function that tries to average the whole image. It doesn't work for integer based imgbase (because the integer may overflow relatively fast) and should therefore not be used. Try a functor instead and use MAP:

        bild16 test;
        long sum=0;
        MAP (test) {
          sum+=test(y,x);
        }

        sum/=test.SIZEX*test.SIZEY;

Definition at line 331 of file imgclass.hpp.

template<typename T>
T SQR ( x  )  [inline]

Simple template function to square the input argument, used everywhere.

Definition at line 95 of file imgclass.hpp.


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