#ifndef __CTBronchi__MoriLabelling__hxx__
#define __CTBronchi__MoriLabelling__hxx__
-#include <itkImageRegionConstIterator.h>
-#include <itkImageRegionIterator.h>
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TLabelImage >
-const _TLabelImage*
-CTBronchi::MoriLabelling< _TInputImage, _TLabelImage >::
-GetInputLabelImage( ) const
-{
- return( this->GetInput( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TLabelImage >
-void CTBronchi::MoriLabelling< _TInputImage, _TLabelImage >::
-SetInputLabelImage( TLabelImage* image )
-{
- this->SetInput( image );
-}
-
// -------------------------------------------------------------------------
template< class _TInputImage, class _TLabelImage >
-const _TInputImage*
-CTBronchi::MoriLabelling< _TInputImage, _TLabelImage >::
-GetInputRawImage( ) const
+typename CTBronchi::MoriLabelling< _TInputImage, _TLabelImage >::
+TInputValue CTBronchi::MoriLabelling< _TInputImage, _TLabelImage >::
+GetUpperThreshold( ) const
{
- return(
- dynamic_cast< const TInputImage* >(
- this->itk::ProcessObject::GetInput( 1 )
- )
- );
+ return( this->m_LabelFunctor->GetUpperThreshold( ) );
}
// -------------------------------------------------------------------------
template< class _TInputImage, class _TLabelImage >
void CTBronchi::MoriLabelling< _TInputImage, _TLabelImage >::
-SetInputRawImage( TInputImage* image )
+SetUpperThreshold( TInputValue t )
{
- this->itk::ProcessObject::SetNthInput( 1, image );
+ this->m_LabelFunctor->SetUpperThreshold( t );
}
// -------------------------------------------------------------------------
template< class _TInputImage, class _TLabelImage >
CTBronchi::MoriLabelling< _TInputImage, _TLabelImage >::
MoriLabelling( )
- : Superclass( ),
- m_UpperThreshold( TLabel( 0 ) ),
- m_InsideValue( TLabel( 0 ) ),
- m_InsideLabel( TLabel( 0 ) ),
- m_OutsideLabel( TLabel( 0 ) )
+ : Superclass( )
{
- this->SetNumberOfRequiredInputs( 2 );
+ this->m_LabelFunctor = TLabelFunctor::New( );
+ this->SetPredicate( this->m_LabelFunctor );
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
template< class _TInputImage, class _TLabelImage >
void CTBronchi::MoriLabelling< _TInputImage, _TLabelImage >::
-ThreadedGenerateData( const TRegion& region, itk::ThreadIdType threadId )
+_UpdateOutputValue( TNode& n )
{
- itk::ImageRegionConstIterator< TLabelImage >
- lIt( this->GetInputLabelImage( ), region );
- itk::ImageRegionConstIterator< TInputImage >
- iIt( this->GetInputRawImage( ), region );
- itk::ImageRegionIterator< TLabelImage >
- oIt( this->GetOutput( ), region );
-
- lIt.GoToBegin( );
- iIt.GoToBegin( );
- oIt.GoToBegin( );
- while( !( lIt.IsAtEnd( ) || iIt.IsAtEnd( ) || oIt.IsAtEnd( ) ) )
+ this->Superclass::_UpdateOutputValue( n );
+ if( n.FrontId != 0 )
{
- if( lIt.Get( ) != this->m_InsideValue )
- {
- if( this->m_UpperThreshold < iIt.Get( ) )
- oIt.Set( this->m_OutsideLabel );
- else
- oIt.Set( TLabel( 0 ) );
- }
+ const TLabelImage* input_labels = this->GetInputLabels( );
+ if( input_labels->GetPixel( n.Vertex ) == this->GetInsideValue( ) )
+ n.Value = TOutputValue( 1 ); // this->GetInsideLabel( );
else
- oIt.Set( this->m_InsideLabel );
- ++lIt;
- ++iIt;
- ++oIt;
-
- } // elihw
+ n.Value = TOutputValue( 0 );
+ /* TODO
+ if( input_labels->GetPixel( n.Vertex ) == this->GetInsideValue( ) )
+ */
+ } // fi
}
#endif // __CTBronchi__MoriLabelling__hxx__