|
|
(8 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
| ==SmoothingRecursiveGaussianImageFilter.cxx== | | {{warning|1=The media wiki content on this page is no longer maintained. The examples presented on the https://itk.org/Wiki/* pages likely require ITK version 4.13 or earlier releases. In many cases, the examples on this page no longer conform to the best practices for modern ITK versions. |
| <source lang="cpp">
| | }} |
| #include "itkImage.h"
| |
| #include "itkImageFileReader.h"
| |
| #include "itkDiscreteGaussianImageFilter.h"
| |
| #include "itkSmoothingRecursiveGaussianImageFilter.h"
| |
| #include "itkCovariantVector.h"
| |
| #include "itkNthElementImageAdaptor.h"
| |
|
| |
|
| int main(int argc, char * argv[])
| | [https://itk.org/ITKExamples[ITK Sphinx Examples]] |
| {
| |
| 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>
| |