ITK/Examples/Smoothing/MinMaxCurvatureFlowImageFilter: Difference between revisions

From KitwarePublic
< ITK‎ | Examples
Jump to navigationJump to search
(Created page with "==MinMaxCurvatureFlowImageFilter.cxx== <source lang="cpp"> #include "itkImage.h" #include "itkCastImageFilter.h" #include "itkMinMaxCurvatureFlowImageFilter.h" #include "itkSubtr...")
 
(Deprecated content that is moved to sphinx)
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
==MinMaxCurvatureFlowImageFilter.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 "itkCastImageFilter.h"
#include "itkMinMaxCurvatureFlowImageFilter.h"
#include "itkSubtractImageFilter.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
 
int main( int argc, char *argv[])
{
  if( argc < 2 )
    {
    std::cerr << "Usage: " << argv[0];
    std::cerr << " inputImage [iterations]" << std::endl;
    return EXIT_FAILURE;
    }
 
  std::string inputFileName = argv[1];
 
  int iterations = 5;
  if (argc > 2)
    {
    std::stringstream ss(argv[2]);
    ss >> iterations;
    }
 
  typedef  float          InternalPixelType;
  const    unsigned int    Dimension = 2;
  typedef itk::Image< InternalPixelType, Dimension > ImageType;
 
   typedef  itk::ImageFileReader< ImageType > ReaderType;
  ReaderType::Pointer reader = ReaderType::New();
  reader->SetFileName( argv[1] );
  reader->Update();
 
  typedef itk::MinMaxCurvatureFlowImageFilter< ImageType, ImageType > MinMaxCurvatureFlowImageFilterType;
  MinMaxCurvatureFlowImageFilterType::Pointer minMaxCurvatureFlowImageFilter = MinMaxCurvatureFlowImageFilterType::New();
  minMaxCurvatureFlowImageFilter->SetInput( reader->GetOutput() );
  minMaxCurvatureFlowImageFilter->SetNumberOfIterations( iterations );
  minMaxCurvatureFlowImageFilter->SetTimeStep( 0.125 );
  minMaxCurvatureFlowImageFilter->Update();
 
  return EXIT_SUCCESS;
}
 
</source>
 
{{ITKVTKCMakeLists|MinMaxCurvatureFlowImageFilter|}}

Latest revision as of 17:28, 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.