]> Creatis software - FrontAlgorithms.git/blob - lib/fpaPlugins/AllPixelsImageGrowFunctionSource.cxx
...
[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 =
28     this->GetInputData< cpPlugins::Interface::Image >( "ReferenceImage" );
29   itk::DataObject* itk_image = NULL;
30   std::string r = "";
31   cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
32   else cpPlugins_Image_Demangle_AllScalarTypes( 3, image, itk_image, r, _GD0 );
33   else r = "fpaPlugins::AllPixelsImageGrowFunctionSource: no valid reference image.";
34   return( r );
35 }
36
37 // -------------------------------------------------------------------------
38 template< class I >
39 std::string fpaPlugins::AllPixelsImageGrowFunctionSource::
40 _GD0( itk::DataObject* data )
41 {
42   typedef fpa::Image::Functors::RegionGrowAllBelongsFunction< I > _F;
43   auto out = this->GetOutputData< GrowFunction >( "Output" );
44   auto f = out->GetITK< _F >( );
45   if( f == NULL )
46   {
47     typename _F::Pointer ptr_f = _F::New( );
48     f = ptr_f.GetPointer( );
49     out->SetITK( f );
50
51   } // fi
52   return( "" );
53 }
54
55 // eof - $RCSfile$