]> Creatis software - FrontAlgorithms.git/blob - appli/CTBronchi/MoriLabelling.hxx
7963416db6fea8d16a5142af48a41834f3a0dc81
[FrontAlgorithms.git] / appli / CTBronchi / MoriLabelling.hxx
1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5
6 #ifndef __CTBronchi__MoriLabelling__hxx__
7 #define __CTBronchi__MoriLabelling__hxx__
8
9 // -------------------------------------------------------------------------
10 template< class _TInputImage, class _TLabelImage >
11 typename CTBronchi::MoriLabelling< _TInputImage, _TLabelImage >::
12 TInputValue CTBronchi::MoriLabelling< _TInputImage, _TLabelImage >::
13 GetUpperThreshold( ) const
14 {
15   return( this->m_LabelFunctor->GetUpperThreshold( ) );
16 }
17
18 // -------------------------------------------------------------------------
19 template< class _TInputImage, class _TLabelImage >
20 void CTBronchi::MoriLabelling< _TInputImage, _TLabelImage >::
21 SetUpperThreshold( TInputValue t )
22 {
23   this->m_LabelFunctor->SetUpperThreshold( t );
24 }
25
26 // -------------------------------------------------------------------------
27 template< class _TInputImage, class _TLabelImage >
28 CTBronchi::MoriLabelling< _TInputImage, _TLabelImage >::
29 MoriLabelling( )
30   : Superclass( )
31 {
32   this->m_LabelFunctor = TLabelFunctor::New( );
33   this->SetPredicate( this->m_LabelFunctor );
34 }
35
36 // -------------------------------------------------------------------------
37 template< class _TInputImage, class _TLabelImage >
38 CTBronchi::MoriLabelling< _TInputImage, _TLabelImage >::
39 ~MoriLabelling( )
40 {
41 }
42
43 // -------------------------------------------------------------------------
44 template< class _TInputImage, class _TLabelImage >
45 void CTBronchi::MoriLabelling< _TInputImage, _TLabelImage >::
46 _UpdateOutputValue( TNode& n )
47 {
48   this->TBase::_UpdateOutputValue( n );
49   if( n.FrontId != 0 )
50   {
51     const TLabelImage* input_labels = this->GetInputLabels( );
52     if( input_labels->GetPixel( n.Vertex ) != this->GetInputInsideValue( ) )
53       n.Value = TOutputValue( 0 );
54     else
55       n.Value = this->GetInsideValue( );
56
57   } // fi
58   this->GetOutput( )->SetPixel( n.Vertex, n.Value );
59 }
60
61 #endif // __CTBronchi__MoriLabelling__hxx__
62
63 // eof - $RCSfile$