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

template<typename realT>
class mx::improc::aperturePhotometer< realT >

Class for performing aperture photometry on images.

Designed to very efficiently calculate the cumulative flux as a function of radius, with minimal cost for performing the measurement on multiple images.

This initial version assumes the source is at 0.5*(rows-1) and 0.5*(cols-1).

First call resize with the desired size. This organizes the radius vector and the index image which maps pixels to position in the radius vector.

Then call cumPhot with the image, which will sum the flux contained within each radius.

Template Parameters
realTthe real floating point type of the data

Definition at line 56 of file aperturePhotometer.hpp.

#include <improc/aperturePhotometer.hpp>

Public Member Functions

int resize (int sizeX, int sizeY, realT xcen, realT ycen)
 Resize the photometer, recalculating the radius vector and index image. More...
 
int resize (int sizeX, int sizeY)
 Resize the photometer for a centered image, recalculating the radius vector and index image.
More...
 
int cumPhot (std::vector< realT > &cumPhot, eigenImage< realT > &im, realT maxr=0)
 Get the cumulative photometry of an image as a function of radius. More...
 
int cumPhot (std::vector< realT > &cumPhot, std::vector< realT > &deltaPhot, eigenImage< realT > &im, realT maxr=0)
 Get the cumulative photometry of an image as a function of radius. More...
 
realT radius (size_t i)
 Get the radius value at an index of the vector. More...
 

Protected Member Functions

int cumPhotWork (std::vector< realT > &cumPhot, std::vector< realT > *deltaPhot, eigenImage< realT > &im, realT maxr=0)
 Get the cumulative photometry of an image as a function of radius. More...
 

Protected Attributes

int m_sizeX {0}
 The size of the image in X (rows). More...
 
int m_sizeY {0}
 The size of the image in Y (columns). More...
 
realT m_xcen {0}
 The x coordinate of the center of the image. Radii are caculated relative to this point. Default is 0.5*(sizeX-1). More...
 
realT m_ycen {0}
 The y coordinate of the center of the image. Radii are caculated relative to this point. Default is 0.5*(sizeY-1). More...
 
std::vector< realT > m_radius
 Holds the ordered unique radii of the pixels in the image. More...
 
eigenImage< size_t > m_indexIm
 Maps a pixel in the image to the position in the radius vector. More...
 

Member Function Documentation

◆ cumPhot() [1/2]

template<typename realT >
int mx::improc::aperturePhotometer< realT >::cumPhot ( std::vector< realT > &  cumPhot,
eigenImage< realT > &  im,
realT  maxr = 0 
)

Get the cumulative photometry of an image as a function of radius.

Returns
0 on success
-1 on error
Parameters
[out]cumPhotthe cumulative photometry at each point in the radius vector. Resized.
[in]imthe image on which to perform the calculation
[in]maxr[optional] the maximum radius to which to calculate. If <= 0 then max possible is used.

Definition at line 265 of file aperturePhotometer.hpp.

◆ cumPhot() [2/2]

template<typename realT >
int mx::improc::aperturePhotometer< realT >::cumPhot ( std::vector< realT > &  cumPhot,
std::vector< realT > &  deltaPhot,
eigenImage< realT > &  im,
realT  maxr = 0 
)

Get the cumulative photometry of an image as a function of radius.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns
0 on success
-1 on error
Parameters
[out]cumPhotthe cumulative photometry at each point in the radius vector. Resized.
[out]deltaPhot[optional] the photometry at each point in the radius vector, not-cumulative. Resized.
[in]imthe image on which to perform the calculation
[in]maxr[optional] the maximum radius to which to calculate. If <= 0 then max possible is used.

Definition at line 274 of file aperturePhotometer.hpp.

◆ cumPhotWork()

template<typename realT >
int mx::improc::aperturePhotometer< realT >::cumPhotWork ( std::vector< realT > &  cumPhot,
std::vector< realT > *  deltaPhot,
eigenImage< realT > &  im,
realT  maxr = 0 
)
protected

