Luiza  v03-01
Public Member Functions | List of all members
gloria::GloriaMedianMap Class Reference

Class for calculating map of median values for any variable on the image. More...

#include <GloriaMedianMap.h>

Inheritance diagram for gloria::GloriaMedianMap:
gloria::GloriaValueMap

Public Member Functions

 GloriaMedianMap ()
 Dummy constructor - does nothing (!)
 
 GloriaMedianMap (int Nbx, int Nby, int Nvar=1)
 Constructor for median map. More...
 
 GloriaMedianMap (const GloriaFitsImage *fitsImage, int Nbx, int Nby, int Nvar=1)
 Constructor for median map corresponding to given image file. More...
 
 GloriaMedianMap (GloriaFitsTable *mapTable)
 Constructor. Allocates map by importing it from fits table. More...
 
void AddMedian ()
 Add another variable to median map set. More...
 
void AddMedian (string name)
 Add another variable to median map set and give it a name. More...
 
void SetMedianName (int ivar, string name)
 Set name to the considered variable.
 
string GetMedianName (int ivar)
 Return image filled with parameter values.
 
long CalculateMap (int iVar, int nVal, double *Xpos, double *Ypos, double *Val)
 Calculate median and spread maps for given variable. More...
 
long CalculateMap (int iVar, vector< double > *Xpos, vector< double > *Ypos, vector< double > *Val)
 Calculate median and spread maps for given variable. More...
 
void CalculateBgMap (const GloriaFitsImage *fitsImage, int Nbx, int Nby, int sampling=1)
 Calculate background and noise map for given image. More...
 
void CalculateBgMap (const GloriaFitsImage *fitsImage, int sampling=1)
 Calculate map for given image (without changing map binning)
 
double GetMedian (int ivar, int ix, int iy, int ipol=1)
 Get expected median for pixel (ix,iy) using calculated map. More...
 
double GetMedian (int ivar, double x, double y, int ipol=1)
 Get expected median level at position (x,y) using calculated map.
 
double GetMedian (int ivar, long ipix, int ipol=1)
 Get expected median level for pixel ipix using calculated map.
 
double GetSpread (int ivar, int ix, int iy, int ipol=1)
 Get spread of the variable for pixel (ix,iy) using calculated map.
 
double GetSpread (int ivar, double x, double y, int ipol=1)
 Get spread of variable at position (x,y) using calculated map.
 
double GetSpread (int ivar, long ipix, int ipol=1)
 Get spread for pixel ipix using calculated map.
 
double GetBgLevel (int ix, int iy, int ipol=1)
 Get background level for pixel (ix,iy) using calculated map. More...
 
double GetBgLevel (double x, double y, int ipol=1)
 Get background level at position (x,y) using calculated map.
 
double GetBgLevel (long ipix, int ipol=1)
 Get background level for pixel ipix using calculated map.
 
double GetNoise (int ix, int iy, int ipol=1)
 Get noise level for pixel (ix,iy) using calculated map.
 
double GetNoise (double x, double y, int ipol=1)
 Get noise level at position (x,y) using calculated map.
 
double GetNoise (long ipix, int ipol=1)
 Get noise level for pixel ipix using calculated map.
 
double * GetGloriaMedianMap (int ivar=0)
 Returns pointer to the median map array.
 
double * GetSpreadMap (int ivar=0)
 Returns pointer to the spread map array.
 
double * GetBgMap ()
 Returns pointer to the background map array.
 
double * GetNoiseMap ()
 Returns pointer to the noise map array.
 
double GetMedianMean (int ivar=0)
 Returns mean of median map.
 
double GetSpreadMean (int ivar=0)
 Returns mean of spread map.
 
double GetBgMean ()
 Returns mean of background map.
 
double GetNoiseMean ()
 Returns mean of noise map.
 
GloriaFitsImageGetMedianImage (int ivar=0, int ipol=1)
 Return image filled with median values.
 
GloriaFitsImageGetSpreadImage (int ivar=0, int ipol=1)
 Return image filled with spread values.
 
GloriaFitsImageGetBgImage (int ipol=1)
 Return image filled with background values.
 
GloriaFitsImageGetNoiseImage (int ipol=1)
 Return image filled with noise values.
 
void InitializeMaps (int Nbx, int Nby, int Nvar)
 Allocate new map sets with given binning. All data and image size information are lost.
 
