#include <imgclass.hpp>
This class is used for almost everything, that deals with x-ray images. It can read and write gnuplot binary datafiles for easy 3d-Plots. Different correction mechanisms are implemented. You should use this class as the basis representation for your calculations
Definition at line 667 of file imgclass.hpp.
Public Types | |
typedef float | data_t |
The base data type, for convenience. | |
Public Member Functions | |
bildfloat () | |
Standard constructor. | |
bildfloat (const bild16 &aufnahme, const eichkurve &ek) | |
Constructor from a bild16 via eichkurve. Deprecated. | |
bildfloat (const bild16 &aufnahme) | |
Constructor from a bild16. You should use this. | |
bildfloat (const region_t ®io) | |
Constructs a black&white representation of a region. | |
bildfloat (const char *name) | |
Constructs an image from a gnuplot binary file. | |
~bildfloat () | |
void | write_gnuplot (const char *name) const |
Write the image as a gnuplot binary file. | |
bildfloat & | read_gnuplot (const char *name) THROWSPEC |
Read a gnuplot binary file. | |
bildfloat & | from_bild16 (const bild16 &aufnahme, const eichkurve &ek) |
Copy from a bild16 via eichkurve. Deprecated. | |
bildfloat & | from_bild16 (const bild16 &aufnahme) |
Copy normalized data from a bild16. | |
bildfloat & | apply_eichkurve (const eichkurve &ek) |
Apply the eichkurve ek to the image data. | |
bildfloat & | convolve (const float *kernel, int sx, int sy, bool normalize=true) const THROWSPEC |
Convolve the image with a user-specified kernel. | |
bildfloat & | gaussian (float radius) |
Convolve the image with a gaussian. | |
void | shutter_detect (int &y0, int &y1, float thresh, int radius) const |
Detect ,,Shutter'' deficiency. Deprecated. | |
bildfloat & | shutter_correct (int y0, int y1, float shadefactor) |
Correct ,,Shutter'' deficiency. Deprecated. | |
bildfloat & | gamma_correct (const bildfloat &gammabild) |
Gamma-correction for every pixel. Deprecated. | |
bildfloat & | bquad_correct (const bildfloat &bquadbild) |
Parabola correction for every pixel. Deprecated. | |
bildfloat & | polyfit_correct (const QRfit &korrektor) |
Correct with date from polynomial fit. Use this as the standard correction. | |
bildfloat & | badpix_correct (const bild16 &bpmap, bild16::data_t threshold=bild16::intensity_max/2) |
Bad-pixel correction. | |
bildfloat & | mask (const region_t ®) |
Mask the image with the binary mask reg. | |
float & | operator() (int y, int x) |
Element extraction operator. | |
const float & | operator() (int y, int x) const |
Constant element extraction operator. | |
imgbase< s_x, s_y, float > & | operator/= (const imgbase< s_x, s_y, float > &what) |
Arithmetic operator. | |
imgbase< s_x, s_y, float > & | operator/= (const float &what) |
Arithmetic operator. | |
imgbase< s_x, s_y, float > & | operator*= (const imgbase< s_x, s_y, float > &what) |
Arithmetic operator. | |
imgbase< s_x, s_y, float > & | operator*= (const float &what) |
Arithmetic operator. | |
imgbase< s_x, s_y, float > & | operator-= (const imgbase< s_x, s_y, float > &what) |
Arithmetic operator. | |
imgbase< s_x, s_y, float > & | operator-= (const float &what) |
Arithmetic operator. | |
imgbase< s_x, s_y, float > & | operator+= (const imgbase< s_x, s_y, float > &what) |
Arithmetic operator. | |
imgbase< s_x, s_y, float > & | operator+= (const float &what) |
Arithmetic operator. | |
Public Attributes | |
const int | SIZEX |
save the s_x template parameter | |
const int | SIZEY |
save the s_y template parameter | |
Static Public Attributes | |
static const float | pix_size = static_cast<float>(1606.0 / 1765 * 0.4) |
Diameter of a pixel in millimeters. | |
Protected Attributes | |
data_t ** | bild |
The base data type, for convenience.
You can use this typedef
to extract the type of the elements from the derived classes.
Example:
bild16::data_t temp;
Definition at line 123 of file imgclass.hpp.
bildfloat::bildfloat | ( | ) | [inline] |
Standard constructor.
Constructs an empty image. Pixels are not cleared (set to zero).
Definition at line 715 of file imgclass.hpp.
Constructor from a bild16 via eichkurve. Deprecated.
Construct a bildfloat by looking up every pixel of the bild16 aufnahme in ek. Since pixel by pixel correction usually needs to be applied, use of this method is discouraged
Definition at line 725 of file imgclass.hpp.
References from_bild16().
bildfloat::bildfloat | ( | const bild16 & | aufnahme | ) | [inline] |
Constructor from a bild16. You should use this.
Construct the bildfloat image from bild16 aufnahme by normalizing the range to [0..1]
Definition at line 732 of file imgclass.hpp.
References from_bild16().
bildfloat::bildfloat | ( | const region_t & | regio | ) |
bildfloat::bildfloat | ( | const char * | name | ) | [inline] |
Constructs an image from a gnuplot binary file.
Construct a bildfloat image from a gnuplot binary file. See read_gnuplot for details
Definition at line 718 of file imgclass.hpp.
References read_gnuplot().
bildfloat::~bildfloat | ( | ) | [inline] |
Definition at line 738 of file imgclass.hpp.
void bildfloat::write_gnuplot | ( | const char * | name | ) | const |
Write the image as a gnuplot binary file.
Definition at line 592 of file imgclass.cpp.
References pix_size, imgbase< 512, 512, float >::SIZEX, and imgbase< 512, 512, float >::SIZEY.
bildfloat & bildfloat::read_gnuplot | ( | const char * | name | ) |
Read a gnuplot binary file.
Definition at line 610 of file imgclass.cpp.
References imgbase< 512, 512, float >::SIZEX, imgbase< 512, 512, float >::SIZEY, and STHROW.
Referenced by bildfloat().
Copy from a bild16 via eichkurve. Deprecated.
Definition at line 639 of file imgclass.cpp.
References imgbase< 512, 512, float >::bild, and MAP.
Referenced by bildfloat().
Copy normalized data from a bild16.
Definition at line 632 of file imgclass.cpp.
References imgbase< 512, 512, float >::bild, bild16::intensity_max, and MAP.
Apply the eichkurve ek to the image data.
This function computes the height of the fluid from the intensity values.
Definition at line 750 of file imgclass.cpp.
References bild16::intensity_max, bild16::intensity_min, and MAP.
bildfloat & bildfloat::convolve | ( | const float * | kernel, | |
int | sx, | |||
int | sy, | |||
bool | normalize = true | |||
) | const |
Convolve the image with a user-specified kernel.
FIXME returning heap object gives rise to a memory leak
Definition at line 808 of file imgclass.cpp.
References norm(), imgbase< 512, 512, float >::SIZEX, imgbase< 512, 512, float >::SIZEY, and STHROW.
Referenced by gaussian().
bildfloat & bildfloat::gaussian | ( | float | radius | ) |
Convolve the image with a gaussian.
FIXME SLOW implementation. Gaussian is separable!
Definition at line 846 of file imgclass.cpp.
References convolve(), and SQR.
void bildfloat::shutter_detect | ( | int & | y0, | |
int & | y1, | |||
float | thresh, | |||
int | radius | |||
) | const |
Detect ,,Shutter'' deficiency. Deprecated.
Definition at line 761 of file imgclass.cpp.
References imgbase< 512, 512, float >::SIZEX, imgbase< 512, 512, float >::SIZEY, and SQR.
bildfloat & bildfloat::shutter_correct | ( | int | y0, | |
int | y1, | |||
float | shadefactor | |||
) |
Gamma-correction for every pixel. Deprecated.
Deprecated function, do not use it. Use polyfit_correct and the QRfit object to correct different nonlinear sensitivites of the pixels
Definition at line 696 of file imgclass.cpp.
References imgbase< 512, 512, float >::SIZEX, and imgbase< 512, 512, float >::SIZEY.
Parabola correction for every pixel. Deprecated.
Deprecated function, do not use it. Use polyfit_correct and the QRfit object to correct different nonlinear sensitivites of the pixels
Definition at line 716 of file imgclass.cpp.
References imgbase< 512, 512, float >::SIZEX, imgbase< 512, 512, float >::SIZEY, and SQR.
Correct with date from polynomial fit. Use this as the standard correction.
Apply the correction represented by the QRfit object korrektor to every pixel in the image. This correction should be used for every image, together with badpixel correction to get maximum accuracy.
Definition at line 738 of file imgclass.cpp.
References imgbase< 512, 512, float >::SIZEX, and imgbase< 512, 512, float >::SIZEY.
bildfloat & bildfloat::badpix_correct | ( | const bild16 & | bpmap, | |
bild16::data_t | threshold = bild16::intensity_max/2 | |||
) |
Bad-pixel correction.
This function tries to eliminate the influence of so called bad pixels from the image. The input is a bild16, where every pixel considered bad is set to some value higher than threshold. Eventually, this will accept a region_t also in the future. 16bit bad pixel maps have been used only for compatibility with the existing commercial HIS software.
The information at the location of bad pixels is discarded, and a simple algorithm fills in linear interpolation from the 8 neighbouring pixels. If all of those are bad, too, set the pixel value to zero. Should never happen.
Definition at line 656 of file imgclass.cpp.
References GOODPIX, imgbase< 512, 512, float >::SIZEX, and imgbase< 512, 512, float >::SIZEY.
Mask the image with the binary mask reg.
Definition at line 866 of file imgclass.cpp.
References NaN::fnan, imgbase< 512, 512, float >::SIZEX, and imgbase< 512, 512, float >::SIZEY.
float & imgbase< s_x, s_y, float >::operator() | ( | int | y, | |
int | x | |||
) | [inline, inherited] |
Element extraction operator.
Parenthesis are used to index a pixel of the image. This idea is borrowed from the octave C++ interface. The order of the arguments is y, x. This order should imitate the old C way in order not to confuse people from EP~V
Definition at line 138 of file imgclass.hpp.
const float & imgbase< s_x, s_y, float >::operator() | ( | int | y, | |
int | x | |||
) | const [inline, inherited] |
imgbase<s_x, s_y, float >& imgbase< s_x, s_y, float >::operator/= | ( | const imgbase< s_x, s_y, float > & | what | ) | [inherited] |
Arithmetic operator.
This operator divides every pixel of the image by the corresponding value in what. It leaves the value unchanged if the denominator is zero, thus avoiding division by zero
imgbase<s_x, s_y, float >& imgbase< s_x, s_y, float >::operator/= | ( | const float & | what | ) | [inherited] |
Arithmetic operator.
This operator divides every pixel by the constant value what
imgbase<s_x, s_y, float >& imgbase< s_x, s_y, float >::operator*= | ( | const imgbase< s_x, s_y, float > & | what | ) | [inherited] |
Arithmetic operator.
This operator multiplies every pixel of the image by the corresponding value in what.
imgbase<s_x, s_y, float >& imgbase< s_x, s_y, float >::operator*= | ( | const float & | what | ) | [inherited] |
Arithmetic operator.
This operator multiplies every pixel by the constant value what
imgbase<s_x, s_y, float >& imgbase< s_x, s_y, float >::operator-= | ( | const imgbase< s_x, s_y, float > & | what | ) | [inherited] |
Arithmetic operator.
This operator subtracts every pixel of what from the corresponding value in the image.
imgbase<s_x, s_y, float >& imgbase< s_x, s_y, float >::operator-= | ( | const float & | what | ) | [inherited] |
Arithmetic operator.
This operator subtracts the constant value what from every pixel in the image
imgbase<s_x, s_y, float >& imgbase< s_x, s_y, float >::operator+= | ( | const imgbase< s_x, s_y, float > & | what | ) | [inherited] |
Arithmetic operator.
This operator adds every pixel in what to the corresponding pixel value in the image
imgbase<s_x, s_y, float >& imgbase< s_x, s_y, float >::operator+= | ( | const float & | what | ) | [inherited] |
Arithmetic operator.
This operator adds the constant value what to every pixel in the image
const float bildfloat::pix_size = static_cast<float>(1606.0 / 1765 * 0.4) [static] |
Diameter of a pixel in millimeters.
Definition at line 681 of file imgclass.hpp.
Referenced by write_gnuplot().
save the s_x template parameter
Definition at line 126 of file imgclass.hpp.
Referenced by badpix_correct(), bquad_correct(), convolve(), gamma_correct(), mask(), polyfit_correct(), read_gnuplot(), shutter_detect(), and write_gnuplot().
save the s_y template parameter
Definition at line 129 of file imgclass.hpp.
Referenced by badpix_correct(), bquad_correct(), convolve(), gamma_correct(), mask(), polyfit_correct(), read_gnuplot(), shutter_detect(), and write_gnuplot().
The real data storage. Should not be used by derived classes
Definition at line 161 of file imgclass.hpp.
Referenced by from_bild16().