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