mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
imageMasks.hpp File Reference

Declares and defines functions to work with image masks. More...

Declares and defines functions to work with image masks.

Author
Jared R. Males (jared.nosp@m.male.nosp@m.s@gma.nosp@m.il.c.nosp@m.om)

Definition in file imageMasks.hpp.

Go to the source code of this file.

Namespaces

 mx
 The mxlib c++ namespace.
 

Functions

template<class eigenT >
void mx::improc::radiusImage (eigenT &m, typename eigenT::Scalar xc, typename eigenT::Scalar yc, typename eigenT::Scalar scale=1)
 Fills in the cells of an Eigen 2D Array with their radius from the center. More...
 
template<class eigenT >
void mx::improc::radiusImage (eigenT &m, typename eigenT::Scalar scale=1)
 Fills in the cells of Eigen-like 2D Array with their radius from the canonical center. More...
 
template<class angleT , class eigenT >
void mx::improc::angleImage (eigenT &m, typename angleT::realT xc, typename angleT::realT yc)
 Fills in the cells of an Eigen-like 2D Array with their angle relative to the center. More...
 
template<class angleT , class eigenT >
void mx::improc::angleImage (eigenT &m)
 Fills in the cells of Eigen 2D Array with their angle relative the canonical center. More...
 
template<class angleT , class eigenT1 , class eigenT2 >
void mx::improc::radAngImage (eigenT1 &rIm, eigenT2 &qIm, typename angleT::realT xc, typename angleT::realT yc, typename angleT::realT rscale=1)
 Fills in the cells of Eigen-like arrays with their radius amd angle relative to the center. More...
 
template<typename angleT , typename eigenT1 , typename eigenT2 , typename eigenT3 = eigenT1>
std::vector< size_t > mx::improc::annulusIndices (const eigenT1 &rIm, const eigenT2 &qIm, typename angleT::realT xcen, typename angleT::realT ycen, typename angleT::realT min_r, typename angleT::realT max_r, typename angleT::realT min_q, typename angleT::realT max_q, eigenT3 *mask=0)
 Get the vector indices of an annular region in an image. More...
 
template<typename angleT >
void mx::improc::annulusBoundingRect (int &x0, int &y0, int &x1, int &y1, typename angleT::realT xcen, typename angleT::realT ycen, typename angleT::realT min_r, typename angleT::realT max_r, typename angleT::realT min_q, typename angleT::realT max_q)
 Get the coordinates of the bounding rectangle of an annulus. More...
 
template<typename realT >
std::vector< size_t > mx::improc::reflectImageIndices (const std::vector< size_t > &idxi, int w, int h, realT xc, realT yc)
 Reflect vector indices across the given center pixel. More...
 
template<class eigenT >
void mx::improc::applyMask (eigenT &maskedIm, const std::vector< size_t > &idx, typename eigenT::Scalar maskval)
 Apply a mask to an image. More...
 
template<class arrayT >
void mx::improc::maskCircle (arrayT &m, typename arrayT::Scalar xcen, typename arrayT::Scalar ycen, typename arrayT::Scalar rad, typename arrayT::Scalar val, typename arrayT::Scalar pixbuf=0.5)
 Mask a circle in an image. More...
 
template<class arrayT >
void mx::improc::maskCircle (arrayT &m, typename arrayT::Scalar rad, typename arrayT::Scalar val, typename arrayT::Scalar pixbuf=0.5)
 Mask a circle in an image at the standard center. More...
 
template<class arrayT >
void mx::improc::maskEllipse (arrayT &m, typename arrayT::Scalar xcen, typename arrayT::Scalar ycen, typename arrayT::Scalar xrad, typename arrayT::Scalar yrad, typename arrayT::Scalar ang, typename arrayT::Scalar val=0, typename arrayT::Scalar pixbuf=0.5)
 Mask an ellipse in an image. More...
 
template<typename realT >
int mx::improc::drawLine (eigenImage< realT > &mask, realT x0, realT y0, realT x1, realT y1, realT val)
 Draw a thin (1-pixel) line from one point to another. More...
 
template<typename realT >
int mx::improc::drawLine (eigenImage< realT > &mask, realT x0, realT y0, realT x1, realT y1, realT width, realT val)
 Draw a thick line from one point to another. More...
 
template<typename imT >
int mx::improc::ccdBleedMask (imT &im, typename imT::Scalar x0, typename imT::Scalar y0, typename imT::Scalar rad, typename imT::Scalar height, typename imT::Scalar lwidth, typename imT::Scalar rwidth)
 Populate a mask based on a typical CCD bleeding pattern. More...
 
template<typename imageTout , typename imageTin >
void mx::improc::cutImageRegion (imageTout &imout, const imageTin &imin, const std::vector< size_t > &idx, bool resize=true)
 Cut out a region of an image specified by an index-mask. More...
 
template<typename imageTout , typename imageTin >
void mx::improc::insertImageRegion (imageTout imout, const imageTin &imin, const std::vector< size_t > &idx)
 Insert a region of an image specified by an index-mask. More...
 
template<typename imageT , typename transformT = cubicConvolTransform<typename imageT::Scalar>>
void mx::improc::rotateMask (imageT &rotMask, imageT &mask, typename imageT::Scalar angle)
 Rotate a binary mask. More...
 

Function Documentation

◆ reflectImageIndices()

template<typename realT >
std::vector<size_t> mx::improc::reflectImageIndices ( const std::vector< size_t > &  idxi,
int  w,
int  h,
realT  xc,
realT  yc 
)

Reflect vector indices across the given center pixel.

This assumes column major order.

Returns
the vector of reflected indices
Parameters
[in]idxithe vector indices to reflect
[in]wthe image width
[in]hthe image height
[in]xcthe image center x coordinate
[in]ycthe image center y coordinate

Definition at line 312 of file imageMasks.hpp.

References mx::astro::constants::h(), mx::improc::reflectImageCoords(), and mx::improc::reflectImageIndices().

Referenced by mx::improc::reflectImageIndices().

◆ rotateMask()

template<typename imageT , typename transformT = cubicConvolTransform<typename imageT::Scalar>>
void mx::improc::rotateMask ( imageT &  rotMask,
imageT &  mask,
typename imageT::Scalar  angle 
)

Rotate a binary mask.

Sets edge pixels to 0 or 1 depending on the interpolation, being below/above 0.5.

Definition at line 822 of file imageMasks.hpp.

References mx::improc::imageRotate(), and mx::improc::rotateMask().

Referenced by mx::improc::ADIobservation< _realT, _derotFunctObj >::makeMaskCube(), and mx::improc::rotateMask().