#include #include #include #include // ------------------------------------------------------------------------- cpPluginsImageArithmeticFilters::PowImageFilter:: PowImageFilter( ) : Superclass( ) { typedef cpPlugins::DataObjects::Image _TImage; this->_ConfigureInput< _TImage >( "Input1", true, false ); this->_ConfigureInput< _TImage >( "Input2", true, false ); this->_ConfigureOutput< _TImage >( "Output" ); this->m_Parameters.ConfigureAsReal( "Constant", 1 ); } // ------------------------------------------------------------------------- cpPluginsImageArithmeticFilters::PowImageFilter:: ~PowImageFilter( ) { } // ------------------------------------------------------------------------- void cpPluginsImageArithmeticFilters::PowImageFilter:: _GenerateData( ) { auto o = this->GetInputData( "Input1" ); cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 ) this->_Error( "Invalid input image (0)." ); } // ------------------------------------------------------------------------- template< class _TInput1 > void cpPluginsImageArithmeticFilters::PowImageFilter:: _GD0( _TInput1* input1 ) { auto input2 = this->GetInputData< _TInput1 >( "Input2" ); if( input2 == NULL ) this->_Error( "Incompatible second input image." ); this->_GD1( input2, input1 ); } // ------------------------------------------------------------------------- template< class _TInput2, class _TInput1 > void cpPluginsImageArithmeticFilters::PowImageFilter:: _GD1( _TInput2* input2, _TInput1* input1 ) { typedef itk::PowImageFilter< _TInput1, _TInput2, _TInput1 > _TFilter; // Configure filter auto filter = this->_CreateITK< _TFilter >( ); filter->SetInput1( input1 ); filter->SetInput2( input2 ); filter->Update( ); // Connect output this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); } // eof - $RCSfile$ /* TODO filter->SetInput1( image0 ); auto image1 = this->GetInputData< _TImage >( "Input1" ); if( image1 == NULL ) filter->SetConstant( this->m_Parameters.GetReal( "Constant" ) ); else filter->SetInput2( image1 ); filter->Update( ); // Connect output this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); */ // eof - $RCSfile$