#include <imgclass.hpp>
This class does everything you should ever need for operation with sampled 16bit images from the X-ray device. It features basic I/O operation (can read and write HIS files), reads and writes PGM grayscale images (8bit as well as 16bit) and has functions for drawing vertical and horizontal lines (drawx(), drawy()). However, it is not meant mainly for processing the image. Use bildfloat for this purpose.
Definition at line 353 of file imgclass.hpp.
Public Types | |
typedef unsigned short | data_t |
The base data type, for convenience. | |
Public Member Functions | |
bild16 (const char *fname=NULL) THROWSPEC | |
bild16 (unsigned short *data) THROWSPEC | |
~bild16 () | |
void | write_pgm16 (const char *name) const |
Write image as PGM 16 bit file. | |
void | write_pgm8 (const char *name) const |
Write image as PGM 8 bit file. | |
void | write_pgm8_bounds (const char *name, bild16::data_t low, bild16::data_t high) const |
Write image as PGM 8 bit file, determine contrast. | |
bild16 & | read_his (const char *name) THROWSPEC |
Read HIS file (single image). | |
void | write_his (const char *name) const |
Write image as HIS file. | |
bild16 & | read_pgm (const char *name) THROWSPEC |
Read PGM file. Must match dimension and be either 8bit or 16bit. | |
bild16 & | og_correct (const bild16 &offset, const bild16 &gain) |
Do integer offset-gain correction. Deprecated. | |
bild16 & | drawx (int x, int y1, int y2) THROWSPEC |
Draw a vertical line. | |
bild16 & | drawy (int y, int x1, int x2) THROWSPEC |
Draw a horizontal line. | |
bild16 & | kreuz (int x, int y) THROWSPEC |
Draw a cross centered at (x,y). | |
void | fromfloat (const bildfloat &bf, float max=1.0) |
Convert from bildfloat. | |
bild16 & | operator= (const bild16 &b) |
Assignemnt copy operator. | |
unsigned short & | operator() (int y, int x) |
Element extraction operator. | |
const unsigned short & | operator() (int y, int x) const |
Constant element extraction operator. | |
imgbase< s_x, s_y, unsigned short > & | operator/= (const imgbase< s_x, s_y, unsigned short > &what) |
Arithmetic operator. | |
imgbase< s_x, s_y, unsigned short > & | operator/= (const unsigned short &what) |
Arithmetic operator. | |
imgbase< s_x, s_y, unsigned short > & | operator*= (const imgbase< s_x, s_y, unsigned short > &what) |
Arithmetic operator. | |
imgbase< s_x, s_y, unsigned short > & | operator*= (const unsigned short &what) |
Arithmetic operator. | |
imgbase< s_x, s_y, unsigned short > & | operator-= (const imgbase< s_x, s_y, unsigned short > &what) |
Arithmetic operator. | |
imgbase< s_x, s_y, unsigned short > & | operator-= (const unsigned short &what) |
Arithmetic operator. | |
imgbase< s_x, s_y, unsigned short > & | operator+= (const imgbase< s_x, s_y, unsigned short > &what) |
Arithmetic operator. | |
imgbase< s_x, s_y, unsigned short > & | operator+= (const unsigned short &what) |
Arithmetic operator. | |
Public Attributes | |
header_t * | file_header |
const int | SIZEX |
save the s_x template parameter | |
const int | SIZEY |
save the s_y template parameter | |
Static Public Attributes | |
static const data_t | intensity_max = 0xFFFF |
Maximum possible intensity, representing white. | |
static const data_t | intensity_min = 0x0000 |
Minimum possible intensity, representing black. | |
Protected Attributes | |
data_t ** | bild |
Static Private Attributes | |
static const std::streamoff | HIS_START = 100 |
Classes | |
struct | header_t |
Header data structure of HIS files. More... |
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.
bild16::bild16 | ( | const char * | fname = NULL |
) |
Definition at line 35 of file imgclass.cpp.
bild16::bild16 | ( | unsigned short * | data | ) |
bild16::~bild16 | ( | ) |
void bild16::write_pgm16 | ( | const char * | name | ) | const |
Write image as PGM 16 bit file.
Definition at line 89 of file imgclass.cpp.
References imgbase< 512, 512, unsigned short >::bild, intensity_max, imgbase< 512, 512, unsigned short >::SIZEX, and imgbase< 512, 512, unsigned short >::SIZEY.
Referenced by main().
void bild16::write_pgm8 | ( | const char * | name | ) | const |
Write image as PGM 8 bit file.
Definition at line 106 of file imgclass.cpp.
References imgbase< 512, 512, unsigned short >::bild, imgbase< 512, 512, unsigned short >::SIZEX, and imgbase< 512, 512, unsigned short >::SIZEY.
void bild16::write_pgm8_bounds | ( | const char * | name, | |
bild16::data_t | low, | |||
bild16::data_t | high | |||
) | const |
Write image as PGM 8 bit file, determine contrast.
Definition at line 122 of file imgclass.cpp.
References imgbase< 512, 512, unsigned short >::SIZEX, imgbase< 512, 512, unsigned short >::SIZEY, and STHROW.
bild16 & bild16::read_his | ( | const char * | name | ) |
Read HIS file (single image).
FIXME ENDIAN-Problem
Definition at line 144 of file imgclass.cpp.
References imgbase< 512, 512, unsigned short >::bild, file_header, HIS_START, imgbase< 512, 512, unsigned short >::SIZEX, imgbase< 512, 512, unsigned short >::SIZEY, and STHROW.
void bild16::write_his | ( | const char * | name | ) | const |
Write image as HIS file.
FIXME ENDIAN-Problem
Definition at line 164 of file imgclass.cpp.
References imgbase< 512, 512, unsigned short >::bild, file_header, HIS_START, imgbase< 512, 512, unsigned short >::SIZEX, imgbase< 512, 512, unsigned short >::SIZEY, and STHROW.
bild16 & bild16::read_pgm | ( | const char * | name | ) |
Read PGM file. Must match dimension and be either 8bit or 16bit.
Definition at line 242 of file imgclass.cpp.
References imgbase< 512, 512, unsigned short >::SIZEX, imgbase< 512, 512, unsigned short >::SIZEY, and STHROW.
Do integer offset-gain correction. Deprecated.
Definition at line 306 of file imgclass.cpp.
References imgbase< 512, 512, unsigned short >::bild, clip(), intensity_max, imgbase< 512, 512, unsigned short >::SIZEX, and imgbase< 512, 512, unsigned short >::SIZEY.
bild16 & bild16::drawx | ( | int | x, | |
int | y1, | |||
int | y2 | |||
) |
Draw a vertical line.
Definition at line 323 of file imgclass.cpp.
References imgbase< 512, 512, unsigned short >::bild, imgbase< 512, 512, unsigned short >::SIZEX, imgbase< 512, 512, unsigned short >::SIZEY, and STHROW.
Referenced by kreuz().
bild16 & bild16::drawy | ( | int | y, | |
int | x1, | |||
int | x2 | |||
) |
Draw a horizontal line.
Definition at line 339 of file imgclass.cpp.
References imgbase< 512, 512, unsigned short >::bild, imgbase< 512, 512, unsigned short >::SIZEX, imgbase< 512, 512, unsigned short >::SIZEY, and STHROW.
Referenced by kreuz().
bild16 & bild16::kreuz | ( | int | x, | |
int | y | |||
) |
Draw a cross centered at (x,y).
Definition at line 355 of file imgclass.cpp.
References drawx(), drawy(), imgbase< 512, 512, unsigned short >::SIZEX, imgbase< 512, 512, unsigned short >::SIZEY, and STHROW.
void bild16::fromfloat | ( | const bildfloat & | bf, | |
float | max = 1.0 | |||
) |
Convert from bildfloat.
Definition at line 297 of file imgclass.cpp.
References intensity_max, intensity_min, and MAP.
Assignemnt copy operator.
Definition at line 408 of file imgclass.hpp.
References imgbase< 512, 512, unsigned short >::operator=().
unsigned short & imgbase< s_x, s_y, unsigned short >::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.
References imgbase< s_x, s_y, T >::bild.
const unsigned short & imgbase< s_x, s_y, unsigned short >::operator() | ( | int | y, | |
int | x | |||
) | const [inline, inherited] |
Constant element extraction operator.
Definition at line 140 of file imgclass.hpp.
References imgbase< s_x, s_y, T >::bild.
imgbase<s_x, s_y, unsigned short >& imgbase< s_x, s_y, unsigned short >::operator/= | ( | const imgbase< s_x, s_y, unsigned short > & | 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, unsigned short >& imgbase< s_x, s_y, unsigned short >::operator/= | ( | const unsigned short & | what | ) | [inherited] |
Arithmetic operator.
This operator divides every pixel by the constant value what
imgbase<s_x, s_y, unsigned short >& imgbase< s_x, s_y, unsigned short >::operator*= | ( | const imgbase< s_x, s_y, unsigned short > & | what | ) | [inherited] |
Arithmetic operator.
This operator multiplies every pixel of the image by the corresponding value in what.
imgbase<s_x, s_y, unsigned short >& imgbase< s_x, s_y, unsigned short >::operator*= | ( | const unsigned short & | what | ) | [inherited] |
Arithmetic operator.
This operator multiplies every pixel by the constant value what
imgbase<s_x, s_y, unsigned short >& imgbase< s_x, s_y, unsigned short >::operator-= | ( | const imgbase< s_x, s_y, unsigned short > & | what | ) | [inherited] |
Arithmetic operator.
This operator subtracts every pixel of what from the corresponding value in the image.
imgbase<s_x, s_y, unsigned short >& imgbase< s_x, s_y, unsigned short >::operator-= | ( | const unsigned short & | what | ) | [inherited] |
Arithmetic operator.
This operator subtracts the constant value what from every pixel in the image
imgbase<s_x, s_y, unsigned short >& imgbase< s_x, s_y, unsigned short >::operator+= | ( | const imgbase< s_x, s_y, unsigned short > & | what | ) | [inherited] |
Arithmetic operator.
This operator adds every pixel in what to the corresponding pixel value in the image
imgbase<s_x, s_y, unsigned short >& imgbase< s_x, s_y, unsigned short >::operator+= | ( | const unsigned short & | what | ) | [inherited] |
Arithmetic operator.
This operator adds the constant value what to every pixel in the image
const streamoff bild16::HIS_START = 100 [static, private] |
const bild16::data_t bild16::intensity_max = 0xFFFF [static] |
Maximum possible intensity, representing white.
Definition at line 357 of file imgclass.hpp.
Referenced by bildfloat::apply_eichkurve(), flatkurve::deichfun_dx(), flatkurve::eichfun(), flatkurve::flatkurve(), bildfloat::from_bild16(), fromfloat(), flatkurve::initguess(), interpol::interpol(), og_correct(), QRfit::QRfit(), and write_pgm16().
const bild16::data_t bild16::intensity_min = 0x0000 [static] |
Minimum possible intensity, representing black.
Definition at line 359 of file imgclass.hpp.
Referenced by bildfloat::apply_eichkurve(), flatkurve::flatkurve(), and fromfloat().
save the s_x template parameter
Definition at line 126 of file imgclass.hpp.
Referenced by drawx(), drawy(), kreuz(), og_correct(), read_his(), read_pgm(), write_his(), write_pgm16(), write_pgm8(), and write_pgm8_bounds().
save the s_y template parameter
Definition at line 129 of file imgclass.hpp.
Referenced by drawx(), drawy(), kreuz(), og_correct(), read_his(), read_pgm(), write_his(), write_pgm16(), write_pgm8(), and write_pgm8_bounds().
The real data storage. Should not be used by derived classes
Definition at line 161 of file imgclass.hpp.
Referenced by drawx(), drawy(), og_correct(), read_his(), write_his(), write_pgm16(), and write_pgm8().