Get the cumulative photometry of an image as a function of radius.

This is called by the public cumPhot functions.

Returns
0 on success
-1 on error
Parameters
[out]cumPhotthe cumulative photometry at each point in the radius vector. Resized.
[out]deltaPhotif not `nullptr`, this vector is filled with the sum at each radius.
[in]imthe image on which to perform the calculation
[in]maxr[optional] the maximum radius to which to calculate. If <= 0 then max possible is used.

Definition at line 284 of file aperturePhotometer.hpp.

References mx::math::vectorMedian().

◆ radius()

template<typename realT >
realT mx::improc::aperturePhotometer< realT >::radius ( size_t  i)
inline

Get the radius value at an index of the vector.

Parameters
[in]ithe index of the radius vector

Definition at line 153 of file aperturePhotometer.hpp.

References mx::improc::aperturePhotometer< realT >::m_radius.

◆ resize() [1/2]

template<typename realT >
int mx::improc::aperturePhotometer< realT >::resize ( int  sizeX,
int  sizeY 
)

Resize the photometer for a centered image, recalculating the radius vector and index image.

If size and center are unchanged, nothing is done.

This version uses the geometric center of the image.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns
0 on success
-1 on error
Parameters
[in]sizeXThe new size in rows
[in]sizeYThe new size in columns

Definition at line 253 of file aperturePhotometer.hpp.

◆ resize() [2/2]

template<typename realT >
int mx::improc::aperturePhotometer< realT >::resize ( int  sizeX,
int  sizeY,
realT  xcen,
realT  ycen 
)

Resize the photometer, recalculating the radius vector and index image.

If size and center are unchanged, nothing is done.

Note
Source must be at geometric center of image.
Returns
0 on success
-1 on error
Parameters
[in]sizeXThe new size in rows
[in]sizeYThe new size in columns
xcenThe x coordinate of the center of the image. Radii are caculated relative to this point. Default is 0.5*(sizeX-1).
ycenThe y coordinate of the center of the image. Radii are caculated relative to this point. Default is 0.5*(sizeY-1).

Definition at line 177 of file aperturePhotometer.hpp.

References mx::improc::radiusImage().

Member Data Documentation

◆ m_indexIm

template<typename realT >
eigenImage<size_t> mx::improc::aperturePhotometer< realT >::m_indexIm
protected

Maps a pixel in the image to the position in the radius vector.

Definition at line 69 of file aperturePhotometer.hpp.

◆ m_radius

template<typename realT >
std::vector<realT> mx::improc::aperturePhotometer< realT >::m_radius
protected

Holds the ordered unique radii of the pixels in the image.

Definition at line 67 of file aperturePhotometer.hpp.

Referenced by mx::improc::aperturePhotometer< realT >::radius().

◆ m_sizeX

template<typename realT >
int mx::improc::aperturePhotometer< realT >::m_sizeX {0}
protected

The size of the image in X (rows).

Definition at line 61 of file aperturePhotometer.hpp.

◆ m_sizeY

template<typename realT >
int mx::improc::aperturePhotometer< realT >::m_sizeY {0}
protected

The size of the image in Y (columns).

Definition at line 62 of file aperturePhotometer.hpp.

◆ m_xcen

template<typename realT >
realT mx::improc::aperturePhotometer< realT >::m_xcen {0}
protected

The x coordinate of the center of the image. Radii are caculated relative to this point. Default is 0.5*(sizeX-1).

Definition at line 64 of file aperturePhotometer.hpp.

◆ m_ycen

template<typename realT >
realT mx::improc::aperturePhotometer< realT >::m_ycen {0}
protected

The y coordinate of the center of the image. Radii are caculated relative to this point. Default is 0.5*(sizeY-1).

Definition at line 65 of file aperturePhotometer.hpp.


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