#include <ImageGradientFilters/GulsunTekImageFilter.h>
#include <cpPlugins/DataObjects/Image.h>
#include <cpPlugins/DataObjects/Image_Demanglers.h>
-
-/* TODO
- #include <cpExtensions/Algorithms/ImageFunctionFilter.h>
- #include <cpExtensions/Algorithms/GulsunTekMedialness.h>
- #include <cpExtensions/Algorithms/ImageFunctionFilter.hxx>
- #include <cpExtensions/Algorithms/GulsunTekMedialness.hxx>
- #include <cpExtensions/Algorithms/GradientImageFunctionBase.hxx>
- #include <itkImageFunction.hxx>
-*/
+#include <cpExtensions/Algorithms/ImageFunctionFilter.h>
+#include <cpExtensions/Algorithms/GulsunTekMedialness.h>
// -------------------------------------------------------------------------
cpPluginsImageGradientFilters::GulsunTekImageFilter::
this->_ConfigureInput< _TImage >( "Mask", false, false );
this->_ConfigureOutput< _TImage >( "Output" );
- this->m_Parameters.ConfigureAsReal( "MinRadius" );
- this->m_Parameters.ConfigureAsReal( "MaxRadius" );
- this->m_Parameters.ConfigureAsUint( "ProfileSampling" );
- this->m_Parameters.ConfigureAsUint( "RadialSampling" );
-
- this->m_Parameters.SetReal( "MinRadius", 0 );
- this->m_Parameters.SetReal( "MaxRadius", 1 );
- this->m_Parameters.SetUint( "ProfileSampling", 4 );
- this->m_Parameters.SetUint( "RadialSampling", 10 );
+ this->m_Parameters.ConfigureAsReal( "MinRadius", 0 );
+ this->m_Parameters.ConfigureAsReal( "MaxRadius", 1 );
+ this->m_Parameters.ConfigureAsUint( "ProfileSampling", 4 );
+ this->m_Parameters.ConfigureAsUint( "RadialSampling", 10 );
}
// -------------------------------------------------------------------------
void cpPluginsImageGradientFilters::GulsunTekImageFilter::
_GenerateData( )
{
- /* TODO
- auto o = this->GetInputData( "Input" );
- cpPlugins_Demangle_ImageCovariantVectors_Dims( o, _GD0 );
- else this->_Error( "Invalid input image." );
- */
+ auto o = this->GetInputData( "Input" );
+ cpPlugins_Demangle_Image_CovariantVectorPixels_AllDims_1( o, _GD0 )
+ this->_Error( "Invalid input image." );
}
// -------------------------------------------------------------------------
void cpPluginsImageGradientFilters::GulsunTekImageFilter::
_GD0( _TImage* image )
{
- /* TODO
- typedef itk::Image< char, _TImage::ImageDimension > _TChar;
- typedef itk::Image< short, _TImage::ImageDimension > _TShort;
- typedef itk::Image< int, _TImage::ImageDimension > _TInt;
- typedef itk::Image< long, _TImage::ImageDimension > _TLong;
- typedef itk::Image< float, _TImage::ImageDimension > _TFloat;
- typedef itk::Image< double, _TImage::ImageDimension > _TDouble;
- typedef itk::Image< unsigned char, _TImage::ImageDimension > _TUChar;
- typedef itk::Image< unsigned short, _TImage::ImageDimension > _TUShort;
- typedef itk::Image< unsigned int, _TImage::ImageDimension > _TUInt;
- typedef itk::Image< unsigned long, _TImage::ImageDimension > _TULong;
+ typedef itk::Image< bool, _TImage::ImageDimension > _TDummy;
- auto m = this->GetInput( "Mask" );
- auto ci = m->GetITK< _TChar >( );
- auto si = m->GetITK< _TShort >( );
- auto ii = m->GetITK< _TInt >( );
- auto li = m->GetITK< _TLong >( );
- auto fi = m->GetITK< _TFloat >( );
- auto di = m->GetITK< _TDouble >( );
- auto uci = m->GetITK< _TUChar >( );
- auto usi = m->GetITK< _TUShort >( );
- auto uii = m->GetITK< _TUInt >( );
- auto uli = m->GetITK< _TULong >( );
- if ( ci != NULL ) this->_GD1( image, ci );
- else if( si != NULL ) this->_GD1( image, si );
- else if( ii != NULL ) this->_GD1( image, ii );
- else if( li != NULL ) this->_GD1( image, li );
- else if( fi != NULL ) this->_GD1( image, fi );
- else if( di != NULL ) this->_GD1( image, di );
- else if( uci != NULL ) this->_GD1( image, uci );
- else if( usi != NULL ) this->_GD1( image, usi );
- else if( uii != NULL ) this->_GD1( image, uii );
- else if( uli != NULL ) this->_GD1( image, uli );
- else this->_GD1( image, ci );
- */
+ auto o = this->GetInputData( "Mask" );
+ cpPlugins_Demangle_Image_ScalarPixels_2( o, _GD1, _TImage::ImageDimension, image )
+ this->_GD1< _TDummy, _TImage >( NULL, image );
}
// -------------------------------------------------------------------------
-template< class _TImage, class _TMask >
+template< class _TMask, class _TImage >
void cpPluginsImageGradientFilters::GulsunTekImageFilter::
-_GD1( _TImage* image, _TMask* mask )
+_GD1( _TMask* mask, _TImage* image )
{
- /* TODO
- typedef typename _TImage::PixelType _TGradient;
- typedef cpExtensions::Algorithms::GulsunTekMedialness< _TImage, _TMask > _TFunction;
- typedef typename _TFunction::TOutput _TScalar;
- typedef itk::Image< _TScalar, _TImage::ImageDimension > _TOutputImage;
- typedef cpExtensions::Algorithms::ImageFunctionFilter< _TImage, _TOutputImage, _TFunction > _TFilter;
+ typedef typename _TImage::PixelType _TGradient;
+ typedef cpExtensions::Algorithms::GulsunTekMedialness< _TImage, _TMask > _TFunction;
+ typedef typename _TFunction::TOutput _TScalar;
+ typedef itk::Image< _TScalar, _TImage::ImageDimension > _TOutputImage;
+ typedef cpExtensions::Algorithms::ImageFunctionFilter< _TImage, _TOutputImage, _TFunction > _TFilter;
- auto filter = this->_CreateITK< _TFilter >( );
- auto function = filter->GetFunction( );
- if( function == NULL )
- {
- filter->SetFunction( _TFunction::New( ) );
- function = filter->GetFunction( );
+ auto filter = this->_CreateITK< _TFilter >( );
+ auto function = filter->GetFunction( );
+ if( function == NULL )
+ {
+ filter->SetFunction( _TFunction::New( ) );
+ function = filter->GetFunction( );
- } // fi
- function->SetMinRadius( this->m_Parameters.GetReal( "MinRadius" ) );
- function->SetMaxRadius( this->m_Parameters.GetReal( "MaxRadius" ) );
- function->SetProfileSampling( this->m_Parameters.GetUint( "ProfileSampling" ) );
- function->SetRadialSampling( this->m_Parameters.GetUint( "RadialSampling" ) );
- filter->SetInput( image );
- if( mask != NULL )
- function->SetMask( mask );
- filter->Update( );
- this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
- */
+ } // fi
+ function->SetMinRadius( this->m_Parameters.GetReal( "MinRadius" ) );
+ function->SetMaxRadius( this->m_Parameters.GetReal( "MaxRadius" ) );
+ function->SetProfileSampling( this->m_Parameters.GetUint( "ProfileSampling" ) );
+ function->SetRadialSampling( this->m_Parameters.GetUint( "RadialSampling" ) );
+ filter->SetInput( image );
+ if( mask != NULL )
+ function->SetMask( mask );
+ filter->Update( );
+ this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
}
// eof - $RCSfile$