]> Creatis software - cpPlugins.git/blob - plugins/ImageGradientFilters/GulsunTekImageFilter.cxx
4c4689788472493282aa16d042a8a4ab41f03092
[cpPlugins.git] / plugins / ImageGradientFilters / GulsunTekImageFilter.cxx
1 #include <ImageGradientFilters/GulsunTekImageFilter.h>
2 #include <cpPlugins/DataObjects/Image.h>
3 #include <cpPlugins/DataObjects/Image_Demanglers.h>
4  
5 /* TODO
6    #include <cpExtensions/Algorithms/ImageFunctionFilter.h>
7    #include <cpExtensions/Algorithms/GulsunTekMedialness.h>
8
9    #include <cpExtensions/Algorithms/ImageFunctionFilter.hxx>
10    #include <cpExtensions/Algorithms/GulsunTekMedialness.hxx>
11    #include <cpExtensions/Algorithms/GradientImageFunctionBase.hxx>
12    #include <itkImageFunction.hxx>
13 */
14
15 // -------------------------------------------------------------------------
16 cpPluginsImageGradientFilters::GulsunTekImageFilter::
17 GulsunTekImageFilter( )
18   : Superclass( )
19 {
20   typedef cpPlugins::DataObjects::Image _TImage;
21
22   this->_ConfigureInput< _TImage >( "Input", true, false );
23   this->_ConfigureInput< _TImage >( "Mask", false, false );
24   this->_ConfigureOutput< _TImage >( "Output" );
25
26   this->m_Parameters.ConfigureAsReal( "MinRadius" );
27   this->m_Parameters.ConfigureAsReal( "MaxRadius" );
28   this->m_Parameters.ConfigureAsUint( "ProfileSampling" );
29   this->m_Parameters.ConfigureAsUint( "RadialSampling" );
30
31   this->m_Parameters.SetReal( "MinRadius", 0 );
32   this->m_Parameters.SetReal( "MaxRadius", 1 );
33   this->m_Parameters.SetUint( "ProfileSampling", 4 );
34   this->m_Parameters.SetUint( "RadialSampling", 10 );
35 }
36
37 // -------------------------------------------------------------------------
38 cpPluginsImageGradientFilters::GulsunTekImageFilter::
39 ~GulsunTekImageFilter( )
40 {
41 }
42
43 // -------------------------------------------------------------------------
44 void cpPluginsImageGradientFilters::GulsunTekImageFilter::
45 _GenerateData( )
46 {
47   /* TODO
48      auto o = this->GetInputData( "Input" );
49      cpPlugins_Demangle_ImageCovariantVectors_Dims( o, _GD0 );
50      else this->_Error( "Invalid input image." );
51   */
52 }
53
54 // -------------------------------------------------------------------------
55 template< class _TImage >
56 void cpPluginsImageGradientFilters::GulsunTekImageFilter::
57 _GD0( _TImage* image )
58 {
59   /* TODO
60      typedef itk::Image< char, _TImage::ImageDimension > _TChar;
61      typedef itk::Image< short, _TImage::ImageDimension > _TShort;
62      typedef itk::Image< int, _TImage::ImageDimension > _TInt;
63      typedef itk::Image< long, _TImage::ImageDimension > _TLong;
64      typedef itk::Image< float, _TImage::ImageDimension > _TFloat;
65      typedef itk::Image< double, _TImage::ImageDimension > _TDouble;
66      typedef itk::Image< unsigned char, _TImage::ImageDimension > _TUChar;
67      typedef itk::Image< unsigned short, _TImage::ImageDimension > _TUShort;
68      typedef itk::Image< unsigned int, _TImage::ImageDimension > _TUInt;
69      typedef itk::Image< unsigned long, _TImage::ImageDimension > _TULong;
70
71      auto m = this->GetInput( "Mask" );
72      auto ci = m->GetITK< _TChar >( );
73      auto si = m->GetITK< _TShort >( );
74      auto ii = m->GetITK< _TInt >( );
75      auto li = m->GetITK< _TLong >( );
76      auto fi = m->GetITK< _TFloat >( );
77      auto di = m->GetITK< _TDouble >( );
78      auto uci = m->GetITK< _TUChar >( );
79      auto usi = m->GetITK< _TUShort >( );
80      auto uii = m->GetITK< _TUInt >( );
81      auto uli = m->GetITK< _TULong >( );
82      if     (  ci != NULL ) this->_GD1( image,  ci );
83      else if(  si != NULL ) this->_GD1( image,  si );
84      else if(  ii != NULL ) this->_GD1( image,  ii );
85      else if(  li != NULL ) this->_GD1( image,  li );
86      else if(  fi != NULL ) this->_GD1( image,  fi );
87      else if(  di != NULL ) this->_GD1( image,  di );
88      else if( uci != NULL ) this->_GD1( image, uci );
89      else if( usi != NULL ) this->_GD1( image, usi );
90      else if( uii != NULL ) this->_GD1( image, uii );
91      else if( uli != NULL ) this->_GD1( image, uli );
92      else                   this->_GD1( image, ci );
93   */
94 }
95
96 // -------------------------------------------------------------------------
97 template< class _TImage, class _TMask >
98 void cpPluginsImageGradientFilters::GulsunTekImageFilter::
99 _GD1( _TImage* image, _TMask* mask )
100 {
101   /* TODO
102      typedef typename _TImage::PixelType _TGradient;
103      typedef cpExtensions::Algorithms::GulsunTekMedialness< _TImage, _TMask > _TFunction;
104      typedef typename _TFunction::TOutput _TScalar;
105      typedef itk::Image< _TScalar, _TImage::ImageDimension > _TOutputImage;
106      typedef cpExtensions::Algorithms::ImageFunctionFilter< _TImage, _TOutputImage, _TFunction > _TFilter;
107
108      auto filter = this->_CreateITK< _TFilter >( );
109      auto function = filter->GetFunction( );
110      if( function == NULL )
111      {
112      filter->SetFunction( _TFunction::New( ) );
113      function = filter->GetFunction( );
114
115      } // fi
116      function->SetMinRadius( this->m_Parameters.GetReal( "MinRadius" ) );
117      function->SetMaxRadius( this->m_Parameters.GetReal( "MaxRadius" ) );
118      function->SetProfileSampling( this->m_Parameters.GetUint( "ProfileSampling" ) );
119      function->SetRadialSampling( this->m_Parameters.GetUint( "RadialSampling" ) );
120      filter->SetInput( image );
121      if( mask != NULL )
122      function->SetMask( mask );
123      filter->Update( );
124      this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
125   */
126 }
127
128 // eof - $RCSfile$