ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkMinimumMaximumImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkMinimumMaximumImageFilter_h
19 #define __itkMinimumMaximumImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
23 
24 #include <vector>
25 
26 #include "itkNumericTraits.h"
27 
28 namespace itk
29 {
43 template< class TInputImage >
44 class ITK_EXPORT MinimumMaximumImageFilter:
45  public ImageToImageFilter< TInputImage, TInputImage >
46 {
47 public:
49  itkStaticConstMacro(InputImageDimension, unsigned int,
50  TInputImage::ImageDimension);
51  itkStaticConstMacro(OutputImageDimension, unsigned int,
52  TInputImage::ImageDimension);
54 
60 
62  typedef typename TInputImage::Pointer InputImagePointer;
63 
64  typedef typename TInputImage::RegionType RegionType;
65  typedef typename TInputImage::SizeType SizeType;
66  typedef typename TInputImage::IndexType IndexType;
67  typedef typename TInputImage::PixelType PixelType;
68 
71 
73  itkNewMacro(Self);
74 
77 
79  typedef TInputImage InputImageType;
80 
83 
85  PixelType GetMinimum() const
86  { return this->GetMinimumOutput()->Get(); }
87  PixelObjectType * GetMinimumOutput();
89 
90  const PixelObjectType * GetMinimumOutput() const;
91 
93  PixelType GetMaximum() const
94  { return this->GetMaximumOutput()->Get(); }
95  PixelObjectType * GetMaximumOutput();
97 
98  const PixelObjectType * GetMaximumOutput() const;
99 
103  using Superclass::MakeOutput;
104  virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx);
105 
106 #ifdef ITK_USE_CONCEPT_CHECKING
107 
108  itkConceptMacro( LessThanComparableCheck,
110  itkConceptMacro( GreaterThanComparableCheck,
112  itkConceptMacro( OStreamWritableCheck,
114 
116 #endif
117 protected:
120  void PrintSelf(std::ostream & os, Indent indent) const;
122 
125  void AllocateOutputs();
126 
128  void BeforeThreadedGenerateData();
129 
132  void AfterThreadedGenerateData();
133 
135  void ThreadedGenerateData(const RegionType &
136  outputRegionForThread,
137  ThreadIdType threadId);
138 
139  // Override since the filter needs all the data for the algorithm
140  void GenerateInputRequestedRegion();
141 
142  // Override since the filter produces all of its output
143  void EnlargeOutputRequestedRegion(DataObject *data);
144 
145 private:
146  MinimumMaximumImageFilter(const Self &); //purposely not implemented
147  void operator=(const Self &); //purposely not implemented
148 
149  std::vector< PixelType > m_ThreadMin;
150  std::vector< PixelType > m_ThreadMax;
151 };
152 } // end namespace itk
153 
154 #ifndef ITK_MANUAL_INSTANTIATION
155 #include "itkMinimumMaximumImageFilter.hxx"
156 #endif
157 
158 #endif
159