]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Filters/SingleSeedInterface.hxx
...
[FrontAlgorithms.git] / lib / fpa / Filters / SingleSeedInterface.hxx
1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5 #ifndef __fpa__Filters__SingleSeedInterface__hxx__
6 #define __fpa__Filters__SingleSeedInterface__hxx__
7
8 #include <itkImageBase.h>
9
10 // -------------------------------------------------------------------------
11 template< class _TTraits >
12 void fpa::Filters::SingleSeedInterface< _TTraits >::
13 SetSeed( const TPoint& s )
14 {
15   this->m_InputSeed.Point = s;
16   this->m_InputSeed.IsPoint = true;
17   if( this->m_Filter.IsNotNull( ) )
18     this->m_Filter->Modified( );
19 }
20
21 // -------------------------------------------------------------------------
22 template< class _TTraits >
23 void fpa::Filters::SingleSeedInterface< _TTraits >::
24 SetSeed( const TVertex& s )
25 {
26   this->m_InputSeed.Vertex = s;
27   this->m_InputSeed.IsPoint = false;
28   if( this->m_Filter.IsNotNull( ) )
29     this->m_Filter->Modified( );
30 }
31
32 // -------------------------------------------------------------------------
33 template< class _TTraits >
34 fpa::Filters::SingleSeedInterface< _TTraits >::
35 SingleSeedInterface( itk::ProcessObject* f )
36   : Superclass( f )
37 {
38 }
39
40 // -------------------------------------------------------------------------
41 template< class _TTraits >
42 fpa::Filters::SingleSeedInterface< _TTraits >::
43 ~SingleSeedInterface( )
44 {
45 }
46
47 // -------------------------------------------------------------------------
48 template< class _TTraits >
49 void fpa::Filters::SingleSeedInterface< _TTraits >::
50 _PrepareSeeds( const itk::DataObject* reference )
51 {
52   // Input object is an image?
53   typedef itk::ImageBase< TTraits::Dimension > _TImageBase;
54   const _TImageBase* image =
55     dynamic_cast< const _TImageBase* >( reference );
56   if( image != NULL )
57   {
58     this->m_UnifiedSeeds.clear( );
59     if( this->m_InputSeed.IsPoint )
60       image->TransformPhysicalPointToIndex(
61         this->m_InputSeed.Point, this->m_InputSeed.Vertex
62         );
63     TNode node;
64     node.Vertex = this->m_InputSeed.Vertex;
65     node.Parent = this->m_InputSeed.Vertex;
66     node.FrontId = this->m_InputSeed.FrontId;
67     this->m_UnifiedSeeds.insert( node );
68
69   } // fi
70 }
71
72 #endif // __fpa__Filters__SingleSeedInterface__hxx__
73 // eof - $RCSfile$