1 #ifndef itkMultiHistogramFilter_cpp
2 #define itkMultiHistogramFilter_cpp
6 #include <itkNeighborhoodIterator.h>
7 #include <itkImageIterator.h>
9 template<
class TInputImageType,
class TOuputImageType>
11 m_Offset(-3.0), m_Delta(0.6)
13 this->SetNumberOfRequiredOutputs(11);
14 this->SetNumberOfRequiredInputs(0);
16 for (
int i = 0; i < 11; ++i)
22 template<
class TInputImageType,
class TOuputImageType>
27 double delta = m_Delta;
29 typedef itk::NeighborhoodIterator<TInputImageType> IteratorType;
30 typedef itk::ConstNeighborhoodIterator<TInputImageType> ConstIteratorType;
33 CreateOutputImage(input, this->GetOutput(0));
34 CreateOutputImage(input, this->GetOutput(1));
35 CreateOutputImage(input, this->GetOutput(2));
36 CreateOutputImage(input, this->GetOutput(3));
37 CreateOutputImage(input, this->GetOutput(4));
38 CreateOutputImage(input, this->GetOutput(5));
39 CreateOutputImage(input, this->GetOutput(6));
40 CreateOutputImage(input, this->GetOutput(7));
41 CreateOutputImage(input, this->GetOutput(8));
42 CreateOutputImage(input, this->GetOutput(9));
43 CreateOutputImage(input, this->GetOutput(10));
45 typename TInputImageType::SizeType size; size.Fill(5);
46 std::vector<IteratorType> iterVector;
47 for (
int i = 0; i < 11; ++i)
49 IteratorType iter(size, this->GetOutput(i), this->GetOutput(i)->GetLargestPossibleRegion());
50 iterVector.push_back(iter);
53 ConstIteratorType inputIter( size, input, input->GetLargestPossibleRegion());
54 while (!inputIter.IsAtEnd())
56 for (
int i = 0; i < 11; ++i)
58 iterVector[i].SetCenterPixel(0);
61 for (
int i = 0; i < inputIter.Size(); ++i)
63 double value = inputIter.GetPixel(i);
66 int pos = (int)(value);
68 iterVector[pos].SetCenterPixel(iterVector[pos].GetCenterPixel() + 1);
71 for (
int i = 0; i < 11; ++i)
79 template<
class TInputImageType,
class TOuputImageType>
85 return output.GetPointer();
88 template<
class TInputImageType,
class TOuputImageType>
92 output->SetRegions(input->GetLargestPossibleRegion());
96 #endif //itkMultiHistogramFilter_cpp
itk::SmartPointer< Self > Pointer
DataObject::Pointer MakeOutput(unsigned int)
void CreateOutputImage(InputImagePointer input, OutputImagePointer output)
TInputImageType::ConstPointer InputImagePointer
virtual void GenerateData()
TOuputImageType::Pointer OutputImagePointer
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.