ITK  4.5.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 
31 namespace itk
32 {
116 template <typename TInputImage, typename TOutputImage = TInputImage, typename TWeights = float >
118  public ImageToImageFilter< TInputImage, TOutputImage >
119 {
120 public:
126 
128  itkNewMacro(Self);
129 
132 
135  typedef typename TOutputImage::PixelType OutputPixelType;
136  typedef typename TInputImage::PixelType InputPixelType;
137 
140  itkStaticConstMacro(ImageDimension, unsigned int,
141  TOutputImage::ImageDimension);
142 
144  typedef TInputImage InputImageType;
145  typedef TOutputImage OutputImageType;
146  typedef typename InputImageType::Pointer InputImagePointer;
147  typedef typename OutputImageType::Pointer OutputImagePointer;
148 
151 
155 
157  typedef TWeights WeightsType;
160 
163  void SetMaximumNumberOfIterations( const unsigned int mit )
164  {
165  this->m_MaximumNumberOfIterations = mit;
166  this->m_HasMaximumNumberOfIterations = true;
167  this->Modified();
168  }
170 
174  {
175  if ( this->m_HasMaximumNumberOfIterations )
176  {
177  this->m_HasMaximumNumberOfIterations = false;
178  this->Modified();
179  }
180  }
182 
185  void SetTerminationUpdateThreshold( const TWeights thresh )
186  {
187  this->m_TerminationUpdateThreshold = thresh;
188  this->Modified();
189  }
191 
195  {
196  this->m_LabelForUndecidedPixels = l;
197  this->m_HasLabelForUndecidedPixels = true;
198  this->Modified();
199  }
201 
209  {
210  return this->m_LabelForUndecidedPixels;
211  }
212 
216  {
217  if ( this->m_HasLabelForUndecidedPixels )
218  {
219  this->m_HasLabelForUndecidedPixels = false;
220  this->Modified();
221  }
222  }
224 
228  {
229  this->m_PriorProbabilities = ppa;
230  this->m_HasPriorProbabilities = true;
231  this->Modified();
232  }
234 
242  {
243  return this->m_PriorProbabilities;
244  }
245 
249  {
250  if ( this->m_HasPriorProbabilities )
251  {
252  this->m_HasPriorProbabilities = false;
253  this->Modified();
254  }
255  }
257 
260  ConfusionMatrixType GetConfusionMatrix( const unsigned int i )
261  {
262  return this->m_ConfusionMatrixArray[i];
263  }
264 
265 protected:
267  {
268  this->m_HasLabelForUndecidedPixels = false;
269  this->m_HasPriorProbabilities = false;
270  this->m_HasMaximumNumberOfIterations = false;
271  this->m_TerminationUpdateThreshold = 1e-5;
272  }
274 
275  void GenerateData();
276 
277  void PrintSelf(std::ostream&, Indent) const;
278 
280  typename TInputImage::PixelType ComputeMaximumInputValue();
281 
282  // Override since the filter needs all the data for the algorithm
284 
285  // Override since the filter produces all of its output
287 
288 private:
289  MultiLabelSTAPLEImageFilter(const Self&); //purposely not implemented
290  void operator=(const Self&); //purposely not implemented
291 
293 
296 
299 
301 
302  std::vector<ConfusionMatrixType> m_ConfusionMatrixArray;
303  std::vector<ConfusionMatrixType> m_UpdatedConfusionMatrixArray;
304 
307 
310 
312 };
313 
314 } // end namespace itk
315 
316 #ifndef ITK_MANUAL_INSTANTIATION
317 #include "itkMultiLabelSTAPLEImageFilter.hxx"
318 #endif
319 
320 #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:45
Base class for all process objects that output image data.
ConfusionMatrixType GetConfusionMatrix(const unsigned int i)
void SetLabelForUndecidedPixels(const OutputPixelType l)
void EnlargeOutputRequestedRegion(DataObject *)
void SetTerminationUpdateThreshold(const TWeights thresh)
ImageRegionIterator< TOutputImage > OutputIteratorType
Array2D class representing a 2D array with size defined at construction time.
Definition: itkArray2D.h:44
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).
std::vector< ConfusionMatrixType > m_UpdatedConfusionMatrixArray
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
void PrintSelf(std::ostream &, Indent) const
Superclass::OutputImageRegionType OutputImageRegionType
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.