#include <cpPluginsImageFilters/OtsuThresholdImageFilter.h>
#include <cpPlugins/Image.h>
+#include <cpPlugins_ITKInstances/ImageFilters.h>
#include <itkOtsuThresholdImageFilter.h>
-#include <itkBinaryFunctorImageFilter.hxx>
-#include <itkHistogram.hxx>
-#include <itkHistogramAlgorithmBase.hxx>
-#include <itkHistogramThresholdImageFilter.hxx>
-#include <itkImageToHistogramFilter.hxx>
-#include <itkMaskedImageToHistogramFilter.hxx>
#include <itkOtsuMultipleThresholdsCalculator.hxx>
#include <itkOtsuThresholdCalculator.hxx>
+/*
+ #include <itkHistogram.hxx>
+ #include <itkHistogramAlgorithmBase.hxx>
+ #include <itkHistogramThresholdImageFilter.hxx>
+ #include <itkImageToHistogramFilter.hxx>
+ #include <itkMaskedImageToHistogramFilter.hxx>
+*/
// -------------------------------------------------------------------------
cpPluginsImageFilters::OtsuThresholdImageFilter::
}
// -------------------------------------------------------------------------
-template< class I >
+template< class _TImage >
std::string cpPluginsImageFilters::OtsuThresholdImageFilter::
-_GD0( I* image )
+_GD0( _TImage* image )
{
if( image != NULL )
return(
- this->_GD1< I, itk::Image< unsigned char, I::ImageDimension > >( image )
+ this->_GD1< _TImage, itk::Image< unsigned char, _TImage::ImageDimension > >( image )
);
else
return( "ImageFilters::OtsuThresholdImageFilter: No valid input image." );
}
// -------------------------------------------------------------------------
-template< class I, class O >
+template< class _TImage, class _TBinaryImage >
std::string cpPluginsImageFilters::OtsuThresholdImageFilter::
-_GD1( I* image )
+_GD1( _TImage* image )
{
- typedef itk::OtsuThresholdImageFilter< I, O > _F;
- typedef typename O::PixelType _OP;
+ typedef itk::OtsuThresholdImageFilter< _TImage, _TBinaryImage > _F;
+ typedef typename _TBinaryImage::PixelType _UP;
// Get parameters
unsigned int bins = this->m_Parameters.GetUint( "NumberOfHistogramBins" );
- _OP in_val = _OP( this->m_Parameters.GetUint( "InsideValue" ) );
- _OP out_val = _OP( this->m_Parameters.GetUint( "OutsideValue" ) );
+ _UP in_val = _UP( this->m_Parameters.GetUint( "InsideValue" ) );
+ _UP out_val = _UP( this->m_Parameters.GetUint( "OutsideValue" ) );
// Configure filter
_F* filter = this->_CreateITK< _F >( );
- filter->SetInput( dynamic_cast< I* >( image ) );
+ filter->SetInput( image );
filter->SetNumberOfHistogramBins( bins );
filter->SetInsideValue( out_val ); // WARNING: these are inverted
filter->SetOutsideValue( in_val );