ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkMultiLabelSTAPLEImageFilter.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 itkMultiLabelSTAPLEImageFilter_h
19 #define itkMultiLabelSTAPLEImageFilter_h
20 
21 #include "itkImage.h"
22 #include "itkImageToImageFilter.h"
23 
24 #include "itkImageRegionIterator.h"
26 
27 #include "vector"
28 #include "itkArray.h"
29 #include "itkArray2D.h"
30 #include "itkNumericTraits.h"
31 
32 namespace itk
33 {
117 template <typename TInputImage, typename TOutputImage = TInputImage, typename TWeights = float >
119  public ImageToImageFilter< TInputImage, TOutputImage >
120 {
121 public:
127 
129  itkNewMacro(Self);
130 
133 
136  typedef typename TOutputImage::PixelType OutputPixelType;
137  typedef typename TInputImage::PixelType InputPixelType;
138 
141  itkStaticConstMacro(ImageDimension, unsigned int,
142  TOutputImage::ImageDimension);
143 
145  typedef TInputImage InputImageType;
146  typedef TOutputImage OutputImageType;
147  typedef typename InputImageType::Pointer InputImagePointer;
148  typedef typename OutputImageType::Pointer OutputImagePointer;
149 
152 
156 
158  typedef TWeights WeightsType;
161 
164  void SetMaximumNumberOfIterations( const unsigned int mit )
165  {
166  this->m_MaximumNumberOfIterations = mit;
167  this->m_HasMaximumNumberOfIterations = true;
168  this->Modified();
169  }
171 
175  {
176  if ( this->m_HasMaximumNumberOfIterations )
177  {
178  this->m_HasMaximumNumberOfIterations = false;
179  this->Modified();
180  }
181  }
183 
186  void SetTerminationUpdateThreshold( const TWeights thresh )
187  {
188  this->m_TerminationUpdateThreshold = thresh;
189  this->Modified();
190  }
192 
196  {
197  this->m_LabelForUndecidedPixels = l;
198  this->m_HasLabelForUndecidedPixels = true;
199  this->Modified();
200  }
202 
210  {
211  return this->m_LabelForUndecidedPixels;
212  }
213 
217  {
218  if ( this->m_HasLabelForUndecidedPixels )
219  {
220  this->m_HasLabelForUndecidedPixels = false;
221  this->Modified();
222  }
223  }
225 
229  {
230  this->m_PriorProbabilities = ppa;
231  this->m_HasPriorProbabilities = true;
232  this->Modified();
233  }
235 
243  {
244  return this->m_PriorProbabilities;
245  }
246 
250  {
251  if ( this->m_HasPriorProbabilities )
252  {
253  this->m_HasPriorProbabilities = false;
254  this->Modified();
255  }
256  }
258 
261  ConfusionMatrixType GetConfusionMatrix( const unsigned int i )
262  {
263  return this->m_ConfusionMatrixArray[i];
264  }
265 
266 protected:
275  {
276  }
278 
279  void GenerateData() ITK_OVERRIDE;
280 
281  void PrintSelf(std::ostream&, Indent) const ITK_OVERRIDE;
282 
284  typename TInputImage::PixelType ComputeMaximumInputValue();
285 
286  // Override since the filter needs all the data for the algorithm
287  void GenerateInputRequestedRegion() ITK_OVERRIDE;
288 
289  // Override since the filter produces all of its output
290  void EnlargeOutputRequestedRegion( DataObject * ) ITK_OVERRIDE;
291 
292 private:
293  MultiLabelSTAPLEImageFilter(const Self&) ITK_DELETE_FUNCTION;
294  void operator=(const Self&) ITK_DELETE_FUNCTION;
295 
297 
300 
303 
305 
308 
311 
314 
316 };
317 
318 } // end namespace itk
319 
320 #ifndef ITK_MANUAL_INSTANTIATION
321 #include "itkMultiLabelSTAPLEImageFilter.hxx"
322 #endif
323 
324 #endif
ImageToImageFilter< TInputImage, TOutputImage > Superclass
std::vector< ConfusionMatrixType > m_ConfusionMatrixArray
static const double e
The base of the natural logarithm or Euler&#39;s number
Definition: itkMath.h:47
Base class for all process objects that output image data.
ConfusionMatrixType GetConfusionMatrix(const unsigned int i)
void SetLabelForUndecidedPixels(const OutputPixelType l)
void SetTerminationUpdateThreshold(const TWeights thresh)
ImageRegionIterator< TOutputImage > OutputIteratorType
Array2D class representing a 2D array with size defined at construction time.
Definition: itkArray2D.h:45
void GenerateInputRequestedRegion() override
A multi-dimensional iterator templated over image type that walks a region of pixels.
Superclass::OutputImageRegionType OutputImageRegionType
ImageRegionConstIterator< TInputImage > InputConstIteratorType
void SetMaximumNumberOfIterations(const unsigned int mit)
PriorProbabilitiesType GetPriorProbabilities() const
virtual void Modified() const
This filter performs a pixelwise combination of an arbitrary number of input images, where each of them represents a segmentation of the same scene (i.e., image).
void PrintSelf(std::ostream &, Indent) const override
std::vector< ConfusionMatrixType > m_UpdatedConfusionMatrixArray
void EnlargeOutputRequestedRegion(DataObject *) override
Base class for filters that take an image as input and produce an image as output.
void SetPriorProbabilities(const PriorProbabilitiesType &ppa)
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Superclass::OutputImageRegionType OutputImageRegionType
Define additional traits for native types such as int or float.
TInputImage::PixelType ComputeMaximumInputValue()
Base class for all data objects in ITK.
A multi-dimensional iterator templated over image type that walks a region of pixels.