X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=appli%2FCTBronchi%2FMoriLabelling.h;h=f9adb5ce8ea9de58bd51f22a3dcd9b293bd31372;hb=9817c556a0b8b5e3b332d45f07faa84d91afb2d0;hp=89ce00164a57e417c5938f09e13e727895aa1d0c;hpb=926cb50be2ef54fce0d9493119dc89626e9b7526;p=FrontAlgorithms.git diff --git a/appli/CTBronchi/MoriLabelling.h b/appli/CTBronchi/MoriLabelling.h index 89ce001..f9adb5c 100644 --- a/appli/CTBronchi/MoriLabelling.h +++ b/appli/CTBronchi/MoriLabelling.h @@ -5,6 +5,7 @@ #ifndef __CTBronchi__MoriLabelling__h__ #define __CTBronchi__MoriLabelling__h__ +#include #include #include #include @@ -62,7 +63,7 @@ namespace CTBronchi protected: MoriLabelling( ) : Superclass( ), - m_VesselnessThreshold( 0.05 ), + m_VesselnessThreshold( 5 ), m_UpperThreshold( -650 ) { ivqITKInputConfigureMacro( InputLabels, _TLabels ); @@ -75,6 +76,44 @@ namespace CTBronchi { } + virtual const itk::DataObject* _GetReferenceInput( ) const override + { + return( this->GetInputLabels( ) ); + } + virtual void _BeforeGenerateData( ) override + { + this->Superclass::_BeforeGenerateData( ); + + this->m_Functor->SetUpperThreshold( this->m_UpperThreshold ); + + typedef itk::MinimumMaximumImageCalculator< _TScalarImage > _TMinMax; + typename _TMinMax::Pointer minMax = _TMinMax::New( ); + minMax->SetImage( this->GetInputVesselness( ) ); + minMax->Compute( ); + this->m_MinVesselness = + ( 1.0 - ( this->m_VesselnessThreshold / double( 100 ) ) ) * + double( minMax->GetMaximum( ) ); + } + + virtual void _PostComputeOutputValue( TNode& n ) override + { + this->Superclass::_PostComputeOutputValue( n ); + if( n.Value == this->GetInsideValue( ) ) + { + const _TLabels* labels = this->GetInputLabels( ); + const _TScalarImage* vesselness = this->GetInputVesselness( ); + if( labels->GetPixel( n.Vertex ) == 0 ) + { + if( this->m_MinVesselness < vesselness->GetPixel( n.Vertex ) ) + n.Value = this->GetInsideValue( ); + else + n.Value = 0; + + } // fi + + } // fi + } + private: // Purposely not implemented. MoriLabelling( const Self& other ); @@ -83,6 +122,7 @@ namespace CTBronchi protected: typename TFunctor::Pointer m_Functor; double m_VesselnessThreshold; + double m_MinVesselness; TInputValue m_UpperThreshold; };