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->radius)
40 outputIterator.Set(0);
44 outputIterator.Set(inputIterator.Get());
53 template< class I, class O>
54 void cpExtensions::Algorithms::MacheteImageFilter< I, O>::SetRadius(double rad){
58 template< class I, class O>
59 void cpExtensions::Algorithms::MacheteImageFilter< I, O>::SetPoint(itk::Point<double, 3> point){