ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkSTAPLEImageFilter.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 __itkSTAPLEImageFilter_h
19 #define __itkSTAPLEImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 #include <vector>
23 
24 namespace itk
25 {
120 template< typename TInputImage, typename TOutputImage >
121 class ITK_EXPORT STAPLEImageFilter:
122  public ImageToImageFilter< TInputImage, TOutputImage >
123 {
124 public:
130 
132  itkNewMacro(Self);
133 
136 
139  typedef typename TOutputImage::PixelType OutputPixelType;
140  typedef typename TInputImage::PixelType InputPixelType;
142 
145  itkStaticConstMacro(ImageDimension, unsigned int,
146  TOutputImage::ImageDimension);
147 
149  typedef TInputImage InputImageType;
150  typedef typename InputImageType::Pointer InputImagePointer;
151  typedef TOutputImage OutputImageType;
152  typedef typename OutputImageType::Pointer OutputImagePointer;
153 
155  typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
156 
158  itkSetMacro(ForegroundValue, InputPixelType);
159  itkGetConstMacro(ForegroundValue, InputPixelType);
161 
165  const std::vector< double > & GetSpecificity() const
166  {
167  return m_Specificity;
168  }
169 
173  const std::vector< double > & GetSensitivity() const
174  {
175  return m_Sensitivity;
176  }
177 
180  double GetSensitivity(unsigned int i)
181  {
182  if ( i > this->GetNumberOfIndexedInputs() )
183  {
184  itkExceptionMacro(<< "Array reference out of bounds.");
185  }
186  return m_Sensitivity[i];
187  }
189 
192  double GetSpecificity(unsigned int i)
193  {
194  if ( i > this->GetNumberOfIndexedInputs() )
195  {
196  itkExceptionMacro(<< "Array reference out of bounds.");
197  }
198  return m_Specificity[i];
199  }
201 
205  itkSetMacro(MaximumIterations, unsigned int);
206  itkGetConstMacro(MaximumIterations, unsigned int);
208 
216  itkSetMacro(ConfidenceWeight, double);
217  itkGetConstMacro(ConfidenceWeight, double);
219 
221  itkGetConstMacro(ElapsedIterations, unsigned int);
222 
223 #ifdef ITK_USE_CONCEPT_CHECKING
224 
225  itkConceptMacro( InputHasNumericTraitsCheck,
227 
229 #endif
230 
231 protected:
233  {
234  m_ForegroundValue = NumericTraits< InputPixelType >::One;
235  m_MaximumIterations = NumericTraits< unsigned int >::max();
236  m_ElapsedIterations = 0;
237  m_ConfidenceWeight = 1.0;
238  }
239 
240  virtual ~STAPLEImageFilter() {}
241  void GenerateData();
242 
243  void PrintSelf(std::ostream &, Indent) const;
244 
245 private:
246  STAPLEImageFilter(const Self &); //purposely not implemented
247  void operator=(const Self &); //purposely not implemented
248 
250  unsigned int m_ElapsedIterations;
251  unsigned int m_MaximumIterations;
252 
254 
255  std::vector< double > m_Sensitivity;
256  std::vector< double > m_Specificity;
257 };
258 } // end namespace itk
259 
260 #ifndef ITK_MANUAL_INSTANTIATION
261 #include "itkSTAPLEImageFilter.hxx"
262 #endif
263 
264 #endif
265