// ========================================================================= // @author Leonardo Florez Valencia // @email florez-l@javeriana.edu.co // ========================================================================= #ifndef __fpa__Image__MarksInterface__hxx__ #define __fpa__Image__MarksInterface__hxx__ // ------------------------------------------------------------------------- template< unsigned int _VDim > bool fpa::Image::MarksInterface< _VDim >:: _IsMarked( const TVertex& v ) const { return( this->m_Marks->GetPixel( v ) != 0 ); } // ------------------------------------------------------------------------- template< unsigned int _VDim > unsigned long fpa::Image::MarksInterface< _VDim >:: _GetMark( const TVertex& v ) const { return( this->m_Marks->GetPixel( v ) ); } // ------------------------------------------------------------------------- template< unsigned int _VDim > void fpa::Image::MarksInterface< _VDim >:: _Mark( const TVertex& v, unsigned long frontId ) { this->m_Marks->SetPixel( v, frontId ); } // ------------------------------------------------------------------------- template< unsigned int _VDim > void fpa::Image::MarksInterface< _VDim >:: _FreeMarks( ) { this->m_Marks = NULL; } // ------------------------------------------------------------------------- template< unsigned int _VDim > void fpa::Image::MarksInterface< _VDim >:: _InitMarks( unsigned long nSeeds ) { this->Superclass::_InitMarks( nSeeds ); // Try to guess input if( this->m_Filter == NULL ) return; if( this->m_Filter->GetInputs( ).size( ) == 0 ) return; itk::ImageBase< _VDim >* input = dynamic_cast< itk::ImageBase< _VDim >* >( this->m_Filter->GetInputs( )[ 0 ].GetPointer( ) ); if( input == NULL ) return; // Reserve memory for marks this->m_Marks = TMarks::New( ); this->m_Marks->CopyInformation( input ); this->m_Marks->SetRequestedRegion( input->GetRequestedRegion( ) ); this->m_Marks->SetBufferedRegion( input->GetBufferedRegion( ) ); this->m_Marks->Allocate( ); this->m_Marks->FillBuffer( 0 ); } // ------------------------------------------------------------------------- template< unsigned int _VDim > fpa::Image::MarksInterface< _VDim >:: MarksInterface( itk::ProcessObject* filter ) : Superclass( filter ) { } // ------------------------------------------------------------------------- template< unsigned int _VDim > fpa::Image::MarksInterface< _VDim >:: ~MarksInterface( ) { } #endif // __fpa__Image__MarksInterface__hxx__ // eof - $RCSfile$