#ifndef __CPEXTENSIONS__ALGORITHMS__MACHETEIMAGEFILTER__HXX__ #define __CPEXTENSIONS__ALGORITHMS__MACHETEIMAGEFILTER__HXX__ #include //filter stuff #include "itkObjectFactory.h" #include "itkImageRegionIterator.h" #include "itkImageRegionConstIterator.h" //typedef itk::Image ImageType; template< class I, class O> 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 outputIterator(output, output->GetLargestPossibleRegion()); itk::ImageRegionConstIterator inputIterator(input, input->GetLargestPossibleRegion()); while (!outputIterator.IsAtEnd()) { auto p0 = inputIterator.GetIndex(); itk::Point otherPoint; otherPoint[0] = p0[0]; otherPoint[1] = p0[1]; otherPoint[2] = p0[2]; otherPoint[2] = this->point[2]; // TODO : Solve this hammer double dist = this->point.EuclideanDistanceTo(otherPoint); if (dist <= this->radius) { outputIterator.Set(0); } else { outputIterator.Set(inputIterator.Get()); } ++inputIterator; ++outputIterator; } } template< class I, class O> void cpExtensions::Algorithms::MacheteImageFilter< I, O>::SetRadius(double rad){ this->radius = rad; } template< class I, class O> void cpExtensions::Algorithms::MacheteImageFilter< I, O>::SetPoint(itk::Point point){ this->point = point; } #endif