mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
mx::improc::imCenterCircleSym< realT > Struct Template Reference

template<typename realT>
struct mx::improc::imCenterCircleSym< realT >

Find the center of the image of a point source using circular symmetry of the PSF.

Conducts a grid search through possible center positions. Finds the point with the minimum total variance around concentric circles about that point. The cost grid is fit with a Gaussian.

Template Parameters
realTis a real floating point type.

Definition at line 51 of file imCenterCircleSym.hpp.

#include <improc/imCenterCircleSym.hpp>

Public Member Functions

int init (realT maxP, realT dP, realT minR, realT maxR, realT dR)
 Initialize the grid. More...
 
int center (realT &x, realT &y, eigenImage< realT > &im, realT x0, realT y0)
 Peform the grid search and fit. More...
 
template<typename iosT , char comment = '#'>
iosT & dumpResults (iosT &ios)
 Output the results to a stream. More...
 
template<char comment = '#'>
std::ostream & dumpResults ()
 Output the results to std::cout. More...
 

Public Attributes

eigenImage< realT > * mask
 An optional pointer to a mask. If not NULL and the same size as the input image, any 0 pixels in this image are ignored. More...
 
eigenImage< realT > grid
 The cost grid. More...
 
eigenImage< realT > smGrid
 The smoothed cost grid. More...
 
realT maxPix
 The maximum range of the grid search, the grid will be +/- maxPix. Default: 5.0. More...
 
realT dPix
 The spacing of the points in the grid search. Default: 0.1. More...
 
realT minRad
 The minimum radius to include in the cost function. Default: 1.0. More...
 
realT maxRad
 The maximum radius to include in the cost function Default: 20.0. More...
 
realT dRad
 The spacing of the radii. Default: 1.0. More...
 
realT smWidth
 FWHM of the Guassian smoothing kernel. Default is 10 (seems to work well regardless of dPix). Set to 0 for no smoothing. More...
 
realT guessWidth
 Guess in original pixels for the FWHM of the cost grid. Default is 0.5, which seems to work well in most cases. More...
 
mx::math::fit::fitGaussian2Dgen< realT > fit
 The fitter for finding the centroid of the grid. You can use this to inspect the details of the fit if desired. More...
 
realT _x0
 Internal storage of the guess center position. More...
 
realT _y0
 Internal storage of the guess center position. More...
 

Member Function Documentation

◆ center()

template<typename realT >
int mx::improc::imCenterCircleSym< realT >::center ( realT &  x,
realT &  y,
eigenImage< realT > &  im,
realT  x0,
realT  y0 
)
inline

Peform the grid search and fit.

Todo:
This needs to be able to handle highly non-symmetric peaks much better.
Parameters
[out]xthe x-coordinate of the estimated center of rotational symmetry
[out]ythe y-coordinate estimated center of rotational symmetry
[in]imthe image to centroid
[in]x0an initial guess at the x-coordinate, the grid is centered about this point.
[in]y0an initial guess at the y-coordinate, the grid is centered about this point.

Definition at line 106 of file imCenterCircleSym.hpp.

References mx::improc::imCenterCircleSym< realT >::_x0, mx::improc::imCenterCircleSym< realT >::_y0, mx::improc::imCenterCircleSym< realT >::dPix, mx::improc::imCenterCircleSym< realT >::dRad, mx::improc::filterImage(), mx::improc::imCenterCircleSym< realT >::fit, mx::improc::imCenterCircleSym< realT >::grid, mx::improc::imCenterCircleSym< realT >::guessWidth, mx::astro::constants::k(), mx::improc::imCenterCircleSym< realT >::mask, mx::improc::imCenterCircleSym< realT >::maxPix, mx::improc::imCenterCircleSym< realT >::maxRad, mx::improc::imCenterCircleSym< realT >::minRad, mx::improc::imCenterCircleSym< realT >::smGrid, mx::improc::imCenterCircleSym< realT >::smWidth, mx::math::vectorMean(), and mx::math::vectorVariance().

◆ dumpResults() [1/2]

template<typename realT >
template<char comment = '#'>
std::ostream& mx::improc::imCenterCircleSym< realT >::dumpResults ( )
inline

Output the results to std::cout.

Prints a result summary to std::cout

Template Parameters
commentis a comment character to start each line. Can be '\0'.

Definition at line 264 of file imCenterCircleSym.hpp.

◆ dumpResults() [2/2]

template<typename realT >
template<typename iosT , char comment = '#'>
iosT& mx::improc::imCenterCircleSym< realT >::dumpResults ( iosT &  ios)
inline

◆ init()

template<typename realT >
int mx::improc::imCenterCircleSym< realT >::init ( realT  maxP,
realT  dP,
realT  minR,
realT  maxR,
realT  dR 
)
inline

Initialize the grid.

Parameters
[in]maxPthe new value of maxPix
[in]dPthe new value of dPix
[in]minRthe new value of minRad
[in]maxRthe new value of maxRad
[in]dRthe new value of dRad

Definition at line 90 of file imCenterCircleSym.hpp.

