]> Creatis software - FrontAlgorithms.git/blob - lib/fpaPlugins/AllPixelsImageGrowFunctionSource.cxx
6071ab46d9d2364a9767b3526bf54c7fea1bf5c7
[FrontAlgorithms.git] / lib / fpaPlugins / AllPixelsImageGrowFunctionSource.cxx
1 #include "AllPixelsImageGrowFunctionSource.h"
2
3 #include <cpPlugins/Interface/BaseProcessObjects.h>
4 #include <cpPlugins/Interface/Image.h>
5 #include <fpaPlugins/GrowFunction.h>
6 #include <fpa/Image/Functors/RegionGrowAllBelongsFunction.h>
7
8 // -------------------------------------------------------------------------
9 fpaPlugins::AllPixelsImageGrowFunctionSource::
10 AllPixelsImageGrowFunctionSource( )
11   : Superclass( )
12 {
13   this->_AddInput( "ReferenceImage" );
14   this->_AddOutput< GrowFunction >( "Output" );
15 }
16
17 // -------------------------------------------------------------------------
18 fpaPlugins::AllPixelsImageGrowFunctionSource::
19 ~AllPixelsImageGrowFunctionSource( )
20 {
21 }
22
23 // -------------------------------------------------------------------------
24 std::string fpaPlugins::AllPixelsImageGrowFunctionSource::
25 _GenerateData( )
26 {
27   auto image = this->GetInputData( "ReferenceImage" );
28   itk::DataObject* itk_image = NULL;
29   std::string r = "";
30   cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
31   else cpPlugins_Image_Demangle_AllScalarTypes( 3, image, itk_image, r, _GD0 );
32   else r = "fpaPlugins::AllPixelsImageGrowFunctionSource: no valid reference image.";
33   return( r );
34 }
35
36 // -------------------------------------------------------------------------
37 template< class I >
38 std::string fpaPlugins::AllPixelsImageGrowFunctionSource::
39 _GD0( itk::DataObject* data )
40 {
41   typedef fpa::Image::Functors::RegionGrowAllBelongsFunction< I > _F;
42   auto out = this->GetOutputData( "Output" );
43   auto f = out->GetITK< _F >( );
44   if( f == NULL )
45   {
46     typename _F::Pointer ptr_f = _F::New( );
47     f = ptr_f.GetPointer( );
48     out->SetITK( f );
49
50   } // fi
51   return( "" );
52 }
53
54 // eof - $RCSfile$