Skip to content

Commit

Permalink
ENH: Standardize complextocomplex fft with two-arg template
Browse files Browse the repository at this point in the history
  • Loading branch information
tbirdso committed Nov 12, 2021
1 parent e32e05a commit ec145cf
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,16 @@ extern ITKFFT_EXPORT std::ostream &
* \sa ForwardFFTImageFilter
* \ingroup ITKFFT
*/
template <typename TImage>
class ITK_TEMPLATE_EXPORT ComplexToComplexFFTImageFilter : public ImageToImageFilter<TImage, TImage>
template <typename TInputImage, typename TOutputImage = TInputImage>
class ITK_TEMPLATE_EXPORT ComplexToComplexFFTImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
{
public:
ITK_DISALLOW_COPY_AND_MOVE(ComplexToComplexFFTImageFilter);

/** Input and output image types. */
using ImageType = TImage;
using InputImageType = TImage;
using OutputImageType = TImage;
using ImageType = TInputImage;
using InputImageType = TInputImage;
using OutputImageType = TOutputImage;

/** Standard class type aliases. */
using Self = ComplexToComplexFFTImageFilter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ struct DispatchFFTW_Complex_New<TSelfPointer, TImage, float>
};
#endif

template <typename TImage>
template <typename TInputImage, typename TOutputImage>
auto
ComplexToComplexFFTImageFilter<TImage>::New() -> Pointer
ComplexToComplexFFTImageFilter<TInputImage, TOutputImage>::New() -> Pointer
{
Pointer smartPtr = ObjectFactory<Self>::Create();

Expand All @@ -96,9 +96,9 @@ ComplexToComplexFFTImageFilter<TImage>::New() -> Pointer
}


