1 #include <ITKUnaryFunctorFilters/InvertIntensityImageFilter.h>
2 #include <cpInstances/DataObjects/Image.h>
4 #include <itkInvertIntensityImageFilter.h>
6 // -------------------------------------------------------------------------
7 cpPluginsITKUnaryFunctorFilters::InvertIntensityImageFilter::
8 InvertIntensityImageFilter( )
11 typedef cpInstances::DataObjects::Image _TImage;
13 this->_ConfigureInput< _TImage >( "Input", true, false );
14 this->_ConfigureOutput< _TImage >( "Output" );
15 this->m_Parameters.ConfigureAsUint( "Maximum", 1 );
18 // -------------------------------------------------------------------------
19 cpPluginsITKUnaryFunctorFilters::InvertIntensityImageFilter::
20 ~InvertIntensityImageFilter( )
24 // -------------------------------------------------------------------------
25 void cpPluginsITKUnaryFunctorFilters::InvertIntensityImageFilter::
28 auto o = this->GetInputData( "Input" );
29 cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 )
30 this->_Error( "Invalid input image." );
33 // -------------------------------------------------------------------------
34 template< class _TImage >
35 void cpPluginsITKUnaryFunctorFilters::InvertIntensityImageFilter::
36 _GD0( _TImage* image )
38 typedef itk::InvertIntensityImageFilter< _TImage > _TFilter;
41 auto filter = this->_CreateITK< _TFilter >( );
42 filter->SetInput( image );
43 filter->SetMaximum( this->m_Parameters.GetUint( "Maximum" ) );
45 this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );