SourceXtractorPlusPlus  0.16
Please provide a description of the project.
Classes | Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
SourceXtractor::DFTConvolution< T, TPadding > Class Template Reference

#include <DFT.h>

Collaboration diagram for SourceXtractor::DFTConvolution< T, TPadding >:
[legend]

Classes

struct  ConvolutionContext
 

Public Types

typedef T real_t
 
typedef FFT< T >::complex_t complex_t
 

Public Member Functions

 DFTConvolution (std::shared_ptr< const Image< T >> img)
 
virtual ~DFTConvolution ()=default
 
std::size_t getWidth () const
 
std::size_t getHeight () const
 
std::unique_ptr< ConvolutionContextprepare (const std::shared_ptr< const Image< T >> &model_ptr) const
 
template<typename ... Args>
void convolve (std::shared_ptr< WriteableImage< T >> image_ptr, std::unique_ptr< ConvolutionContext > &context, Args... padding_args) const
 
template<typename ... Args>
void convolve (std::shared_ptr< WriteableImage< T >> image_ptr, Args... padding_args) const
 
std::shared_ptr< const Image< T > > getKernel () const
 

Protected Member Functions

void padKernel (ConvolutionContext &context) const
 
void dumpImage (const std::shared_ptr< const Image< T >> &img, std::vector< T > &work_area) const
 

Private Attributes

std::shared_ptr< const Image< T > > m_kernel
 

Detailed Description

template<typename T = SeFloat, class TPadding = PaddedImage<T, Reflect101Coordinates>>
class SourceXtractor::DFTConvolution< T, TPadding >

Convolution strategy based on the Discrete Fourier Transform

Template Parameters
TThe pixel type
TPaddingThe padding strategy

Definition at line 47 of file DFT.h.

Member Typedef Documentation

◆ complex_t

template<typename T = SeFloat, class TPadding = PaddedImage<T, Reflect101Coordinates>>
typedef FFT<T>::complex_t SourceXtractor::DFTConvolution< T, TPadding >::complex_t

Definition at line 50 of file DFT.h.

◆ real_t

template<typename T = SeFloat, class TPadding = PaddedImage<T, Reflect101Coordinates>>
typedef T SourceXtractor::DFTConvolution< T, TPadding >::real_t

Definition at line 49 of file DFT.h.

Constructor & Destructor Documentation

◆ DFTConvolution()

template<typename T = SeFloat, class TPadding = PaddedImage<T, Reflect101Coordinates>>
SourceXtractor::DFTConvolution< T, TPadding >::DFTConvolution ( std::shared_ptr< const Image< T >>  img)
inlineexplicit

Constructor

Parameters
imgConvolution kernel

Definition at line 73 of file DFT.h.

References std::move().

Here is the call graph for this function:

◆ ~DFTConvolution()

template<typename T = SeFloat, class TPadding = PaddedImage<T, Reflect101Coordinates>>
virtual SourceXtractor::DFTConvolution< T, TPadding >::~DFTConvolution ( )
virtualdefault

Destructor

Member Function Documentation

◆ convolve() [1/2]

template<typename T = SeFloat, class TPadding = PaddedImage<T, Reflect101Coordinates>>
template<typename ... Args>
void SourceXtractor::DFTConvolution< T, TPadding >::convolve ( std::shared_ptr< WriteableImage< T >>  image_ptr,
Args...  padding_args 
) const
inline

Convolve the image with the stored kernel

Template Parameters
ArgsTypes of the parameters to be forwarded to the padding strategy
Parameters
image_ptrThe image to convolve
padding_argsForwarded to the padding strategy
Note
The context will be computed on the fly, and discarded. If multiple, similar, convolutions are to be done, use a combination of prepare/convolve

Definition at line 209 of file DFT.h.

References SourceXtractor::DFTConvolution< T, TPadding >::convolve(), std::forward(), and SourceXtractor::DFTConvolution< T, TPadding >::prepare().

Here is the call graph for this function:

◆ convolve() [2/2]

template<typename T = SeFloat, class TPadding = PaddedImage<T, Reflect101Coordinates>>
template<typename ... Args>
void SourceXtractor::DFTConvolution< T, TPadding >::convolve ( std::shared_ptr< WriteableImage< T >>  image_ptr,
std::unique_ptr< ConvolutionContext > &  context,
Args...  padding_args 
) const
inline

