void cpExtensions::Algorithms::MacheteImageFilter< I, O>
::GenerateData()
{
+ //const typename Superclass::OutputImageRegionType& region;
+
typename I::ConstPointer input = this->GetInput();
typename O::Pointer output = this->GetOutput();
output->SetRegions(input->GetLargestPossibleRegion());
output->Allocate();
- itk::ImageRegionIterator<I> outputIterator(output, output->GetLargestPossibleRegion());
- itk::ImageRegionConstIterator<O> inputIterator(input, input->GetLargestPossibleRegion());
+ itk::ImageRegionIterator<O> outputIterator(output, output->GetLargestPossibleRegion());
+ itk::ImageRegionConstIterator<I> inputIterator(input, input->GetLargestPossibleRegion());
while (!outputIterator.IsAtEnd())
{
--- /dev/null
+#include "MacheteImageFilter.h"
+#include <cpPlugins/Interface/Image.h>
+
+//#include <MacheteImageFilter.h>
+#include <itkImage.h>
+#include <itkBinaryBallStructuringElement.h>
+
+#include <cpExtensions/Algorithms/MacheteImageFilter.h>
+
+// -------------------------------------------------------------------------
+cpPlugins::BasicFilters::MacheteImageFilter::
+MacheteImageFilter( )
+ : Superclass( )
+{
+ this->_AddInput( "Input" );
+ this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
+
+ this->m_Parameters->ConfigureAsUint( "Radius", 2 );
+
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::BasicFilters::MacheteImageFilter::
+~MacheteImageFilter( )
+{
+}
+
+// -------------------------------------------------------------------------
+std::string cpPlugins::BasicFilters::MacheteImageFilter::
+_GenerateData( )
+{
+ cpPlugins::Interface::Image* image =
+ this->GetInput< cpPlugins::Interface::Image >( "Input" );
+ if( image == NULL )
+ return( "MacheteImageFilter: No input image." );
+
+ itk::DataObject* itk_image = NULL;
+ std::string r = "";
+ cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
+ else cpPlugins_Image_Demangle_AllScalarTypes( 3, image, itk_image, r, _GD0 );
+ else cpPlugins_Image_Demangle_AllScalarTypes( 4, image, itk_image, r, _GD0 );
+ else r = "MacheteImageFilter: Input image type not supported.";
+ return( r );
+}
+
+// -------------------------------------------------------------------------
+template< class I >
+std::string cpPlugins::BasicFilters::MacheteImageFilter::
+_GD0( itk::DataObject* image )
+{
+ return(
+ this->_RealGD< I, itk::Image< unsigned char, I::ImageDimension > >(
+ image
+ )
+ );
+}
+
+// -------------------------------------------------------------------------
+template< class I, class O >
+inline std::string cpPlugins::BasicFilters::MacheteImageFilter::
+_RealGD( itk::DataObject* image )
+{
+ typedef cpExtensions::Algorithms::MacheteImageFilter< I, O > _F;
+ //typedef typename _F::radius _RT;
+
+ // Get parameters
+ //_RT rad_val;
+ //rad_val.Fill( this->m_Parameters->GetUint( "Radius" ) );
+
+ // Configure filter
+
+ _F* filter = this->_CreateITK< _F >();
+ filter->SetInput(dynamic_cast< I* >(image));
+ filter->SetRadius(this->m_Parameters->GetUint("Radius"));
+ filter->Update();
+
+ //_F* filter = this->_CreateITK< _F >( );
+ //filter->SetInput( dynamic_cast< I* >( image ) );
+ //filter->Update( );
+
+ // Connect output
+ cpPlugins::Interface::Image* out =
+ this->GetOutput< cpPlugins::Interface::Image >( "Output" );
+ if( out != NULL )
+ {
+ //out->SetITK< O >( filter->GetOutput( ) );
+ return( "" );
+ }
+ else
+ return( "MacheteImageFilter: output not correctly created." );
+}
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __CPPLUGINS__PLUGINS__MACHETEIMAGEFILTER__H__
+#define __CPPLUGINS__PLUGINS__MACHETEIMAGEFILTER__H__
+
+#include <cpPlugins/BasicFilters/cpPluginsBasicFilters_Export.h>
+#include <cpPlugins/Interface/BaseProcessObjects.h>
+
+namespace cpPlugins
+{
+ namespace BasicFilters
+ {
+ /**
+ */
+ class cpPluginsBasicFilters_EXPORT MacheteImageFilter
+ : public cpPlugins::Interface::ImageToImageFilter
+ {
+ public:
+ typedef MacheteImageFilter Self;
+ typedef cpPlugins::Interface::ImageToImageFilter Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ public:
+ itkNewMacro( Self );
+ itkTypeMacro(
+ MacheteImageFilter,
+ cpPluginsInterfaceImageToImageFilter
+ );
+ cpPlugins_Id_Macro(
+ cpPlugins::BasicFilters::MacheteImageFilter,
+ "ImageToImageFilter"
+ );
+
+ protected:
+ MacheteImageFilter( );
+ virtual ~MacheteImageFilter( );
+
+ virtual std::string _GenerateData( );
+
+ template< class I >
+ inline std::string _GD0( itk::DataObject* image );
+
+ template< class I, class O >
+ inline std::string _RealGD( itk::DataObject* image );
+
+ private:
+ // Purposely not implemented
+ MacheteImageFilter( const Self& );
+ Self& operator=( const Self& );
+ };
+
+ // ---------------------------------------------------------------------
+ CPPLUGINS_INHERIT_PROVIDER( MacheteImageFilter );
+
+ } // ecapseman
+
+} // ecapseman
+
+#endif // __CPPLUGINS__PLUGINS__MacheteImageFilter__H__
+
+// eof - $RCSfile$