ITK/Examples/Smoothing/SmoothingRecursiveGaussianImageFilter

From KitwarePublic
< ITK‎ | Examples
Revision as of 13:36, 10 December 2010 by Daviddoria (talk | contribs) (Created page with "==SmoothingRecursiveGaussianImageFilter.cxx== <source lang="cpp"> #include "itkImage.h" #include "itkImageFileReader.h" #include "itkDiscreteGaussianImageFilter.h" #include "itkS...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

SmoothingRecursiveGaussianImageFilter.cxx

<source lang="cpp">

  1. include "itkImage.h"
  2. include "itkImageFileReader.h"
  3. include "itkDiscreteGaussianImageFilter.h"
  4. include "itkSmoothingRecursiveGaussianImageFilter.h"
  5. include "itkCovariantVector.h"
  6. include "itkNthElementImageAdaptor.h"

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

const unsigned int Dimension = 2;
typedef unsigned char PixelComponentType;
typedef itk::Image<itk::CovariantVector< PixelComponentType, 3>,
          Dimension > ColorImageType;
                     
typedef itk::Image<PixelComponentType, Dimension >   ScalarImageType;
ColorImageType::Pointer image = ColorImageType::New();
typedef itk::NthElementImageAdaptor<ColorImageType,
           PixelComponentType> ImageAdaptorType;
ImageAdaptorType::Pointer adaptor = ImageAdaptorType::New();
adaptor->SelectNthElement(0);
adaptor->SetImage(image);
typedef itk::SmoothingRecursiveGaussianImageFilter<
   ImageAdaptorType, ScalarImageType >  filterType;
filterType::Pointer gaussianFilter = filterType::New();
gaussianFilter->SetInput(adaptor);
gaussianFilter->Update();
return EXIT_SUCCESS;

} </source>

CMakeLists.txt

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

PROJECT(SmoothingRecursiveGaussianImageFilter)

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

ADD_EXECUTABLE(SmoothingRecursiveGaussianImageFilter SmoothingRecursiveGaussianImageFilter.cxx) TARGET_LINK_LIBRARIES(SmoothingRecursiveGaussianImageFilter ITKIO)


</source>