#include <cpPluginsImageFilters/BinaryThresholdImageFilter.h>
#include <cpPlugins/Image.h>
-
-#include <itkBinaryThresholdImageFilter.h>
-#include <itkBinaryThresholdImageFilter.hxx>
-#include <itkImageToImageFilter.hxx>
-#include <itkInPlaceImageFilter.hxx>
-#include <itkUnaryFunctorImageFilter.hxx>
+#include <cpPlugins_Instances/ThresholdFilters.h>
// -------------------------------------------------------------------------
cpPluginsImageFilters::BinaryThresholdImageFilter::
this->m_Parameters.SetReal( "LowerThresholdValue", 0 );
this->m_Parameters.SetReal( "UpperThresholdValue", 10000 );
- this->m_Parameters.SetUint( "InsideValue", 1 );
- this->m_Parameters.SetUint( "OutsideValue", 0 );
+ this->m_Parameters.SetReal( "InsideValue", 1 );
+ this->m_Parameters.SetReal( "OutsideValue", 0 );
+ this->m_Parameters.SetSelectedChoice( "OutputResolution", "unsigned char" );
}
// -------------------------------------------------------------------------
}
// -------------------------------------------------------------------------
-std::string cpPluginsImageFilters::BinaryThresholdImageFilter::
+void cpPluginsImageFilters::BinaryThresholdImageFilter::
_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 );
+ auto image = this->GetInputData< itk::DataObject >( "Input" );
+ cpPlugins_Image_Demangle_Pixel_AllScalars ( _GD0, image, 2 );
+ else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 3 );
+ else this->_Error( "No valid input image." );
}
// -------------------------------------------------------------------------
-template< class I >
-std::string cpPluginsImageFilters::BinaryThresholdImageFilter::
-_GD0( I* image )
+template< class _TImage >
+void cpPluginsImageFilters::BinaryThresholdImageFilter::
+_GD0( _TImage* image )
{
if( image != NULL )
- return(
- this->_GD1< I, itk::Image< unsigned char, I::ImageDimension > >(
- image
- )
- );
+ this->_GD1< _TImage, unsigned char >( image );
else
- return(
- "ImageFilters::BinaryThresholdImageFilter: No valid input image."
- );
+ this->_Error( "No valid input image." );
}
// -------------------------------------------------------------------------
-template< class I, class O >
-std::string cpPluginsImageFilters::BinaryThresholdImageFilter::
-_GD1( I* image )
+template< class _TImage, class _TBinaryPixel >
+void cpPluginsImageFilters::BinaryThresholdImageFilter::
+_GD1( _TImage* image )
{
- typedef itk::BinaryThresholdImageFilter< I, O > _F;
- typedef typename I::PixelType _IP;
- typedef typename O::PixelType _OP;
+ typedef itk::Image< _TBinaryPixel, _TImage::ImageDimension > _TBinaryImage;
+ typedef itk::BinaryThresholdImageFilter< _TImage, _TBinaryImage > _F;
+ typedef typename _TImage::PixelType _TP;
// Get parameters
- _IP lower_val = _IP( this->m_Parameters.GetReal( "LowerThresholdValue" ) );
- _IP upper_val = _IP( this->m_Parameters.GetReal( "UpperThresholdValue" ) );
- _OP in_val = _OP( this->m_Parameters.GetUint( "InsideValue" ) );
- _OP out_val = _OP( this->m_Parameters.GetUint( "OutsideValue" ) );
+ _TP lower_val = _TP( this->m_Parameters.GetReal( "LowerThresholdValue" ) );
+ _TP upper_val = _TP( this->m_Parameters.GetReal( "UpperThresholdValue" ) );
+ _TBinaryPixel in_val = _TBinaryPixel( this->m_Parameters.GetReal( "InsideValue" ) );
+ _TBinaryPixel out_val = _TBinaryPixel( this->m_Parameters.GetReal( "OutsideValue" ) );
// Configure filter
_F* filter = this->_CreateITK< _F >( );
filter->Update( );
// Connect output
- this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) );
- return( "" );
+ this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
}
// eof - $RCSfile$