Main Page | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members

Defectix Class Reference

Main class. More...

Inheritance diagram for Defectix:

DefectixError::ErrorMgr DefectComputer DefectSimulator DefectTrainer HaloSimulator TrailSimulator List of all members.

Public Member Functions

 Defectix (const DefectixOptions::Options &options)
 Standard constructor.

virtual ~Defectix ()
 Standard destructor.

virtual const errorCodes exec ()=0
 Main function.

errorCodes readImageExtension (int pos, bool createMask=false)
 read an extension from a MEF file

errorCodes readAllImageExtensions (bool createMask=false)
 read an entire MEF

void unreadImageExtension (int pos)
 unload and free an extension

void unreadAllImageExtensions ()
 unload and free all extensions

errorCodes readMaskExtension (int pos)
 read an extension from a MEF file

errorCodes readAllMasks ()
 read an entire MEF

void unreadMaskExtension (int pos)
 unload and free an mask extension

void unreadAllMasks ()
 unload and free all mask extensions


Protected Member Functions

void getVectorfromBloc (gsl_vector *dest, const gsl_matrix *const src, unsigned row, unsigned col)
 Convert a bloc into a vector.

void substractBackground (gsl_matrix *m, s_ext_info *info)
 Substract the computed background value.

const errorCodes writeAllMasks ()
 write all mask extensions into a MEF file

void printMessage (std::string msg) const
 Print a message on the standard output.

void overwriteMessage () const
 Overwrite the previous message written on the standard output.


Protected Attributes

FitsManager _imageMgr
 FITS and MEF manager for the image.

FitsManager _maskMgr
 FITS and MEF manager for the mask.

int _factor
 rebin factor

int _blocSize
 Size of the blocks to create.

int _zoomStep
 Unused for now.

bool _substractBg
 Ask for background substraction.

bool _reduceDyn
 Ask for dynamic reduction.

std::map< int, gsl_matrix * > _images
 List of loaded extensions.

std::map< int, t_ext_info_imagesInfo
 List of informations about loaded extensions.

std::map< int, gsl_matrix * > _masks
 List of loaded masks.

DefectPCA_PCA
 Class dedicated to the PCA computation.


Private Member Functions

double computeBackground (const gsl_vector *const pixels, const unsigned int factor, double stdev)
 compute the background value of an image histogram

void reduceDyn (gsl_matrix *m, s_ext_info *info)
 Apply a dynamic reduction of an image.

void rebin (void **src, long bitpix, const long axes[2])
 Rebin an image.

void computeInfo (gsl_matrix *m, gsl_vector *pixels, s_ext_info *info)
 Compute informations about an image.

template<typename T> void rebin (T **src, T *dest, const long axes[2])
 Rebin an image.

template<typename T> errorCodes commonRead (gsl_matrix *m, T **src, FitsManager &mgr)
 Read a MEF extension into a matrix.

errorCodes commonRead (int pos, gsl_matrix *m, FitsManager &mgr)
 Read a MEF into a matrix.

void commonPrint (int pos, const char *const type) const
 Print standard message when a extension or a mask is read.


Detailed Description

Main class.

The class is the top class


Constructor & Destructor Documentation

Defectix::Defectix const DefectixOptions::Options options  ) 
 

Standard constructor.

The constructor initializes a random seed with current time, creates an ErrorManager, two FitsManager for images and masks and sets private members with 'options' values.

Parameters:
options Class containing every parameters set by the user (or default)

Defectix::~Defectix  )  [virtual]
 

Standard destructor.

The destructor destroys Defectix::_PCA if it exists.


Member Function Documentation

void Defectix::commonPrint int  pos,
const char *const  type
const [private]
 

Print standard message when a extension or a mask is read.

Parameters:
pos position of the read extension
type type of the read extension (image of mask)

errorCodes Defectix::commonRead int  pos,
gsl_matrix *  m,
FitsManager mgr
[private]
 

Read a MEF into a matrix.

The function reads an extension of a given MEF file and stores it into a matrix. The function call the templated commonRead()

Parameters:
pos position of the extension to read in the MEF
m matrix to store the image in
mgr FitsManager corresponding to the image to read

template<typename T>
errorCodes Defectix::commonRead gsl_matrix *  m,
T **  src,
FitsManager mgr
[private]
 

Read a MEF extension into a matrix.

The function reads a given extension of a given MEF file and stores it into a matrix.

Parameters:
m matrix to store the image in
src image to read
mgr FitsManager corresponding to the image to read

double Defectix::computeBackground const gsl_vector *const  pixels,
const unsigned int  factor,
double  stdev
[private]
 

compute the background value of an image histogram

The function computes the value of the background of an image histogram. It is a recursive function. For each new iteration, the histogram is reduced to compute a more precise value of the background.

Parameters:
pixels image histogram
factor reduction factor of the histogram
stdev standard deviation, parameter used for the recursion. Must be set to zero for the first iteration.

void Defectix::computeInfo gsl_matrix *  m,
gsl_vector *  pixels,
s_ext_info info
[private]
 

Compute informations about an image.

The function computes the histogram of an image and several compute informations as maximum and minimum pixel values.

Parameters:
m image to compute
pixels vector to store the histogram
info structure to store informations

const errorCodes Defectix::exec  )  [pure virtual]
 

Main function.

The function executes the main code of the class for every subclasses.

Implemented in DefectComputer, DefectSimulator, and DefectTrainer.

void Defectix::getVectorfromBloc gsl_vector *  dest,
const gsl_matrix *const  src,
unsigned  row,
unsigned  col
[protected]
 

