]> Creatis software - FrontAlgorithms.git/blob - lib/fpaPlugins/AllPixelsImageGrowFunctionSource.cxx
Plugins updated
[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->_MakeOutput< GrowFunction >( "Output" );
15 }
16
17 // -------------------------------------------------------------------------
18 fpaPlugins::AllPixelsImageGrowFunctionSource::
19 ~AllPixelsImageGrowFunctionSource( )
20 {
21 }
22
23 // -------------------------------------------------------------------------
24 std::string fpaPlugins::AllPixelsImageGrowFunctionSource::
25 _GenerateData( )
26 {
27   cpPlugins::Interface::Image* image =
28     this->GetInput< cpPlugins::Interface::Image >( "ReferenceImage" );
29   if( image == NULL )
30     return( "fpaPlugins::AllPixelsImageGrowFunctionSource: No input reference image." );
31
32   itk::DataObject* itk_image = NULL;
33   std::string r = "";
34   cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
35   else cpPlugins_Image_Demangle_AllScalarTypes( 3, image, itk_image, r, _GD0 );
36   else r = "fpaPlugins::AllPixelsImageGrowFunctionSource: no valid reference image.";
37
38   return( r );
39 }
40
41 // -------------------------------------------------------------------------
42 template< class I >
43 std::string fpaPlugins::AllPixelsImageGrowFunctionSource::
44 _GD0( itk::DataObject* data )
45 {
46   typedef fpa::Image::Functors::RegionGrowAllBelongsFunction< I > _F;
47   typename _F::Pointer functor = _F::New( );
48
49   // Connect output
50   GrowFunction* out = this->GetOutput< GrowFunction >( "Output" );
51   if( out != NULL )
52   {
53     out->SetITK< _F >( functor );
54     return( "" );
55   }
56   else
57     return( "fpaPlugins::AllPixelsImageGrowFunctionSource: output not correctly created." );
58 }
59
60 // eof - $RCSfile$