|
|
(4 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
| ==BinaryMinMaxCurvatureFlowImageFilter.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 "itkImageFileWriter.h"
| |
| #include "itkBinaryMinMaxCurvatureFlowImageFilter.h"
| |
| | |
| int main(int argc, char* argv[])
| |
| {
| |
| if( argc != 4 )
| |
| {
| |
| std::cerr << argv[0] << " InputFileName OutputFileName NumberOfIterations" <<std ::endl;
| |
| return EXIT_FAILURE;
| |
| }
| |
| const unsigned int Dimension = 3; | |
| | |
| typedef unsigned char InputPixelType;
| |
| typedef float OutputPixelType;
| |
| | |
| typedef itk::Image< InputPixelType, Dimension > InputImageType;
| |
| typedef itk::ImageFileReader< InputImageType > ReaderType;
| |
| | |
| ReaderType::Pointer reader = ReaderType::New();
| |
| reader->SetFileName( argv[1] );
| |
| reader->Update();
| |
| | |
| typedef itk::Image< OutputPixelType, Dimension > OutputImageType;
| |
| | |
| typedef itk::BinaryMinMaxCurvatureFlowImageFilter< InputImageType, OutputImageType > FilterType;
| |
| FilterType::Pointer filter = FilterType::New();
| |
| filter->SetInput( reader->GetOutput() );
| |
| filter->SetThreshold( 255 );
| |
| filter->SetNumberOfIterations( atoi( argv[3] ) );
| |
| filter->Update();
| |
| | |
| typedef itk::ImageFileWriter< OutputImageType > WriterType;
| |
| WriterType::Pointer writer = WriterType::New();
| |
| writer->SetInput( filter->GetOutput() );
| |
| writer->SetFileName( argv[2] );
| |
| writer->Update();
| |
| | |
| return EXIT_SUCCESS;
| |
| }
| |
| </source>
| |
| | |
| {{ITKCMakeLists|BinaryMinMaxCurvatureFlowImageFilter}}
| |