- Public Member Functions inherited from gloria::GloriaValueMap
 GloriaValueMap ()
 Dummy constructor - does nothing (!)
 
 GloriaValueMap (int Nbx, int Nby, int Nmap=1)
 Constructor. Allocates map tables for given map size. More...
 
 GloriaValueMap (const GloriaFitsImage *fitsImage, int Nbx, int Nby, int Nmap=1)
 Constructor. Allocates map tables for given image and map size. More...
 
 GloriaValueMap (GloriaFitsTable *mapTable)
 Constructor. Allocates map by importing it from fits table. More...
 
virtual ~GloriaValueMap ()
 Destructor.
 
void SetImageSize (const GloriaFitsImage *fitsImage)
 Set size of image.
 
void SetImageSize (int SizeX, int SizeY)
 Set size of image.
 
void AddMap ()
 Add another map to current map set. More...
 
void AddMap (string name)
 Add another map to current map set, giving it a name. More...
 
void SetMapName (int imap, string name)
 Set name for existing map.
 
double GetMapValue (int imap, int ix, int iy, int ipol=1)
 Get value from map imap for pixel (ix,iy) More...
 
double GetMapValue (int imap, long ipix, int ipol=1)
 Get value from map imap for pixel ipix.
 
double GetMapValue (int imap, double x, double y, int ipol=1)
 Get map value for arbitrary position on the image.
 
int Nmap ()
 Get number of maps.
 
int NMapX ()
 Get map binning in X.
 
int NMapY ()
 Get map binning in Y.
 
int ImgSizeX ()
 Get image pixels in X.
 
int ImgSizeY ()
 Get image pixels in Y.
 
double * GetMap (int imap)
 Returns pointer to the map array.
 
string GetMapName (int imap)
 Return image filled with parameter values.
 
double GetMapMean (int imap)
 Returns mean value of map entries.
 
GloriaFitsImageGetMapImage (int imap, int ipol=1)
 Return image filled with parameter values.
 
GloriaFitsTableGetTable ()
 Return table containing all defined maps as columns.
 
bool LoadFromTable (GloriaFitsTable *mapTable)
 Initialize value map structures from the table.
 
void ClearMaps ()
 Clear all defined maps. Clears also map binning and image size information.
 
void InitializeMaps (int Nbx, int Nby, int Nmap)
 Allocate new, empty maps with given binning. All data and image size information are lost.
 

Additional Inherited Members

- Protected Member Functions inherited from gloria::GloriaValueMap
void FillMapImage1 (double *map, GloriaFitsImage *mapImage)
 

Detailed Description

Class for calculating map of median values for any variable on the image.

This class can be use to calculate median value map over the image. For each considered variable/parameter two maps are allocated: one for storing median of the parameter value and the second one for storing the estimated parameter spread. Image area is divided into Nbx x Nby sectors, median and spread is calculated for each sector separately. Spread is calculated from the ordered value array, as half of the distance between 17% and 83% of entries. Single GloriaMedianMap instance can store median+spread map pairs for arbitrary number of variables (default is one variable). However, all maps need to have same binning.

The class is inheriting from GloriaValueMap class for value calculation and creating median or spread images. Using the calculated median and spread maps, user can calculate expected values for any pixel in the image frame using different interpolation methods implemented for GloriaValueMap.
In particular this class can be used for calculating background and noise level maps for sky images, where background is defined as the median of image pixels in the sector and noise as pixel value spread. Dedicated methods are defined for calculating background and noise maps directly from the image. It is assumed that background and noise are always stored in the first two maps of the map vector.
Author
A.F.Zarnecki, University of Warsaw, zarne.nosp@m.cki@.nosp@m.fuw.e.nosp@m.du.p.nosp@m.l

Constructor & Destructor Documentation

gloria::GloriaMedianMap::GloriaMedianMap ( int  Nbx,
int  Nby,
int  Nvar = 1 
)

Constructor for median map.

Two tables are allocated, for storing median and value spread estimate, for any parameter corresponding to the image given. Tables should be then filled with a call to CalculateMap Note that image size is not defined at this moment yet!

gloria::GloriaMedianMap::GloriaMedianMap ( const GloriaFitsImage fitsImage,
int  Nbx,
int  Nby,
int  Nvar = 1 
)