Convert a bloc into a vector.

The functions gets a matrix {Defectix::_blocSize, Defectix::_blocSize} pixels and sets a vector {Defectix::_blocSize x Defectix::_blocSize, 1}

Parameters:
dest vector to fill
src source image
row row to consider in the matrix
col column to consider in the matrix

void Defectix::printMessage std::string  msg  )  const [inline, protected]
 

Print a message on the standard output.

Parameters:
msg string to print

errorCodes Defectix::readAllImageExtensions bool  createMask = false  ) 
 

read an entire MEF

The function reads and loads a MEF into the class. The function can also create a corresponding mask. It is the case for simulating and computing.

Parameters:
createMask boolean to create corresponding extension for the mask.

errorCodes Defectix::readAllMasks  ) 
 

read an entire MEF

The function reads and loads a MEF into the class. The MEF is loaded as a mask. The function is not compatible with readAllImageExtensions() called with createMask = true;

errorCodes Defectix::readImageExtension int  pos,
bool  createMask = false
 

read an extension from a MEF file

The function reads and loads a MEF extension into the class. The function can also create a corresponding extension for the mask. It is the case for simulating and computing.

Parameters:
pos position of the extension to load
createMask boolean to create corresponding extension for the mask.

errorCodes Defectix::readMaskExtension int  pos  ) 
 

read an extension from a MEF file

The function reads and loads a MEF extension into the class. The extension is loaded as a mask extension. The function is not compatible with readImageExtension() called with createMask = true;

Parameters:
pos position of the extension to load

template<typename T>
void Defectix::rebin T **  src,
T *  dest,
const long  axes[2]
[private]
 

Rebin an image.

The function effectively rebins an image. The rebin factor is Defectix::_rebinFactor.

Parameters:
src image to rebin
dest image to store the rebinning result
axes dimensions of the original image

void Defectix::rebin void **  src,
long  bitpix,
const long  axes[2]
[private]
 

Rebin an image.

The function rebins a image whose type correspond to the given bitpix. The function calls the private and templated function Defectix::rebin()

Parameters:
src image to rebin
bitpix image bitpix (fitsio)
axes dimensions of the image

void Defectix::reduceDyn gsl_matrix *  m,
s_ext_info info
[private]
 

Apply a dynamic reduction of an image.

The function reduces the dynamic range of an image applying yhe formula: y(x) = ln ( 1 + x / sigma) / |x|, where sigma is the standard deviation of the global background. Image informations are also updated.

Parameters:
m image to compress
info informations about the image

void Defectix::substractBackground gsl_matrix *  m,
s_ext_info info
[protected]
 

Substract the computed background value.

The function substracts the background value to each pixel of an image. The value of the background must have been computed using computeBackground()

Parameters:
m image
info image informations (contains the background value)

void Defectix::unreadAllImageExtensions  ) 
 

unload and free all extensions

The function unreads all previously loaded extensions and frees the memory used in the class.

void Defectix::unreadAllMasks  ) 
 

unload and free all mask extensions

The function unreads all previously loaded mask extensions and frees the memory used in the class.

void Defectix::unreadImageExtension int  pos  ) 
 

unload and free an extension

The function unreads a previously loaded extension and frees the memory used in the class.

Parameters:
pos position of the extension to unread

void Defectix::unreadMaskExtension int  pos  ) 
 

unload and free an mask extension

The function unreads a previously loaded mask extension and frees the memory used in the class.

Parameters:
pos position of the extension to unread

const errorCodes Defectix::writeAllMasks  )  [protected]
 

write all mask extensions into a MEF file

The function writes mask extensions into a MEF file. The function is used when masks are created by readAllExtensions() with createMask = true, that is during simulations or computing.


Member Data Documentation

int Defectix::_blocSize [protected]
 

Size of the blocks to create.

_blocSize defines the size of the blocks used for PCA, training and computing. Blocks contains _blocSize x _blocSize pixels.

int Defectix::_factor [protected]
 

rebin factor

_factor defines the rebin factor used during image loading. If 1, no rebin is computed.

FitsManager Defectix::_imageMgr [protected]
 

FITS and MEF manager for the image.

See FitsManager

std::map< int, gsl_matrix * > Defectix::_images [protected]
 

List of loaded extensions.

Extensions loaded with ReadImageExtension() are stored in this map. The key correspond to the extension position in the MEF.

std::map< int, t_ext_info > Defectix::_imagesInfo [protected]
 

List of informations about loaded extensions.

Informations of extensions loaded with ReadImageExtension() are stored in this map. The key correspond to the extension position in the MEF.

FitsManager Defectix::_maskMgr [protected]
 

FITS and MEF manager for the mask.

See FitsManager

std::map< int, gsl_matrix * > Defectix::_masks [protected]
 

List of loaded masks.

Extensions loaded with ReadMaskExtension() are stored in this map. The key correspond to the extension position in the MEF.

DefectPCA * Defectix::_PCA [protected]
 

Class dedicated to the PCA computation.

Subclasses can allocates this attribute to compute a PCA on loaded images.

bool Defectix::_reduceDyn [protected]
 

Ask for dynamic reduction.

If _reduceDyn is true, a dynamic reduction will be computed on the loaded images.

bool Defectix::_substractBg [protected]
 

Ask for background substraction.

If _substrackBg is true, a background substraction will be computed on the loaded images.


The documentation for this class was generated from the following file:
Generated on Fri Jul 2 13:08:03 2004 for defectix by doxygen 1.3.5