]> Creatis software - FrontAlgorithms.git/blob - plugins/Plugins/SimpleImageNeighborhood.cxx
11f2658a558533131d734771082f0c7e0eff6dc1
[FrontAlgorithms.git] / plugins / Plugins / SimpleImageNeighborhood.cxx
1 #include <plugins/Plugins/SimpleImageNeighborhood.h>
2 #include <cpPlugins/DataObjects/Image.h>
3
4 #include <fpa_DataObjects.h>
5
6 // -------------------------------------------------------------------------
7 fpaPlugins::SimpleImageNeighborhood::
8 SimpleImageNeighborhood( )
9   : Superclass( )
10 {
11   typedef cpPlugins::BaseObjects::DataObject _TData;
12   typedef cpPlugins::DataObjects::Image _TImage;
13
14   this->_ConfigureInput< _TImage >( "Input", true, false );
15   this->_ConfigureOutput< _TData >( "Output" );
16
17   this->m_Parameters.ConfigureAsUint( "Order" );
18   this->m_Parameters.SetUint( "Order", 1 );
19 }
20
21 // -------------------------------------------------------------------------
22 fpaPlugins::SimpleImageNeighborhood::
23 ~SimpleImageNeighborhood( )
24 {
25 }
26
27 // -------------------------------------------------------------------------
28 void fpaPlugins::SimpleImageNeighborhood::
29 _GenerateData( )
30 {
31   auto o = this->GetInputData( "Input" );
32   cpPlugins_Demangle_ImageProcessDims( o, _GD0 );
33   else this->_Error( "Invalid input image." );
34 }
35
36 // -------------------------------------------------------------------------
37 template< class _TImage >
38 void fpaPlugins::SimpleImageNeighborhood::
39 _GD0( _TImage* image )
40 {
41   typedef fpa::Image::Functors::SimpleNeighborhood< _TImage > _TFunctor;
42   auto out = this->GetOutput( "Output" );
43   auto f = out->GetITK< _TFunctor >( );
44   if( f == NULL )
45   {
46     typename _TFunctor::Pointer ptr_f = _TFunctor::New( );
47     f = ptr_f.GetPointer( );
48     out->SetITK( f );
49
50   } // fi
51   f->SetOrder( this->m_Parameters.GetUint( "Order" ) );
52 }
53
54 // eof - $RCSfile$