#include #include #include #include #include #include // ------------------------------------------------------------------------- cpPluginsImageFilters::HistogramThresholdImageFilter:: HistogramThresholdImageFilter( ) : Superclass( ) { this->_AddInput( "Input" ); this->_AddInput( "Calculator" ); this->_AddInput( "Mask", false ); this->_AddOutput< cpPlugins::Image >( "Output" ); this->m_Parameters.ConfigureAsUint( "NumberOfHistogramBins" ); this->m_Parameters.ConfigureAsBool( "AutoMinimumMaximum" ); this->m_Parameters.ConfigureAsBool( "MaskOutput" ); this->m_Parameters.ConfigureAsReal( "MaskValue" ); this->m_Parameters.ConfigureAsReal( "Threshold" ); this->m_Parameters.SetUint( "NumberOfHistogramBins", 256 ); this->m_Parameters.SetBool( "AutoMinimumMaximum", true ); this->m_Parameters.SetBool( "MaskOutput", false ); this->m_Parameters.SetReal( "MaskValue", 1 ); this->m_Parameters.SetReal( "Threshold", 0 ); } // ------------------------------------------------------------------------- cpPluginsImageFilters::HistogramThresholdImageFilter:: ~HistogramThresholdImageFilter( ) { } // ------------------------------------------------------------------------- std::string cpPluginsImageFilters::HistogramThresholdImageFilter:: _GenerateData( ) { auto image = this->GetInputData( "Input" )->GetITK< itk::DataObject >( ); std::string cpPlugin_Image_Demangle_Pixel_AllScalars( r, _GD0, image, 1 ); if( r != "" ) cpPlugin_Image_Demangle_Pixel_AllScalars( r, _GD0, image, 2 ); if( r != "" ) cpPlugin_Image_Demangle_Pixel_AllScalars( r, _GD0, image, 3 ); if( r != "" ) cpPlugin_Image_Demangle_Pixel_AllScalars( r, _GD0, image, 4 ); return( r ); } // ------------------------------------------------------------------------- template< class _TImage > std::string cpPluginsImageFilters::HistogramThresholdImageFilter:: _GD0( _TImage* image ) { if( image != NULL ) return( this->_GD1< _TImage, unsigned char >( image ) ); else return( "ImageFilters::HistogramThresholdImageFilter: No valid input image." ); } // ------------------------------------------------------------------------- template< class _TImage, class _TBinaryPixel > std::string cpPluginsImageFilters::HistogramThresholdImageFilter:: _GD1( _TImage* image ) { typedef itk::Image< _TBinaryPixel, _TImage::ImageDimension > _TBinaryImage; typedef itk::HistogramThresholdImageFilter< _TImage, _TBinaryImage > _TFilter; // Get parameters // Configure filter _TFilter* filter = this->_CreateITK< _TFilter >( ); filter->SetInput( image ); filter->Update( ); // Connect output this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) ); return( "HistogramThresholdImage: not complete yet." ); } // eof - $RCSfile$