00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkLabelVotingImageFilter_h
00018 #define __itkLabelVotingImageFilter_h
00019
00020 #include "itkImage.h"
00021 #include "itkImageToImageFilter.h"
00022
00023 namespace itk
00024 {
00073 template <typename TInputImage, typename TOutputImage = TInputImage>
00074 class ITK_EXPORT LabelVotingImageFilter :
00075 public ImageToImageFilter< TInputImage, TOutputImage >
00076 {
00077 public:
00079 typedef LabelVotingImageFilter Self;
00080 typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00081 typedef SmartPointer<Self> Pointer;
00082 typedef SmartPointer<const Self> ConstPointer;
00083
00085 itkNewMacro(Self);
00086
00088 itkTypeMacro(LabelVotingImageFilter, ImageToImageFilter);
00089
00092 typedef typename TOutputImage::PixelType OutputPixelType;
00093 typedef typename TInputImage::PixelType InputPixelType;
00094
00097 itkStaticConstMacro(ImageDimension, unsigned int,
00098 TOutputImage::ImageDimension);
00099
00101 typedef TInputImage InputImageType;
00102 typedef TOutputImage OutputImageType;
00103 typedef typename InputImageType::ConstPointer InputImagePointer;
00104 typedef typename OutputImageType::Pointer OutputImagePointer;
00105
00107 typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00108
00111 void SetLabelForUndecidedPixels( const OutputPixelType l )
00112 {
00113 this->m_LabelForUndecidedPixels = l;
00114 this->m_HasLabelForUndecidedPixels = true;
00115 this->Modified();
00116 }
00117
00124 OutputPixelType GetLabelForUndecidedPixels() const
00125 {
00126 return this->m_LabelForUndecidedPixels;
00127 }
00128
00131 void UnsetLabelForUndecidedPixels()
00132 {
00133 if ( this->m_HasLabelForUndecidedPixels )
00134 {
00135 this->m_HasLabelForUndecidedPixels = false;
00136 this->Modified();
00137 }
00138 }
00139
00140 protected:
00141 LabelVotingImageFilter() { this->m_HasLabelForUndecidedPixels = false; }
00142 virtual ~LabelVotingImageFilter() {}
00143
00145 void BeforeThreadedGenerateData ();
00146 void ThreadedGenerateData
00147 ( const OutputImageRegionType &outputRegionForThread, int threadId);
00148
00149 void PrintSelf(std::ostream&, Indent) const;
00150
00152 InputPixelType ComputeMaximumInputValue();
00153
00154 private:
00155 LabelVotingImageFilter(const Self&);
00156 void operator=(const Self&);
00157
00158 OutputPixelType m_LabelForUndecidedPixels;
00159 bool m_HasLabelForUndecidedPixels;
00160 InputPixelType m_TotalLabelCount;
00161 };
00162
00163 }
00164
00165 #ifndef ITK_MANUAL_INSTANTIATION
00166 #include "itkLabelVotingImageFilter.txx"
00167 #endif
00168
00169 #endif