template <typename TImage>
template <typename TInputImage, typename TOutputImage>
void
ComplexToComplexFFTImageFilter<TImage>::GenerateInputRequestedRegion()
ComplexToComplexFFTImageFilter<TInputImage, TOutputImage>::GenerateInputRequestedRegion()
{
Superclass::GenerateInputRequestedRegion();
// get pointers to the input and output
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,20 @@ namespace itk
*
* \sa FFTWGlobalConfiguration
*/
template <typename TImage>
class ITK_TEMPLATE_EXPORT FFTWComplexToComplexFFTImageFilter : public ComplexToComplexFFTImageFilter<TImage>
template <typename TInputImage, typename TOutputImage = TInputImage>
class ITK_TEMPLATE_EXPORT FFTWComplexToComplexFFTImageFilter
: public ComplexToComplexFFTImageFilter<TInputImage, TOutputImage>
{
public:
ITK_DISALLOW_COPY_AND_MOVE(FFTWComplexToComplexFFTImageFilter);

/** Standard class type aliases. */
using Self = FFTWComplexToComplexFFTImageFilter;
using Superclass = ComplexToComplexFFTImageFilter<TImage>;
using Superclass = ComplexToComplexFFTImageFilter<TInputImage, TOutputImage>;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;

using ImageType = TImage;
using typename Superclass::ImageType;
using PixelType = typename ImageType::PixelType;
using typename Superclass::InputImageType;
using typename Superclass::OutputImageType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
namespace itk
{

template <typename TImage>
FFTWComplexToComplexFFTImageFilter<TImage>::FFTWComplexToComplexFFTImageFilter()
template <typename TInputImage, typename TOutputImage>
FFTWComplexToComplexFFTImageFilter<TInputImage, TOutputImage>::FFTWComplexToComplexFFTImageFilter()
#ifndef ITK_USE_CUFFTW
: m_PlanRigor(FFTWGlobalConfiguration::GetPlanRigor())
#endif
Expand All @@ -47,9 +47,9 @@ FFTWComplexToComplexFFTImageFilter<TImage>::FFTWComplexToComplexFFTImageFilter()
}


template <typename TImage>
template <typename TInputImage, typename TOutputImage>
void
FFTWComplexToComplexFFTImageFilter<TImage>::BeforeThreadedGenerateData()
FFTWComplexToComplexFFTImageFilter<TInputImage, TOutputImage>::BeforeThreadedGenerateData()
{
// get pointers to the input and output
const InputImageType * input = this->GetInput();
Expand Down Expand Up @@ -102,9 +102,9 @@ FFTWComplexToComplexFFTImageFilter<TImage>::BeforeThreadedGenerateData()
}


template <typename TImage>
template <typename TInputImage, typename TOutputImage>
void
FFTWComplexToComplexFFTImageFilter<TImage>::DynamicThreadedGenerateData(
FFTWComplexToComplexFFTImageFilter<TInputImage, TOutputImage>::DynamicThreadedGenerateData(
const OutputImageRegionType & outputRegionForThread)
{
// Normalize the output if backward transform
Expand All @@ -124,9 +124,9 @@ FFTWComplexToComplexFFTImageFilter<TImage>::DynamicThreadedGenerateData(
}


template <typename TImage>
template <typename TInputImage, typename TOutputImage>
void
FFTWComplexToComplexFFTImageFilter<TImage>::UpdateOutputData(DataObject * output)
FFTWComplexToComplexFFTImageFilter<TInputImage, TOutputImage>::UpdateOutputData(DataObject * output)
{
// we need to catch that information now, because it is changed later
// during the pipeline execution, and thus can't be grabbed in
Expand All @@ -136,9 +136,9 @@ FFTWComplexToComplexFFTImageFilter<TImage>::UpdateOutputData(DataObject * output
}


template <typename TImage>
template <typename TInputImage, typename TOutputImage>
void
FFTWComplexToComplexFFTImageFilter<TImage>::PrintSelf(std::ostream & os, Indent indent) const
FFTWComplexToComplexFFTImageFilter<TInputImage, TOutputImage>::PrintSelf(std::ostream & os, Indent indent) const
{
Superclass::PrintSelf(os, indent);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,20 @@ namespace itk
* \sa VnlForwardFFTImageFilter
* \sa VnlInverseFFTImageFilter
*/
template <typename TImage>
class ITK_TEMPLATE_EXPORT VnlComplexToComplexFFTImageFilter : public ComplexToComplexFFTImageFilter<TImage>
template <typename TInputImage, typename TOutputImage = TInputImage>
class ITK_TEMPLATE_EXPORT VnlComplexToComplexFFTImageFilter
: public ComplexToComplexFFTImageFilter<TInputImage, TOutputImage>
{
public:
ITK_DISALLOW_COPY_AND_MOVE(VnlComplexToComplexFFTImageFilter);

/** Standard class type aliases. */
using Self = VnlComplexToComplexFFTImageFilter;
using Superclass = ComplexToComplexFFTImageFilter<TImage>;
using Superclass = ComplexToComplexFFTImageFilter<TInputImage, TOutputImage>;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;

using ImageType = TImage;
using typename Superclass::ImageType;
using PixelType = typename ImageType::PixelType;
using typename Superclass::InputImageType;
using typename Superclass::OutputImageType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@
namespace itk
{

template <typename TImage>
VnlComplexToComplexFFTImageFilter<TImage>::VnlComplexToComplexFFTImageFilter()
template <typename TInputImage, typename TOutputImage>
VnlComplexToComplexFFTImageFilter<TInputImage, TOutputImage>::VnlComplexToComplexFFTImageFilter()
{
this->DynamicMultiThreadingOn();
}


template <typename TImage>
template <typename TInputImage, typename TOutputImage>
void
VnlComplexToComplexFFTImageFilter<TImage>::BeforeThreadedGenerateData()
VnlComplexToComplexFFTImageFilter<TInputImage, TOutputImage>::BeforeThreadedGenerateData()
{
const ImageType * input = this->GetInput();
ImageType * output = this->GetOutput();
Expand Down Expand Up @@ -75,9 +75,9 @@ VnlComplexToComplexFFTImageFilter<TImage>::BeforeThreadedGenerateData()
}


template <typename TImage>
template <typename TInputImage, typename TOutputImage>
void
VnlComplexToComplexFFTImageFilter<TImage>::DynamicThreadedGenerateData(
VnlComplexToComplexFFTImageFilter<TInputImage, TOutputImage>::DynamicThreadedGenerateData(
const OutputImageRegionType & outputRegionForThread)
{
// Normalize the output if backward transform
Expand Down

0 comments on commit ec145cf

Please sign in to comment.