#include "BinaryThreshold.h" #include #include #include // ------------------------------------------------------------------------- void fpaPlugins_ImageFunctors::BinaryThreshold:: Instantiate( itk::LightObject* filter ) { auto itk_filter = dynamic_cast< itk::ProcessObject* >( filter ); if( itk_filter != NULL ) { auto inputs = itk_filter->GetInputs( ); if( inputs.size( ) > 0 ) { cpPlugins_Demangle_Image_ScalarPixels_AllDims_2( inputs[ 0 ].GetPointer( ), _GD0, itk_filter ) this->_Error( "Invalid input data." ); } else this->_Error( "Not enough inputs." ); } else this->_Error( "Invalid instantiation filter." ); } // ------------------------------------------------------------------------- fpaPlugins_ImageFunctors::BinaryThreshold:: BinaryThreshold( ) : Superclass( ) { this->_ConfigureOutput< cpPlugins::Pipeline::DataObject >( "Functor" ); this->GetOutput( "Functor" )->SetITK( this ); this->m_Parameters.ConfigureAsReal( "Lower", 0 ); this->m_Parameters.ConfigureAsReal( "Upper", 1 ); } // ------------------------------------------------------------------------- fpaPlugins_ImageFunctors::BinaryThreshold:: ~BinaryThreshold( ) { } // ------------------------------------------------------------------------- void fpaPlugins_ImageFunctors::BinaryThreshold:: _GenerateData( ) { } // ------------------------------------------------------------------------- template< class _TInput > void fpaPlugins_ImageFunctors::BinaryThreshold:: _GD0( _TInput* input, itk::ProcessObject* filter ) { auto outputs = filter->GetOutputs( ); if( outputs.size( ) > 0 ) { cpPlugins_Demangle_Image_IntPixels_3( outputs[ 0 ].GetPointer( ), _GD1, _TInput::ImageDimension, input, filter ) this->_Error( "Invalid output data." ); } else this->_Error( "Not enough outputs." ); } // ------------------------------------------------------------------------- template< class _TInput, class _TOutput > void fpaPlugins_ImageFunctors::BinaryThreshold:: _GD1( _TOutput* output, _TInput* input, itk::ProcessObject* filter ) { typedef typename _TOutput::PixelType _TValue; typedef fpa::Image::Functors::RegionGrow::BinaryThreshold< _TInput, _TValue > _TFunctor; auto f = dynamic_cast< _TFunctor* >( this->m_Functor.GetPointer( ) ); if( f == NULL ) { typename _TFunctor::Pointer ptr_f = _TFunctor::New( ); f = ptr_f.GetPointer( ); this->m_Functor = f; } // fi f->SetLower( this->m_Parameters.GetReal( "Lower" ) ); f->SetUpper( this->m_Parameters.GetReal( "Upper" ) ); } // eof - $RCSfile$