Medical Imaging Interaction Toolkit  2018.4.99-a28b433c
Medical Imaging Interaction Toolkit
mitkMinMaxImageFilterWithIndex.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef MITK_MINMAXIMAGEFILTERWITHINDEX_H
14 #define MITK_MINMAXIMAGEFILTERWITHINDEX_H
15 
17 
18 #include <itkImage.h>
19 #include <itkImageToImageFilter.h>
20 #include <itkImageRegionConstIteratorWithIndex.h>
21 
22 
23 
24 namespace itk
25 {
26 template <typename TInputImage>
27 class MinMaxImageFilterWithIndex: public itk::ImageToImageFilter<TInputImage, TInputImage>
28 {
29 public:
32  typedef ImageToImageFilter< TInputImage, TInputImage > Superclass;
35 
37  itkNewMacro(Self);
38 
40  itkTypeMacro(MinMaxImageFilterWithIndex, ImageToImageFilter);
41 
42  typedef typename TInputImage::RegionType RegionType;
43  typedef typename TInputImage::SizeType SizeType;
44  typedef typename TInputImage::IndexType IndexType;
45  typedef typename TInputImage::PixelType PixelType;
46  typedef typename NumericTraits< PixelType >::RealType RealType;
47 
48 
49  RealType GetMin() const
50  {
51  return m_Min;
52  }
53 
54  RealType GetMax() const
55  {
56  return m_Max;
57  }
58 
59  IndexType GetMinIndex() const
60  {
61  return m_MinIndex;
62  }
63 
64  IndexType GetMaxIndex() const
65  {
66  return m_MaxIndex;
67  }
68 
69 protected:
70  void AllocateOutputs() override;
71 
72  void ThreadedGenerateData(const RegionType &
73  outputRegionForThread,
74  ThreadIdType threadId) override;
75 
76  void BeforeThreadedGenerateData() override;
77 
78  void AfterThreadedGenerateData() override;
79 
80 private:
81  std::vector<PixelType> m_ThreadMin;
82  std::vector<PixelType> m_ThreadMax;
83  std::vector<IndexType> m_ThreadMinIndex;
84  std::vector<IndexType> m_ThreadMaxIndex;
85 
86  PixelType m_Min;
87  PixelType m_Max;
88  IndexType m_MinIndex;
89  IndexType m_MaxIndex;
90 };
91 }
92 
93 #include "mitkMinMaxImageFilterWithIndex.hxx"
94 
95 
96 #endif
NumericTraits< PixelType >::RealType RealType
void AfterThreadedGenerateData() override
void BeforeThreadedGenerateData() override
ImageToImageFilter< TInputImage, TInputImage > Superclass
void ThreadedGenerateData(const RegionType &outputRegionForThread, ThreadIdType threadId) override