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