From: Leonardo Flórez-Valencia Date: Wed, 12 Jul 2017 02:42:01 +0000 (-0500) Subject: ... X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=FrontAlgorithms.git;a=commitdiff_plain;h=e97624b0f1db169d85337d9045bce1bbd83f72e4 ... --- diff --git a/appli/CTBronchi/MoriLabelling.h b/appli/CTBronchi/MoriLabelling.h index b51cfeb..eecb4ad 100644 --- a/appli/CTBronchi/MoriLabelling.h +++ b/appli/CTBronchi/MoriLabelling.h @@ -50,9 +50,6 @@ namespace CTBronchi itkGetConstMacro( InsideLabel, TOutputValue ); itkSetMacro( InsideLabel, TOutputValue ); - itkGetConstMacro( OutsideLabel, TOutputValue ); - itkSetMacro( OutsideLabel, TOutputValue ); - public: const TLabelImage* GetInputLabelImage( ) const; void SetInputLabelImage( TLabelImage* image ); @@ -63,6 +60,9 @@ namespace CTBronchi TInputValue GetUpperThreshold( ) const; void SetUpperThreshold( TInputValue t ); + TOutputValue GetOutsideValue( ) const; + void SetOutsideLabel( TOutputValue o ); + protected: MoriLabelling( ); virtual ~MoriLabelling( ); @@ -77,7 +77,6 @@ namespace CTBronchi protected: TOutputValue m_InsideLabel; - TOutputValue m_OutsideLabel; }; } // ecapseman diff --git a/appli/CTBronchi/MoriLabelling.hxx b/appli/CTBronchi/MoriLabelling.hxx index bc38389..69e968b 100644 --- a/appli/CTBronchi/MoriLabelling.hxx +++ b/appli/CTBronchi/MoriLabelling.hxx @@ -67,13 +67,29 @@ SetUpperThreshold( TInputValue t ) func->SetUpper( t ); } +// ------------------------------------------------------------------------- +template< class _TInputImage, class _TLabelImage > +typename CTBronchi::MoriLabelling< _TInputImage, _TLabelImage >:: +TOutputValue CTBronchi::MoriLabelling< _TInputImage, _TLabelImage >:: +GetOutsideValue( ) const +{ + return( this->GetInitValue( ) ); +} + +// ------------------------------------------------------------------------- +template< class _TInputImage, class _TLabelImage > +void CTBronchi::MoriLabelling< _TInputImage, _TLabelImage >:: +SetOutsideLabel( TOutputValue o ) +{ + this->SetInitValue( o ); +} + // ------------------------------------------------------------------------- template< class _TInputImage, class _TLabelImage > CTBronchi::MoriLabelling< _TInputImage, _TLabelImage >:: MoriLabelling( ) : Superclass( ), - m_InsideLabel( TOutputValue( 0 ) ), - m_OutsideLabel( TOutputValue( 0 ) ) + m_InsideLabel( TOutputValue( 0 ) ) { typename TThresholdFunction::Pointer func = TThresholdFunction::New( ); this->SetPredicate( func ); @@ -160,121 +176,19 @@ template< class _TInputImage, class _TLabelImage > void CTBronchi::MoriLabelling< _TInputImage, _TLabelImage >:: _UpdateOutputValue( TNode& n ) { - const TInputImage* input = this->GetInputRawImage( ); - const TLabelImage* labels = this->GetInputLabelImage( ); -} - - -/* TODO - TOutputValue m_InsideValue; - TOutputValue m_InsideLabel; - TOutputValue m_OutsideLabel; -*/ - - - - - - - - - - -/* TODO -#include -#include - -// ------------------------------------------------------------------------- -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 -{ - return( - dynamic_cast< const TInputImage* >( - this->itk::ProcessObject::GetInput( 1 ) - ) - ); -} - -// ------------------------------------------------------------------------- -template< class _TInputImage, class _TLabelImage > -void CTBronchi::MoriLabelling< _TInputImage, _TLabelImage >:: -SetInputRawImage( TInputImage* image ) -{ - this->itk::ProcessObject::SetNthInput( 1, image ); -} + const TLabelImage* input_labels = this->GetInputLabelImage( ); -// ------------------------------------------------------------------------- -template< class _TInputImage, class _TLabelImage > -CTBronchi::MoriLabelling< _TInputImage, _TLabelImage >:: -MoriLabelling( ) - : Superclass( ), - m_UpperThreshold( TOutputValue( 0 ) ), - m_InsideValue( TOutputValue( 0 ) ), - m_InsideLabel( TOutputValue( 0 ) ), - m_OutsideLabel( TOutputValue( 0 ) ) -{ - this->SetNumberOfRequiredInputs( 2 ); -} - -// ------------------------------------------------------------------------- -template< class _TInputImage, class _TLabelImage > -CTBronchi::MoriLabelling< _TInputImage, _TLabelImage >:: -~MoriLabelling( ) -{ -} - -// ------------------------------------------------------------------------- -template< class _TInputImage, class _TLabelImage > -void CTBronchi::MoriLabelling< _TInputImage, _TLabelImage >:: -ThreadedGenerateData( const TRegion& region, itk::ThreadIdType threadId ) -{ - 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( TOutputValue( 0 ) ); - } + if( input_labels->GetPixel( n.Vertex ) == this->GetInsideValue( ) ) + n.Value = this->GetInsideLabel( ); else - oIt.Set( this->m_InsideLabel ); - ++lIt; - ++iIt; - ++oIt; + n.Value = TOutputValue( 0 ); + this->TAlgorithm::_UpdateOutputValue( n ); - } // elihw + } // fi } -*/ #endif // __CTBronchi__MoriLabelling__hxx__