ITK/Release 4/Why Switch to ITKv4/SimplifiedITK/DiscreteGaussianFilter: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
(Created page with "=== C++ === <source lang="cpp"> // Setup image types. typedef float InputPixelType; typedef float OutputPixelType; typedef itk::Image<InputPixelType, 2> InputImageType; ...")
 
No edit summary
Line 21: Line 21:


=== WrapITK ===
=== WrapITK ===
=== SimpleITK ===
<source lang="python">
import SimpleITK
input = SimpleITK.ReadImage ( filename )
</source>
output = SimpleITK.DiscreteGaussianFilter( input, 1.0, 5 )

Revision as of 22:54, 30 August 2011

C++

<source lang="cpp">

 // Setup image types.
 typedef float InputPixelType;
 typedef float OutputPixelType;
 typedef itk::Image<InputPixelType, 2> InputImageType;
 typedef itk::Image<OutputPixelType,2> OutputImageType;
 // Filter type
 typedef itk::DiscreteGaussianImageFilter<
                InputImageType, OutputImageType >
         FilterType;
 // Create a filter
 FilterType::Pointer filter = FilterType::New();
 // Create the pipeline
 filter->SetInput( reader->GetOutput() );
 filter->SetVariance( 1.0 );
 filter->SetMaximumKernelWidth( 5 );
 filter->Update();
 OutputImageType::Pointer blurred = filter->GetOutput();

</source>

WrapITK

SimpleITK

<source lang="python"> import SimpleITK input = SimpleITK.ReadImage ( filename ) </source> output = SimpleITK.DiscreteGaussianFilter( input, 1.0, 5 )