Skip to content

Commit

Permalink
BUG: Use real image type as input of Hilbert filter
Browse files Browse the repository at this point in the history
  • Loading branch information
arobert01 committed Apr 7, 2020
1 parent bd5e6dd commit 0d135b4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions include/rtkExtractPhaseImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <itkConvolutionImageFilter.h>
#include <itkSubtractImageFilter.h>
#include <itkConvolutionImageFilter.h>
#include <itkNumericTraits.h>
namespace rtk
{

Expand Down Expand Up @@ -67,19 +68,24 @@ ExtractPhaseImageFilter<TImage>::GenerateData()
conv2->SetInput(conv->GetOutput());
conv2->SetKernelImage(kernel2);

using SubtractType = itk::SubtractImageFilter<TImage, TImage>;
// Define real image type for FFT
using InputPixelType = typename TImage::PixelType;
using RealOutputPixelType = typename itk::NumericTraits<InputPixelType>::RealType;
using RealOutputImageType = itk::Image<RealOutputPixelType, 1>;

using SubtractType = itk::SubtractImageFilter<TImage, TImage, RealOutputImageType>;
typename SubtractType::Pointer sub = SubtractType::New();
sub->SetInput1(conv->GetOutput());
sub->SetInput2(conv2->GetOutput());
sub->InPlaceOff();
sub->Update();

// Define FFT output type (complex)
using ComplexType = std::complex<double>;
using ComplexType = std::complex<RealOutputPixelType>;
using ComplexSignalType = itk::Image<ComplexType, 1>;

// Hilbert transform
using HilbertType = rtk::HilbertImageFilter<TImage, ComplexSignalType>;
using HilbertType = rtk::HilbertImageFilter<RealOutputImageType, ComplexSignalType>;
typename HilbertType::Pointer hilbert = HilbertType::New();
hilbert->SetInput(sub->GetOutput());

Expand Down

0 comments on commit 0d135b4

Please sign in to comment.