References mx::improc::imCenterCircleSym< realT >::dPix, mx::improc::imCenterCircleSym< realT >::dRad, mx::improc::imCenterCircleSym< realT >::maxPix, mx::improc::imCenterCircleSym< realT >::maxRad, and mx::improc::imCenterCircleSym< realT >::minRad.

Member Data Documentation

◆ _x0

template<typename realT >
realT mx::improc::imCenterCircleSym< realT >::_x0

Internal storage of the guess center position.

Definition at line 74 of file imCenterCircleSym.hpp.

Referenced by mx::improc::imCenterCircleSym< realT >::center(), and mx::improc::imCenterCircleSym< realT >::dumpResults().

◆ _y0

template<typename realT >
realT mx::improc::imCenterCircleSym< realT >::_y0

Internal storage of the guess center position.

Definition at line 75 of file imCenterCircleSym.hpp.

Referenced by mx::improc::imCenterCircleSym< realT >::center(), and mx::improc::imCenterCircleSym< realT >::dumpResults().

◆ dPix

template<typename realT >
realT mx::improc::imCenterCircleSym< realT >::dPix

The spacing of the points in the grid search. Default: 0.1.

Definition at line 61 of file imCenterCircleSym.hpp.

Referenced by mx::improc::imCenterCircleSym< realT >::center(), mx::improc::imCenterCircleSym< realT >::dumpResults(), and mx::improc::imCenterCircleSym< realT >::init().

◆ dRad

template<typename realT >
realT mx::improc::imCenterCircleSym< realT >::dRad

◆ fit

template<typename realT >
mx::math::fit::fitGaussian2Dgen<realT> mx::improc::imCenterCircleSym< realT >::fit

The fitter for finding the centroid of the grid. You can use this to inspect the details of the fit if desired.

Definition at line 72 of file imCenterCircleSym.hpp.

Referenced by mx::improc::imCenterCircleSym< realT >::center(), and mx::improc::imCenterCircleSym< realT >::dumpResults().

◆ grid

template<typename realT >
eigenImage<realT> mx::improc::imCenterCircleSym< realT >::grid

The cost grid.

Definition at line 56 of file imCenterCircleSym.hpp.

Referenced by mx::improc::imCenterCircleSym< realT >::center().

◆ guessWidth

template<typename realT >
realT mx::improc::imCenterCircleSym< realT >::guessWidth

Guess in original pixels for the FWHM of the cost grid. Default is 0.5, which seems to work well in most cases.

Definition at line 68 of file imCenterCircleSym.hpp.

Referenced by mx::improc::imCenterCircleSym< realT >::center(), and mx::improc::imCenterCircleSym< realT >::dumpResults().

◆ mask

template<typename realT >
eigenImage<realT>* mx::improc::imCenterCircleSym< realT >::mask

An optional pointer to a mask. If not NULL and the same size as the input image, any 0 pixels in this image are ignored.

Definition at line 54 of file imCenterCircleSym.hpp.

Referenced by mx::improc::imCenterCircleSym< realT >::center().

◆ maxPix

template<typename realT >
realT mx::improc::imCenterCircleSym< realT >::maxPix

The maximum range of the grid search, the grid will be +/- maxPix. Default: 5.0.

Definition at line 60 of file imCenterCircleSym.hpp.

Referenced by mx::improc::imCenterCircleSym< realT >::center(), mx::improc::imCenterCircleSym< realT >::dumpResults(), and mx::improc::imCenterCircleSym< realT >::init().

◆ maxRad

template<typename realT >
realT mx::improc::imCenterCircleSym< realT >::maxRad

The maximum radius to include in the cost function Default: 20.0.

Definition at line 64 of file imCenterCircleSym.hpp.

Referenced by mx::improc::imCenterCircleSym< realT >::center(), mx::improc::imCenterCircleSym< realT >::dumpResults(), and mx::improc::imCenterCircleSym< realT >::init().

◆ minRad

template<typename realT >
realT mx::improc::imCenterCircleSym< realT >::minRad

The minimum radius to include in the cost function. Default: 1.0.

Definition at line 63 of file imCenterCircleSym.hpp.

Referenced by mx::improc::imCenterCircleSym< realT >::center(), mx::improc::imCenterCircleSym< realT >::dumpResults(), and mx::improc::imCenterCircleSym< realT >::init().

◆ smGrid

template<typename realT >
eigenImage<realT> mx::improc::imCenterCircleSym< realT >::smGrid

The smoothed cost grid.

Definition at line 57 of file imCenterCircleSym.hpp.

Referenced by mx::improc::imCenterCircleSym< realT >::center().

◆ smWidth

template<typename realT >
realT mx::improc::imCenterCircleSym< realT >::smWidth

FWHM of the Guassian smoothing kernel. Default is 10 (seems to work well regardless of dPix). Set to 0 for no smoothing.

Definition at line 67 of file imCenterCircleSym.hpp.

Referenced by mx::improc::imCenterCircleSym< realT >::center(), and mx::improc::imCenterCircleSym< realT >::dumpResults().


The documentation for this struct was generated from the following file: