ITK  4.4.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 
110  typedef unsigned long LabelCountType;
111 
113  typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
114 
117  void SetLabelForUndecidedPixels(const OutputPixelType l)
118  {
119  this->m_LabelForUndecidedPixels = l;
120  this->m_HasLabelForUndecidedPixels = true;
121  this->Modified();
122  }
124 
131  OutputPixelType GetLabelForUndecidedPixels() const
132  {
133  return this->m_LabelForUndecidedPixels;
134  }
135 
138  void UnsetLabelForUndecidedPixels()
139  {
140  if ( this->m_HasLabelForUndecidedPixels )
141  {
142  this->m_HasLabelForUndecidedPixels = false;
143  this->Modified();
144  }
145  }
147 
148 #ifdef ITK_USE_CONCEPT_CHECKING
149 
150  itkConceptMacro( InputConvertibleToOutputCheck,
152  itkConceptMacro( IntConvertibleToInputCheck,
154  itkConceptMacro( SameDimensionCheck,
156  itkConceptMacro( InputConvertibleToUnsignedIntCheck,
158  itkConceptMacro( IntConvertibleToOutputPixelType,
160  itkConceptMacro( InputPlusIntCheck,
162  itkConceptMacro( InputIncrementDecrementOperatorsCheck,
164  itkConceptMacro( OutputOStreamWritableCheck,
166 
168 #endif
169 
170 protected:
171  LabelVotingImageFilter() { this->m_HasLabelForUndecidedPixels = false; }
173 
176  void BeforeThreadedGenerateData();
177 
178  void ThreadedGenerateData
179  (const OutputImageRegionType & outputRegionForThread, ThreadIdType threadId);
180 
181  void PrintSelf(std::ostream &, Indent) const;
182 
184  InputPixelType ComputeMaximumInputValue();
185 
186 private:
187  LabelVotingImageFilter(const Self &); //purposely not implemented
188  void operator=(const Self &); //purposely not implemented
189 
193 };
194 } // end namespace itk
195 
196 #ifndef ITK_MANUAL_INSTANTIATION
197 #include "itkLabelVotingImageFilter.hxx"
198 #endif
199 
200 #endif
201