SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SourceXtractor::ImageMode< T > Class Template Reference

#include <ImageMode.h>

Collaboration diagram for SourceXtractor::ImageMode< T >:

Public Member Functions

 ImageMode (const std::shared_ptr< Image< T > > &image, const std::shared_ptr< Image< T > > &variance, int cell_w, int cell_h, T invalid_value, T kappa1=2, T kappa2=5, T kappa3=3, T rtol=1e-4, size_t max_iter=100)
virtual ~ImageMode ()=default
std::shared_ptr< VectorImage< T > > getModeImage () const
std::shared_ptr< VectorImage< T > > getSigmaImage () const
std::shared_ptr< VectorImage< T > > getVarianceModeImage () const
std::shared_ptr< VectorImage< T > > getVarianceSigmaImage () const

Private Member Functions

std::tuple< T, T > getBackGuess (const std::vector< T > &data) const
void processCell (const Image< T > &img, int x, int y, VectorImage< T > &out_mode, VectorImage< T > &out_sigma) const

Private Attributes

std::shared_ptr< const Image< T > > m_image
std::shared_ptr< VectorImage< T > > m_mode
std::shared_ptr< VectorImage< T > > m_sigma
std::shared_ptr< VectorImage< T > > m_var_mode
std::shared_ptr< VectorImage< T > > m_var_sigma
int m_cell_w
int m_cell_h
m_invalid
m_kappa1
m_kappa2
m_kappa3
m_rtol
size_t m_max_iter

Detailed Description

template<typename T>
class SourceXtractor::ImageMode< T >

Computes the background of an image using a \( \kappa \sigma \) clipping individually for each cell.

For each cell, pixel values are clipped to a maximum deviation of \( \kappa_1 \) around the mean, For the remaining pixels, and histogram ranging \f \pm \kappa_2 \sigma \f is built, and iteratively clipped \( to \kappa_3 \sigma \) around the median until convergence.

The background value for the given cell is considered to be either:

  • The mean if the standard deviation is 0
  • 2.5 * median - 1.5 mean if the mean and the median do not diverge more than 30% (not crowded cell)
  • The median otherwise (crowded cell)
    See also
    KappaSigmaBinning
    Template Parameters
    TPixel type

Definition at line 44 of file ImageMode.h.

Constructor & Destructor Documentation

◆ ImageMode()

template<typename T>
SourceXtractor::ImageMode< T >::ImageMode ( const std::shared_ptr< Image< T > > & image,
const std::shared_ptr< Image< T > > & variance,
int cell_w,
int cell_h,
T invalid_value,
T kappa1 = 2,
T kappa2 = 5,
T kappa3 = 3,
T rtol = 1e-4,
size_t max_iter = 100 )

Constructor

Parameters
imageThe image to model
cell_wCell width
cell_hCell height
invalid_valuePixels with this value will be discarded
kappa1First cut
kappa2Histogram range
kappa3Iterative cut
rtolRelative tolerance used to test for convergence around the median
max_iterMaximum number of iterations

Definition at line 30 of file ImageMode.cpp.

References SourceXtractor::VectorImage< T >::create(), std::div(), m_cell_h, m_cell_w, m_image, m_invalid, m_kappa1, m_kappa2, m_kappa3, m_max_iter, m_mode, m_rtol, m_sigma, m_var_mode, m_var_sigma, and processCell().

Here is the call graph for this function:

◆ ~ImageMode()

template<typename T>
virtual SourceXtractor::ImageMode< T >::~ImageMode ( )
virtualdefault

Destructor

Member Function Documentation

◆ getBackGuess()

◆ getModeImage()

template<typename T>
std::shared_ptr< VectorImage< T > > SourceXtractor::ImageMode< T >::getModeImage ( ) const
Returns
An image with the background value for each cell.
Note
Dimensions will be image->getWidth() / cell_width, ceil(image->getHeight() / cell_height)

Definition at line 69 of file ImageMode.cpp.

References m_mode.

Referenced by SourceXtractor::SEBackgroundLevelAnalyzer::analyzeBackground().

◆ getSigmaImage()

template<typename T>
std::shared_ptr< VectorImage< T > > SourceXtractor::ImageMode< T >::getSigmaImage ( ) const
Returns
An image with the standard deviation for each cell.
Note
Dimensions will be image->getWidth() / cell_width, ceil(image->getHeight() / cell_height)

