mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
|
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.
realT | the 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... | |
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.
[out] | cumPhot | the cumulative photometry at each point in the radius vector. Resized. |
[in] | im | the 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.
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.
[out] | cumPhot | the 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] | im | the 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.
|
protected |
Get the cumulative photometry of an image as a function of radius.
This is called by the public cumPhot functions.
[out] | cumPhot | the cumulative photometry at each point in the radius vector. Resized. |
[out] | deltaPhot | if not `nullptr`, this vector is filled with the sum at each radius. |
[in] | im | the 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().
|
inline |
Get the radius value at an index of the vector.
[in] | i | the index of the radius vector |
Definition at line 153 of file aperturePhotometer.hpp.
References mx::improc::aperturePhotometer< realT >::m_radius.
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.
[in] | sizeX | The new size in rows |
[in] | sizeY | The new size in columns |
Definition at line 253 of file aperturePhotometer.hpp.
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.
[in] | sizeX | The new size in rows |
[in] | sizeY | The new size in columns |
xcen | The x coordinate of the center of the image. Radii are caculated relative to this point. Default is 0.5*(sizeX-1). | |
ycen | 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 177 of file aperturePhotometer.hpp.
References mx::improc::radiusImage().
|
protected |
Maps a pixel in the image to the position in the radius vector.
Definition at line 69 of file aperturePhotometer.hpp.
|
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().
|
protected |
The size of the image in X (rows).
Definition at line 61 of file aperturePhotometer.hpp.
|
protected |
The size of the image in Y (columns).
Definition at line 62 of file aperturePhotometer.hpp.
|
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.
|
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.