mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
Loading...
Searching...
No Matches

template<class kernelT>
struct mx::improc::precalcKernel< kernelT >

A kernel that is pre-calculated for the entire image, useful for repeated applications.

Use this for spatially variable kernels. It is not needed for, e.g., the symmetric Gaussian.

Template Parameters
kernelTis the kernel type. See above for the requirements on kernelT.

Definition at line 390 of file imageFilters.hpp.

#include <improc/imageFilters.hpp>

Public Member Functions

 precalcKernel ()=delete
 Disallow construction without a production kernel and image geometry.
 precalcKernel (const kernelT &kernel, uint32_t rows, uint32_t cols, arithT xcen, arithT ycen)
 Pre-calculate a production kernel for every coordinate in an image.
int maxWidth () const
 Get the maximum half-width reported by the cached production kernel.
error_t setKernel (arithT x, arithT y, arrayT &kernel) const
 Retrieve the cached kernel at an integral image-relative coordinate.

Public Attributes

kernelT m_kernel
 copied production kernel used to populate the cache.
uint32_t m_rows
 number of image rows represented by the cache.
uint32_t m_cols
 number of image columns represented by the cache.
arithT m_xcen
 pixel x-coordinate of the image center.
arithT m_ycen
 pixel y-coordinate of the image center.
int m_maxWidth
 maximum half-width reported by the copied production kernel.
std::vector< arrayT > m_kernels
 generated kernels in column-major image-coordinate order.

Constructor & Destructor Documentation

◆ precalcKernel() [1/2]

template<class kernelT>
mx::improc::precalcKernel< kernelT >::precalcKernel ( )
delete

Disallow construction without a production kernel and image geometry.

◆ precalcKernel() [2/2]

template<class kernelT>
mx::improc::precalcKernel< kernelT >::precalcKernel ( const kernelT & kernel,
uint32_t rows,
uint32_t cols,
arithT xcen,
arithT ycen )
inline

Pre-calculate a production kernel for every coordinate in an image.

Exceptions
mx::exceptionwhen the production kernel cannot generate any cache entry.
Parameters
[in]kernelA fully initialized kernel. Is copied.
[in]rowsThe rows in the images to be filtered
[in]colsThe columns in the images to be filtered
[in]xcenThe pixel x-coordinate of the center of the image
[in]ycenThe pixel y-coordinate of the center of the image

Definition at line 412 of file imageFilters.hpp.

References mx::exception, m_cols, m_kernel, m_kernels, m_maxWidth, m_rows, m_xcen, m_ycen, and mx::noerror.

Member Function Documentation

◆ maxWidth()

template<class kernelT>
int mx::improc::precalcKernel< kernelT >::maxWidth ( ) const
inline

Get the maximum half-width reported by the cached production kernel.

Definition at line 441 of file imageFilters.hpp.

References m_maxWidth.

◆ setKernel()

template<class kernelT>
error_t mx::improc::precalcKernel< kernelT >::setKernel ( arithT x,
arithT y,
arrayT & kernel ) const
inline

Retrieve the cached kernel at an integral image-relative coordinate.

Parameters
[in]xx-coordinate relative to image center
[in]yx-coordinate relative to image center
[in]kernelthe array to populate with the kernel, resized

Definition at line 447 of file imageFilters.hpp.

References mx::invalidarg, mx::invalidconfig, mx::math::isFinite(), m_cols, m_kernels, m_rows, m_xcen, m_ycen, and mx::noerror.

Referenced by unitTest::improcTest::imageFiltersTest::TEST_CASE(), unitTest::improcTest::imageFiltersTest::TEST_CASE(), and unitTest::improcTest::imageFiltersTest::TEST_CASE().

Member Data Documentation

◆ m_cols

template<class kernelT>
uint32_t mx::improc::precalcKernel< kernelT >::m_cols

number of image columns represented by the cache.

Definition at line 399 of file imageFilters.hpp.

Referenced by precalcKernel(), and setKernel().

◆ m_kernel

template<class kernelT>
kernelT mx::improc::precalcKernel< kernelT >::m_kernel

copied production kernel used to populate the cache.

Definition at line 396 of file imageFilters.hpp.

Referenced by precalcKernel().

◆ m_kernels

template<class kernelT>
std::vector<arrayT> mx::improc::precalcKernel< kernelT >::m_kernels

generated kernels in column-major image-coordinate order.

Definition at line 405 of file imageFilters.hpp.

Referenced by precalcKernel(), setKernel(), unitTest::improcTest::imageFiltersTest::TEST_CASE(), and unitTest::improcTest::imageFiltersTest::TEST_CASE().

◆ m_maxWidth

template<class kernelT>
int mx::improc::precalcKernel< kernelT >::m_maxWidth

maximum half-width reported by the copied production kernel.

Definition at line 403 of file imageFilters.hpp.

Referenced by precalcKernel(), and maxWidth().

◆ m_rows

template<class kernelT>
uint32_t mx::improc::precalcKernel< kernelT >::m_rows

number of image rows represented by the cache.

Definition at line 398 of file imageFilters.hpp.

Referenced by precalcKernel(), and setKernel().

◆ m_xcen

template<class kernelT>
arithT mx::improc::precalcKernel< kernelT >::m_xcen

pixel x-coordinate of the image center.

Definition at line 400 of file imageFilters.hpp.

Referenced by precalcKernel(), and setKernel().

◆ m_ycen

template<class kernelT>
arithT mx::improc::precalcKernel< kernelT >::m_ycen

pixel y-coordinate of the image center.

Definition at line 401 of file imageFilters.hpp.

Referenced by precalcKernel(), and setKernel().


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