ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkStatisticsImageFilter.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 __itkStatisticsImageFilter_h
19 #define __itkStatisticsImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 #include "itkNumericTraits.h"
23 #include "itkArray.h"
25 
26 namespace itk
27 {
48 template< class TInputImage >
49 class ITK_EXPORT StatisticsImageFilter:
50  public ImageToImageFilter< TInputImage, TInputImage >
51 {
52 public:
58 
60  itkNewMacro(Self);
61 
64 
66  typedef typename TInputImage::Pointer InputImagePointer;
67 
68  typedef typename TInputImage::RegionType RegionType;
69  typedef typename TInputImage::SizeType SizeType;
70  typedef typename TInputImage::IndexType IndexType;
71  typedef typename TInputImage::PixelType PixelType;
72 
74  itkStaticConstMacro(ImageDimension, unsigned int,
75  TInputImage::ImageDimension);
76 
79 
82 
86 
88  PixelType GetMinimum() const
89  { return this->GetMinimumOutput()->Get(); }
90  PixelObjectType * GetMinimumOutput();
92 
93  const PixelObjectType * GetMinimumOutput() const;
94 
96  PixelType GetMaximum() const
97  { return this->GetMaximumOutput()->Get(); }
98  PixelObjectType * GetMaximumOutput();
100 
101  const PixelObjectType * GetMaximumOutput() const;
102 
104  RealType GetMean() const
105  { return this->GetMeanOutput()->Get(); }
106  RealObjectType * GetMeanOutput();
108 
109  const RealObjectType * GetMeanOutput() const;
110 
112  RealType GetSigma() const
113  { return this->GetSigmaOutput()->Get(); }
114  RealObjectType * GetSigmaOutput();
116 
117  const RealObjectType * GetSigmaOutput() const;
118 
120  RealType GetVariance() const
121  { return this->GetVarianceOutput()->Get(); }
122  RealObjectType * GetVarianceOutput();
124 
125  const RealObjectType * GetVarianceOutput() const;
126 
128  RealType GetSum() const
129  { return this->GetSumOutput()->Get(); }
130  RealObjectType * GetSumOutput();
132 
133  const RealObjectType * GetSumOutput() const;
134 
138  using Superclass::MakeOutput;
139  virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx);
140 
141 #ifdef ITK_USE_CONCEPT_CHECKING
142 
143  itkConceptMacro( InputHasNumericTraitsCheck,
145 
147 #endif
148 
149 protected:
152  void PrintSelf(std::ostream & os, Indent indent) const;
153 
157  void AllocateOutputs();
158 
160  void BeforeThreadedGenerateData();
161 
164  void AfterThreadedGenerateData();
165 
167  void ThreadedGenerateData(const RegionType &
168  outputRegionForThread,
169  ThreadIdType threadId);
170 
171  // Override since the filter needs all the data for the algorithm
172  void GenerateInputRequestedRegion();
173 
174  // Override since the filter produces all of its output
175  void EnlargeOutputRequestedRegion(DataObject *data);
176 
177 private:
178  StatisticsImageFilter(const Self &); //purposely not implemented
179  void operator=(const Self &); //purposely not implemented
180 
186 }; // end of class
187 } // end namespace itk
188 
189 #ifndef ITK_MANUAL_INSTANTIATION
190 #include "itkStatisticsImageFilter.hxx"
191 #endif
192 
193 #endif
194