Convolve the image with the stored kernel, using the given context storing the pre-computed kernel transform, and pre-allocated buffers

Template Parameters
ArgsTypes of the parameters to be forwarded to the padding strategy
Parameters
image_ptrThe image to convolve
contextThe prepared context
padding_argsForwarded to the padding strategy

Definition at line 152 of file DFT.h.

References SourceXtractor::copyFFTWorkAreaToImage(), SourceXtractor::DFTConvolution< T, TPadding >::dumpImage(), SourceXtractor::FFT< T >::executeForward(), and SourceXtractor::FFT< T >::executeInverse().

Referenced by SourceXtractor::DFTConvolution< T, TPadding >::convolve(), and SourceXtractor::BgDFTConvolutionImageSource::generateTile().

Here is the call graph for this function:

◆ dumpImage()

template<typename T = SeFloat, class TPadding = PaddedImage<T, Reflect101Coordinates>>
void SourceXtractor::DFTConvolution< T, TPadding >::dumpImage ( const std::shared_ptr< const Image< T >> &  img,
std::vector< T > &  work_area 
) const
inlineprotected

Definition at line 233 of file DFT.h.

References SourceXtractor::copyImageToFFTWorkArea().

Referenced by SourceXtractor::DFTConvolution< T, TPadding >::convolve(), and SourceXtractor::DFTConvolution< T, TPadding >::padKernel().

Here is the call graph for this function:

◆ getHeight()

template<typename T = SeFloat, class TPadding = PaddedImage<T, Reflect101Coordinates>>
std::size_t SourceXtractor::DFTConvolution< T, TPadding >::getHeight ( ) const
inline
Returns
The height of the kernel

Definition at line 94 of file DFT.h.

References SourceXtractor::DFTConvolution< T, TPadding >::m_kernel.

Referenced by SourceXtractor::BgDFTConvolutionImageSource::generateTile().

◆ getKernel()

template<typename T = SeFloat, class TPadding = PaddedImage<T, Reflect101Coordinates>>
std::shared_ptr<const Image<T> > SourceXtractor::DFTConvolution< T, TPadding >::getKernel ( ) const
inline
Returns
The convolution kernel

Definition at line 218 of file DFT.h.

References SourceXtractor::DFTConvolution< T, TPadding >::m_kernel.

◆ getWidth()

template<typename T = SeFloat, class TPadding = PaddedImage<T, Reflect101Coordinates>>
std::size_t SourceXtractor::DFTConvolution< T, TPadding >::getWidth ( ) const
inline
Returns
The width of the kernel

Definition at line 86 of file DFT.h.

References SourceXtractor::DFTConvolution< T, TPadding >::m_kernel.

Referenced by SourceXtractor::BgDFTConvolutionImageSource::generateTile().

◆ padKernel()

template<typename T = SeFloat, class TPadding = PaddedImage<T, Reflect101Coordinates>>
void SourceXtractor::DFTConvolution< T, TPadding >::padKernel ( ConvolutionContext context) const
inlineprotected

◆ prepare()

template<typename T = SeFloat, class TPadding = PaddedImage<T, Reflect101Coordinates>>
std::unique_ptr<ConvolutionContext> SourceXtractor::DFTConvolution< T, TPadding >::prepare ( const std::shared_ptr< const Image< T >> &  model_ptr) const
inline

Pre-computes the transform of the kernel, adapted to the image passed by model_ptr

Parameters
model_ptrReference image. Only its size is used to compute the necessary padding, and kernel size before transformation
Returns
A context than can be used by convolve to avoid re-computing the kernel multiple times

Definition at line 106 of file DFT.h.

References SourceXtractor::FFT< T >::createForwardPlan(), SourceXtractor::FFT< T >::createInversePlan(), SourceXtractor::FFT< T >::executeForward(), SourceXtractor::fftRoundDimension(), SourceXtractor::DFTConvolution< T, TPadding >::m_kernel, and SourceXtractor::DFTConvolution< T, TPadding >::padKernel().

Referenced by SourceXtractor::DFTConvolution< T, TPadding >::convolve().

Here is the call graph for this function:

Member Data Documentation

◆ m_kernel

template<typename T = SeFloat, class TPadding = PaddedImage<T, Reflect101Coordinates>>
std::shared_ptr<const Image<T> > SourceXtractor::DFTConvolution< T, TPadding >::m_kernel
private

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