ITK  4.13.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_TEMPLATE_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  {
118  this->m_LabelForUndecidedPixels = l;
119  this->m_HasLabelForUndecidedPixels = true;
120  this->Modified();
121  }
123 
131  {
132  return this->m_LabelForUndecidedPixels;
133  }
134 
138  {
139  if ( this->m_HasLabelForUndecidedPixels )
140  {
141  this->m_HasLabelForUndecidedPixels = false;
142  this->Modified();
143  }
144  }
146 
147 #ifdef ITK_USE_CONCEPT_CHECKING
148  // Begin concept checking
149  itkConceptMacro( InputConvertibleToOutputCheck,
151  itkConceptMacro( IntConvertibleToInputCheck,
153  itkConceptMacro( SameDimensionCheck,
155  itkConceptMacro( InputUnsignedIntCheck,
157  itkConceptMacro( IntConvertibleToOutputPixelType,
159  itkConceptMacro( InputPlusIntCheck,
161  itkConceptMacro( InputIncrementDecrementOperatorsCheck,
163  itkConceptMacro( OutputOStreamWritableCheck,
165  // End concept checking
166 #endif
167 
168 protected:
170  virtual ~LabelVotingImageFilter() ITK_OVERRIDE {}
171 
174  void BeforeThreadedGenerateData() ITK_OVERRIDE;
175 
176  void ThreadedGenerateData
177  (const OutputImageRegionType & outputRegionForThread, ThreadIdType threadId) ITK_OVERRIDE;
178 
179  void PrintSelf(std::ostream &, Indent) const ITK_OVERRIDE;
180 
182  InputPixelType ComputeMaximumInputValue();
183 
184 private:
185  ITK_DISALLOW_COPY_AND_ASSIGN(LabelVotingImageFilter);
186 
187  OutputPixelType m_LabelForUndecidedPixels;
188  bool m_HasLabelForUndecidedPixels;
189  size_t m_TotalLabelCount;
190 };
191 } // end namespace itk
192 
193 #ifndef ITK_MANUAL_INSTANTIATION
194 #include "itkLabelVotingImageFilter.hxx"
195 #endif
196 
197 #endif
InputImageType::ConstPointer InputImagePointer
This filter performs pixelwise voting among an arbitrary number of input images, where each of them r...
OutputPixelType GetLabelForUndecidedPixels() const
Superclass::OutputImageRegionType OutputImageRegionType
void SetLabelForUndecidedPixels(const OutputPixelType l)
Base class for all process objects that output image data.
SmartPointer< const Self > ConstPointer
OutputImageType::Pointer OutputImagePointer
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
TOutputImage::PixelType OutputPixelType
Base class for filters that take an image as input and produce an image as output.
ImageToImageFilter< TInputImage, TOutputImage > Superclass
Control indentation during Print() invocation.
Definition: itkIndent.h:49
TInputImage::PixelType InputPixelType
#define itkConceptMacro(name, concept)