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 typename I::ConstPointer input = this->GetInput();
19 typename O::Pointer output = this->GetOutput();
20 output->SetRegions(input->GetLargestPossibleRegion());
23 itk::ImageRegionIterator<I> outputIterator(output, output->GetLargestPossibleRegion());
24 itk::ImageRegionConstIterator<O> inputIterator(input, input->GetLargestPossibleRegion());
26 while (!outputIterator.IsAtEnd())
28 auto p0 = inputIterator.GetIndex();
29 itk::Point<double, 3> otherPoint;
30 otherPoint[0] = p0[0];
31 otherPoint[1] = p0[1];
32 otherPoint[2] = p0[2];
33 otherPoint[2] = this->point[2]; // TODO : Solve this hammer
35 double dist = this->point.EuclideanDistanceTo(otherPoint);
36 if (dist <= this->radius)
38 outputIterator.Set(0);
42 outputIterator.Set(inputIterator.Get());
51 template< class I, class O>
52 void cpExtensions::Algorithms::MacheteImageFilter< I, O>::SetRadius(double rad){
56 template< class I, class O>
57 void cpExtensions::Algorithms::MacheteImageFilter< I, O>::SetPoint(itk::Point<double, 3> point){