ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkLabelVotingImageFilter.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 __itkLabelVotingImageFilter_h
19 #define __itkLabelVotingImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 
23 namespace itk
24 {
74 template< typename TInputImage, typename TOutputImage = TInputImage >
75 class ITK_EXPORT LabelVotingImageFilter:
76  public ImageToImageFilter< TInputImage, TOutputImage >
77 {
78 public:
84 
86  itkNewMacro(Self);
87 
90 
93  typedef typename TOutputImage::PixelType OutputPixelType;
94  typedef typename TInputImage::PixelType InputPixelType;
95 
98  itkStaticConstMacro(InputImageDimension, unsigned int,
99  TInputImage::ImageDimension);
100  itkStaticConstMacro(ImageDimension, unsigned int,
101  TOutputImage::ImageDimension);
103 
105  typedef TInputImage InputImageType;
106  typedef TOutputImage OutputImageType;
107  typedef typename InputImageType::ConstPointer InputImagePointer;
108  typedef typename OutputImageType::Pointer OutputImagePointer;
109 
111  typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
112 
115  void SetLabelForUndecidedPixels(const OutputPixelType l)
116  {
117  this->m_LabelForUndecidedPixels = l;
118  this->m_HasLabelForUndecidedPixels = true;
119  this->Modified();
120  }
122 
129  OutputPixelType GetLabelForUndecidedPixels() const
130  {
131  return this->m_LabelForUndecidedPixels;
132  }
133 
136  void UnsetLabelForUndecidedPixels()
137  {
138  if ( this->m_HasLabelForUndecidedPixels )
139  {
140  this->m_HasLabelForUndecidedPixels = false;
141  this->Modified();
142  }
143  }
145 
146 #ifdef ITK_USE_CONCEPT_CHECKING
147 
148  itkConceptMacro( InputConvertibleToOutputCheck,
150  itkConceptMacro( IntConvertibleToInputCheck,
152  itkConceptMacro( SameDimensionCheck,
154  itkConceptMacro( InputConvertibleToUnsignedIntCheck,
156  itkConceptMacro( IntConvertibleToOutputPixelType,
158  itkConceptMacro( InputPlusIntCheck,
160  itkConceptMacro( InputIncrementDecrementOperatorsCheck,
162  itkConceptMacro( OutputOStreamWritableCheck,
164 
166 #endif
167 protected:
168  LabelVotingImageFilter() { this->m_HasLabelForUndecidedPixels = false; }
171 
174  void BeforeThreadedGenerateData();
175 
176  void ThreadedGenerateData
177  (const OutputImageRegionType & outputRegionForThread, ThreadIdType threadId);
178 
179  void PrintSelf(std::ostream &, Indent) const;
180 
182  InputPixelType ComputeMaximumInputValue();
183 
184 private:
185  LabelVotingImageFilter(const Self &); //purposely not implemented
186  void operator=(const Self &); //purposely not implemented
187 
191 };
192 } // end namespace itk
193 
194 #ifndef ITK_MANUAL_INSTANTIATION
195 #include "itkLabelVotingImageFilter.hxx"
196 #endif
197 
198 #endif
199