Constructor for median map corresponding to given image file.

Two tables are allocated, for storing median and value spread estimate, for any parameter corresponding to the image given. Tables should be then filled with a call to CalculateMap

gloria::GloriaMedianMap::GloriaMedianMap ( GloriaFitsTable mapTable)
inline

Constructor. Allocates map by importing it from fits table.

Creates maps by reading them from fits table. The table has to created with GetTable() method previously, so all required parameters are stored in header keywords. Otherwise one should declare map first and read table contents with LoadFromTable.

Member Function Documentation

void gloria::GloriaMedianMap::AddMedian ( )

Add another variable to median map set.

Can be used to add maps (one for median, one for spread) for another parameter to the existing set of maps. Existing maps are not affected.

void gloria::GloriaMedianMap::AddMedian ( string  name)

Add another variable to median map set and give it a name.

Can be used to add maps (one for median, one for spread) for another parameter to the existing set of maps. Existing maps are not affected.

void gloria::GloriaMedianMap::CalculateBgMap ( const GloriaFitsImage fitsImage,
int  Nbx,
int  Nby,
int  sampling = 1 
)

Calculate background and noise map for given image.

This method allocates map tables with Nbx x Nby bins and calculates background and noise levels in each bin. If number of bins is small (number of pixels in each bin very large) sampling factor can be used to speed the calculation up. Sampling N > 1 means than not all pixels are taken for calculation but only every N-th pixel. For each bin median of the pixel value distribution and noise as half of the distance between 17% and 83% of stars.

Referenced by luiza::PiHalvesEqualizer::processData(), luiza::BackgroundImage::processData(), luiza::CalculateGausPSF::processData(), luiza::FastAperturePhotometry::processData(), luiza::ApplyGausKernel::processData(), luiza::PixelClusterFinder::processData(), and luiza::WeightedAperturePhotometry::processData().

long gloria::GloriaMedianMap::CalculateMap ( int  iVar,
int  nVal,
double *  Xpos,
double *  Ypos,
double *  Val 
)

Calculate median and spread maps for given variable.

This method can be used for calculating median and spread maps based on the table of parameter value measurements (Val array) at different positions on the frame (specified by Xpos and Ypos arrays). All arrays contain nVal entries. iVar specifies the variable number (more than one variable can be considered in one GloriaMedianMap instance). Return value corresponds to minimal number of entries found in single map bin. Negative number is returned on error. If zero value is returned one or more map bins is not set.

Referenced by luiza::CalculateGausPSF::processData(), and luiza::CalibrateFrameObjects::processData().

long gloria::GloriaMedianMap::CalculateMap ( int  iVar,
vector< double > *  Xpos,
vector< double > *  Ypos,
vector< double > *  Val 
)

Calculate median and spread maps for given variable.

This method can be used for calculating median and spread maps based on the vector of parameter value measurements (Val vector) at different positions on the frame (specified by Xpos and Ypos vectors). All vectors should contain same number of entries. iVar specifies the variable number (more than one variable can be considered in one GloriaMedianMap instance). Return value corresponds to minimal number of entries found in single map bin. Negative number is returned on error. If zero value is returned one or more map bins is not set.

double gloria::GloriaMedianMap::GetBgLevel ( int  ix,
int  iy,
int  ipol = 1 
)
inline

Get background level for pixel (ix,iy) using calculated map.

Calculates background level in given pixel on the input frame by interpolating between map points. ipol parameter defines interpolation order. Currently implemented values are: 0 - no interpolation (take value from the bin center) and 1 - linear interpolation between bin centers (default). 2 - second order approximation (simplified).

References gloria::GloriaValueMap::GetMapValue().

Referenced by luiza::FastAperturePhotometry::processData(), and luiza::WeightedAperturePhotometry::processData().

double gloria::GloriaMedianMap::GetMedian ( int  ivar,
int  ix,
int  iy,
int  ipol = 1 
)
inline

Get expected median for pixel (ix,iy) using calculated map.

Calculates expected median value in given pixel on the input frame by interpolating between map points. ivar parameter selects the variable (more than one map can be defined) and ipol defines interpolation order. Currently implemented values are: 0 - no interpolation (take value from the bin center) and 1 - linear interpolation between bin centers (default). 2 - second order approximation (simplified).

References gloria::GloriaValueMap::GetMapValue().


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