-#ifndef __fpa__Image__MoriRegionGrow__h__
-#define __fpa__Image__MoriRegionGrow__h__
+#ifndef __fpa__Image__MoriFilter__h__
+#define __fpa__Image__MoriFilter__h__
#include <itkImageToImageFilter.h>
#include <itkBinaryThresholdImageFilter.h>
-#include <fpa/Image/MoriRegionGrowHelper.h>
+#include <fpa/Image/MoriFilterHelper.h>
namespace fpa
{
/**
*/
template< class _TInputImage, class _TOutputImage, class _TAuxPixel = unsigned short >
- class MoriRegionGrow
+ class MoriFilter
: public itk::ImageToImageFilter< _TInputImage, _TOutputImage >
{
public:
- typedef MoriRegionGrow Self;
+ typedef MoriFilter Self;
typedef itk::ImageToImageFilter< _TInputImage, _TOutputImage > Superclass;
typedef itk::SmartPointer< Self > Pointer;
typedef itk::SmartPointer< const Self > ConstPointer;
typedef itk::Image< _TAuxPixel, _TInputImage::ImageDimension > TAuxImage;
- typedef fpa::Image::MoriRegionGrowHelper< _TInputImage, TAuxImage > THelper;
+ typedef fpa::Image::MoriFilterHelper< _TInputImage, TAuxImage > THelper;
typedef itk::BinaryThresholdImageFilter< TAuxImage, _TOutputImage > TThreshold;
typedef typename _TInputImage::IndexType TIndex;
public:
itkNewMacro( Self );
- itkTypeMacro( fpa::Image::MoriRegionGrow, itk::ImageToImageFilter );
+ itkTypeMacro( fpa::Image::MoriFilter, itk::ImageToImageFilter );
itkGetConstMacro( Seed, TIndex );
itkSetMacro( Seed, TIndex );
void SetLower( const TInputPixel& v );
void SetUpper( const TInputPixel& v );
void SetStep( const TInputPixel& v );
+ void SetThresholdRange(
+ const TInputPixel& l, const TInputPixel& u,
+ const TInputPixel& s = TInputPixel( 1 )
+ );
void SetInsideValue( const TOutputPixel& v );
void SetOutsideValue( const TOutputPixel& v );
*/
protected:
- MoriRegionGrow( );
- virtual ~MoriRegionGrow( );
+ MoriFilter( );
+ virtual ~MoriFilter( );
virtual void GenerateData( ) override;
private:
// Purposely not defined
- MoriRegionGrow( const Self& other );
+ MoriFilter( const Self& other );
Self& operator=( const Self& other );
protected:
} // ecapseman
#ifndef ITK_MANUAL_INSTANTIATION
-# include <fpa/Image/MoriRegionGrow.hxx>
+# include <fpa/Image/MoriFilter.hxx>
#endif // ITK_MANUAL_INSTANTIATION
-#endif // __fpa__Image__MoriRegionGrow__h__
+#endif // __fpa__Image__MoriFilter__h__
// eof - $RCSfile$
-#ifndef __fpa__Image__MoriRegionGrow__hxx__
-#define __fpa__Image__MoriRegionGrow__hxx__
+#ifndef __fpa__Image__MoriFilter__hxx__
+#define __fpa__Image__MoriFilter__hxx__
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
typename
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
TAuxImage*
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
GetAuxiliaryImage( )
{
return( this->m_Helper->GetOutput( ) );
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
const typename
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
TAuxImage*
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
GetAuxiliaryImage( ) const
{
return( this->m_Helper->GetOutput( ) );
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
typename
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
TInputPixel
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
GetLower( ) const
{
return( this->m_Helper->GetLower( ) );
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
typename
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
TInputPixel
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
GetUpper( ) const
{
return( this->m_Helper->GetUpper( ) );
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
typename
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
TInputPixel
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
GetStep( ) const
{
return( this->m_Helper->GetStep( ) );
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
typename
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
TOutputPixel
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
GetInsideValue( ) const
{
return( this->m_Threshold->GetInsideValue( ) );
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
typename
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
TOutputPixel
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
GetOutsideValue( ) const
{
return( this->m_Threshold->GetInsideValue( ) );
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-void fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+void fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
SetLower( const TInputPixel& v )
{
this->m_Helper->SetLower( v );
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-void fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+void fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
SetUpper( const TInputPixel& v )
{
this->m_Helper->SetUpper( v );
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-void fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+void fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
SetStep( const TInputPixel& v )
{
this->m_Helper->SetStep( v );
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-void fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+void fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
+SetThresholdRange(
+ const TInputPixel& l, const TInputPixel& u, const TInputPixel& s
+ )
+{
+ this->SetLower( l );
+ this->SetUpper( u );
+ this->SetStep( s );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
+void fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
SetInsideValue( const TOutputPixel& v )
{
this->m_Threshold->SetInsideValue( v );
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-void fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+void fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
SetOutsideValue( const TOutputPixel& v )
{
this->m_Threshold->SetOutsideValue( v );
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-MoriRegionGrow( )
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
+MoriFilter( )
: Superclass( )
{
this->m_Helper = THelper::New( );
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-~MoriRegionGrow( )
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
+~MoriFilter( )
{
}
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-void fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+void fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
GenerateData( )
{
this->m_Helper->ClearSeeds( );
- this->m_Helper->AddSeed( this->m_Seed, 0 );
+ this->m_Helper->AddSeed( this->m_Seed, this->GetOutsideValue( ) );
this->m_Helper->SetInput( this->GetInput( ) );
this->m_Helper->Update( );
this->GetOutput( )->Graft( this->m_Threshold->GetOutput( ) );
}
-#endif // __fpa__Image__MoriRegionGrow__hxx__
+#endif // __fpa__Image__MoriFilter__hxx__
// eof - $RCSfile$
-#ifndef __fpa__Image__MoriRegionGrowHelper__hxx__
-#define __fpa__Image__MoriRegionGrowHelper__hxx__
+#ifndef __fpa__Image__MoriFilterHelper__hxx__
+#define __fpa__Image__MoriFilterHelper__hxx__
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage >
-fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
-MoriRegionGrowHelper( )
+fpa::Image::MoriFilterHelper< _TInputImage, _TOutputImage >::
+MoriFilterHelper( )
: Superclass( ),
m_Step( TPixel( 1 ) )
{
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage >
-fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
-~MoriRegionGrowHelper( )
+fpa::Image::MoriFilterHelper< _TInputImage, _TOutputImage >::
+~MoriFilterHelper( )
{
}
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage >
-bool fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
+bool fpa::Image::MoriFilterHelper< _TInputImage, _TOutputImage >::
_ContinueGenerateData( )
{
TBinThresholdFunction* functor =
// Update flooding data
this->m_Curve.push_back( TCurveData( u, this->m_ActualCount ) );
+ std::cout << u << " " << this->m_ActualCount << std::endl;
// Update thresholds
if( u < this->m_Upper )
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage >
-void fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
+void fpa::Image::MoriFilterHelper< _TInputImage, _TOutputImage >::
_BeforeGenerateData( )
{
this->Superclass::_BeforeGenerateData( );
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage >
-void fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
+void fpa::Image::MoriFilterHelper< _TInputImage, _TOutputImage >::
_AfterGenerateData( )
{
typedef typename _TOutputImage::PixelType _TOut;
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage >
-void fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
+void fpa::Image::MoriFilterHelper< _TInputImage, _TOutputImage >::
_BeforeLoop( )
{
this->Superclass::_BeforeLoop( );
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage >
-void fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
+void fpa::Image::MoriFilterHelper< _TInputImage, _TOutputImage >::
_AfterLoop( )
{
this->Superclass::_AfterLoop( );
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage >
-bool fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
+bool fpa::Image::MoriFilterHelper< _TInputImage, _TOutputImage >::
_UpdateValue( _TQueueNode& v, const _TQueueNode& p )
{
typedef typename _TOutputImage::PixelType _TOut;
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage >
-void fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
+void fpa::Image::MoriFilterHelper< _TInputImage, _TOutputImage >::
_UpdateResult( const _TQueueNode& n )
{
this->Superclass::_UpdateResult( n );
this->m_ActualCount += 1;
}
-#endif // __fpa__Image__MoriRegionGrowHelper__hxx__
+#endif // __fpa__Image__MoriFilterHelper__hxx__
// eof - $RCSfile$