ITK/Examples/Smoothing/SmoothingRecursiveGaussianImageFilter

From KitwarePublic
< ITK‎ | Examples
Revision as of 08: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

#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkDiscreteGaussianImageFilter.h"
#include "itkSmoothingRecursiveGaussianImageFilter.h"
#include "itkCovariantVector.h"
#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;
}

CMakeLists.txt

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)