1 #ifndef __CPEXTENSIONS__ALGORITHMS__MACHETEIMAGEFILTER__HXX__
2 #define __CPEXTENSIONS__ALGORITHMS__MACHETEIMAGEFILTER__HXX__
4 #include <cpExtensions/Algorithms/MacheteImageFilter.h>
7 #include "itkObjectFactory.h"
8 #include "itkImageRegionIterator.h"
9 #include "itkImageRegionConstIterator.h"
11 //typedef itk::Image<unsigned char, 2> ImageType;
13 template< class I, class O>
14 void cpExtensions::Algorithms::MacheteImageFilter< I, O>
17 //const typename Superclass::OutputImageRegionType& region;
19 typename I::ConstPointer input = this->GetInput();
21 typename O::Pointer output = this->GetOutput();
22 output->SetRegions(input->GetLargestPossibleRegion());
25 itk::ImageRegionIterator<O> outputIterator(output, output->GetLargestPossibleRegion());
26 itk::ImageRegionConstIterator<I> inputIterator(input, input->GetLargestPossibleRegion());
28 while (!outputIterator.IsAtEnd())
30 auto p0 = inputIterator.GetIndex();
31 itk::Point<double, 3> otherPoint;
32 otherPoint[0] = p0[0];
33 otherPoint[1] = p0[1];
34 otherPoint[2] = p0[2];
35 //otherPoint[2] = this->point[2]; // TODO : Solve this hammer
37 double dist = this->point.EuclideanDistanceTo(otherPoint);
38 if (dist <= this->m_Radius)
40 outputIterator.Set(0);
44 outputIterator.Set(inputIterator.Get());
54 template< class I, class O>
55 void cpExtensions::Algorithms::MacheteImageFilter< I, O>::SetRadius(const RadiusType & rad)
57 if (this->m_Radius != rad)
64 //template< class I, class O>
65 //void cpExtensions::Algorithms::MacheteImageFilter< I, O>::SetRadius(const RadiusValueType & rad)
69 // this->SetRadius(r);
72 template< class I, class O>
73 void cpExtensions::Algorithms::MacheteImageFilter< I, O>::SetPoint(itk::Point<double, 3> & p){
81 template< class I, class O>
82 void cpExtensions::Algorithms::MacheteImageFilter< I, O>::SetPoint(const double & x, const double & y, const double & z)