ITK/Examples/SpectralAnalysis/RealAndImaginaryToComplexImageFilter

From KitwarePublic
< ITK‎ | Examples
Revision as of 15:00, 25 January 2011 by Daviddoria (talk | contribs) (Created page with "==RealAndImaginaryToComplexImageFilter.cxx== <source lang="cpp"> #include "itkImage.h" #include "itkRealAndImaginaryToComplexImageFilter.h" #include <complex> int main( int arg...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

RealAndImaginaryToComplexImageFilter.cxx

<source lang="cpp">

  1. include "itkImage.h"
  2. include "itkRealAndImaginaryToComplexImageFilter.h"
  1. include <complex>

int main( int argc, char *argv[] ) {

 typedef itk::Image<unsigned char, 2> ImageType;
 typedef itk::Image<std::complex<float>, 2> ComplexImageType;
 ImageType::Pointer realImage = ImageType::New();
 ImageType::Pointer imaginaryImage = ImageType::New();
   
 typedef itk::RealAndImaginaryToComplexImageFilter<unsigned char,unsigned char, float, 2 > RealAndImaginaryToComplexImageFilterType;
 RealAndImaginaryToComplexImageFilterType::Pointer realAndImaginaryToComplexImageFilter = RealAndImaginaryToComplexImageFilterType::New();
 realAndImaginaryToComplexImageFilter->SetInput1(realImage);
 realAndImaginaryToComplexImageFilter->SetInput2(imaginaryImage);
 realAndImaginaryToComplexImageFilter->Update();
 ComplexImageType* output = realAndImaginaryToComplexImageFilter->GetOutput();
 
 return EXIT_SUCCESS;

}

</source>

CMakeLists.txt

<source lang="cmake"> cmake_minimum_required(VERSION 2.6)

PROJECT(RealAndImaginaryToComplexImageFilter)

FIND_PACKAGE(ITK REQUIRED) INCLUDE(${ITK_USE_FILE})

ADD_EXECUTABLE(RealAndImaginaryToComplexImageFilter RealAndImaginaryToComplexImageFilter.cxx) TARGET_LINK_LIBRARIES(RealAndImaginaryToComplexImageFilter ITKIO)

</source>