// ========================================================================= // @author Leonardo Florez Valencia // @email florez-l@javeriana.edu.co // ========================================================================= #ifndef __fpa__Image__MinimumSpanningTreeToImageFilter__hxx__ #define __fpa__Image__MinimumSpanningTreeToImageFilter__hxx__ // ------------------------------------------------------------------------- template< class _TMST, class _TOutputPixelValue > void fpa::Image::MinimumSpanningTreeToImageFilter< _TMST, _TOutputPixelValue >:: AddPath( const TIndex& start, const TIndex& end, const TOutputPixelValue& r, const TOutputPixelValue& g, const TOutputPixelValue& b ) { if( start != end ) { TPathData d; d.Start = start; d.End = end; d.Red = r; d.Green = g; d.Blue = b; this->m_Paths.push_back( d ); this->Modified( ); } // fi } // ------------------------------------------------------------------------- template< class _TMST, class _TOutputPixelValue > fpa::Image::MinimumSpanningTreeToImageFilter< _TMST, _TOutputPixelValue >:: MinimumSpanningTreeToImageFilter( ) : Superclass( ) { } // ------------------------------------------------------------------------- template< class _TMST, class _TOutputPixelValue > fpa::Image::MinimumSpanningTreeToImageFilter< _TMST, _TOutputPixelValue >:: ~MinimumSpanningTreeToImageFilter( ) { } // ------------------------------------------------------------------------- template< class _TMST, class _TOutputPixelValue > void fpa::Image::MinimumSpanningTreeToImageFilter< _TMST, _TOutputPixelValue >:: GenerateData( ) { TOutputPixel color; color.Fill( 0 ); const TMST* mst = this->GetInput( ); TOutputImage* output = this->GetOutput( ); output->SetBufferedRegion( mst->GetBufferedRegion( ) ); output->Allocate( ); output->FillBuffer( color ); for( TPathData d: this->m_Paths ) { typename TMST::TVertices path = mst->GetPath( d.Start, d.End ); color[ 0 ] = d.Red; color[ 1 ] = d.Green; color[ 2 ] = d.Blue; color[ 3 ] = std::numeric_limits< TOutputPixelValue >::max( ); for( TIndex i: path ) output->SetPixel( i, color ); } // rof } #endif // __fpa__Image__MinimumSpanningTreeToImageFilter__hxx__ // eof - $RCSfile$