ITK/Examples/Smoothing/BinaryMinMaxCurvatureFlowImageFilter: Difference between revisions

From KitwarePublic
< ITK‎ | Examples
Jump to navigationJump to search
(Parse input arguments at the beginning of main().)
(Deprecated content that is moved to sphinx)
 
(3 intermediate revisions by one other user 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;
    }
 
  std::string inputFileName = argv[1];
  std::string outputFileName = argv[2];
  std::stringstream ssNumIter;
  ssNumIter << argv[3];
  unsigned int numberOfIterations;
  ssNumIter >> numberOfIterations;
 
  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(inputFileName);
  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(numberOfIterations);
  filter->Update();
 
  typedef itk::ImageFileWriter< OutputImageType > WriterType;
  WriterType::Pointer writer = WriterType::New();
  writer->SetInput( filter->GetOutput() );
  writer->SetFileName(outputFileName);
  writer->Update();
 
  return EXIT_SUCCESS;
}
</source>
 
{{ITKCMakeLists|BinaryMinMaxCurvatureFlowImageFilter}}

Latest revision as of 16:53, 6 June 2019

Warning: 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.