Definition at line 74 of file ImageMode.cpp.

References m_sigma.

Referenced by SourceXtractor::SEBackgroundLevelAnalyzer::analyzeBackground().

◆ getVarianceModeImage()

template<typename T>
std::shared_ptr< VectorImage< T > > SourceXtractor::ImageMode< T >::getVarianceModeImage ( ) const
Returns
An image with the mode of each cell of the variance map, or nullptr if there is no variance map.

Definition at line 79 of file ImageMode.cpp.

References m_var_mode.

Referenced by SourceXtractor::SEBackgroundLevelAnalyzer::analyzeBackground().

◆ getVarianceSigmaImage()

template<typename T>
std::shared_ptr< VectorImage< T > > SourceXtractor::ImageMode< T >::getVarianceSigmaImage ( ) const
Returns
An image with the standard deviation of each cell from the variance map, or nullptr if there is no variance map.

Definition at line 84 of file ImageMode.cpp.

References m_var_sigma.

Referenced by SourceXtractor::SEBackgroundLevelAnalyzer::analyzeBackground().

◆ processCell()

template<typename T>
void SourceXtractor::ImageMode< T >::processCell ( const Image< T > & img,
int x,
int y,
VectorImage< T > & out_mode,
VectorImage< T > & out_sigma ) const
private

Member Data Documentation

◆ m_cell_h

template<typename T>
int SourceXtractor::ImageMode< T >::m_cell_h
private

Definition at line 108 of file ImageMode.h.

Referenced by ImageMode(), and processCell().

◆ m_cell_w

template<typename T>
int SourceXtractor::ImageMode< T >::m_cell_w
private

Definition at line 108 of file ImageMode.h.

Referenced by ImageMode(), and processCell().

◆ m_image

template<typename T>
std::shared_ptr<const Image<T> > SourceXtractor::ImageMode< T >::m_image
private

Definition at line 105 of file ImageMode.h.

Referenced by ImageMode().

◆ m_invalid

template<typename T>
T SourceXtractor::ImageMode< T >::m_invalid
private

Definition at line 109 of file ImageMode.h.

Referenced by ImageMode(), and processCell().

◆ m_kappa1

template<typename T>
T SourceXtractor::ImageMode< T >::m_kappa1
private

Definition at line 109 of file ImageMode.h.

Referenced by getBackGuess(), and ImageMode().

◆ m_kappa2

template<typename T>
T SourceXtractor::ImageMode< T >::m_kappa2
private

Definition at line 109 of file ImageMode.h.

Referenced by getBackGuess(), and ImageMode().

◆ m_kappa3

template<typename T>
T SourceXtractor::ImageMode< T >::m_kappa3
private

Definition at line 109 of file ImageMode.h.

Referenced by getBackGuess(), and ImageMode().

◆ m_max_iter

template<typename T>
size_t SourceXtractor::ImageMode< T >::m_max_iter
private

Definition at line 110 of file ImageMode.h.

Referenced by ImageMode().

◆ m_mode

template<typename T>
std::shared_ptr<VectorImage<T> > SourceXtractor::ImageMode< T >::m_mode
private

Definition at line 106 of file ImageMode.h.

Referenced by getModeImage(), and ImageMode().

◆ m_rtol

template<typename T>
T SourceXtractor::ImageMode< T >::m_rtol
private

Definition at line 109 of file ImageMode.h.

Referenced by getBackGuess(), and ImageMode().

◆ m_sigma

template<typename T>
std::shared_ptr<VectorImage<T> > SourceXtractor::ImageMode< T >::m_sigma
private

Definition at line 106 of file ImageMode.h.

Referenced by getSigmaImage(), and ImageMode().

◆ m_var_mode

template<typename T>
std::shared_ptr<VectorImage<T> > SourceXtractor::ImageMode< T >::m_var_mode
private

Definition at line 107 of file ImageMode.h.

Referenced by getVarianceModeImage(), and ImageMode().

◆ m_var_sigma

template<typename T>
std::shared_ptr<VectorImage<T> > SourceXtractor::ImageMode< T >::m_var_sigma
private

Definition at line 107 of file ImageMode.h.

Referenced by getVarianceSigmaImage(), and ImageMode().


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