ITK/Examples/Smoothing/BinaryMinMaxCurvatureFlowImageFilter: Difference between revisions

From KitwarePublic
< ITK‎ | Examples
Jump to navigationJump to search
(Created page with "#include "itkImage.h" #include "itkImageFileReader.h" #include "itkImageFileWriter.h" #include "itkBinaryMinMaxCurvatureFlowImageFilter.h" int main(int argc, char* argv[]) { i...")
 
(Deprecated content that is moved to sphinx)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
#include "itkImage.h"
{{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.}}
#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::BinaryThresholdImageFilter< OutputImageType, InputImageType >
    BinaryThresholdImageFilterType;
 
  BinaryThresholdImageFilterType::Pointer thresholdFilter
    = BinaryThresholdImageFilterType::New();
  thresholdFilter->SetInput(filter->GetOutput());
  thresholdFilter->SetLowerThreshold(0.);
  thresholdFilter->SetInsideValue(255);
  thresholdFilter->SetOutsideValue(0);
*/
  typedef itk::ImageFileWriter< OutputImageType > WriterType;
  WriterType::Pointer writer = WriterType::New();
  writer->SetInput( filter->GetOutput() );
  writer->SetFileName( argv[2] );
  writer->Update();
 
  return EXIT_SUCCESS;
}

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.