Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkLabelVotingImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkLabelVotingImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2006/04/07 11:42:31 $
00007   Version:   $Revision: 1.4 $
00008 
00009   Copyright (c) 2002 Insight Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
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(InputImageDimension, unsigned int,
00098                       TInputImage::ImageDimension );
00099   itkStaticConstMacro(ImageDimension, unsigned int,
00100                       TOutputImage::ImageDimension);
00102 
00104   typedef TInputImage  InputImageType;
00105   typedef TOutputImage OutputImageType;
00106   typedef typename InputImageType::ConstPointer InputImagePointer;
00107   typedef typename OutputImageType::Pointer     OutputImagePointer;
00108 
00110   typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00111 
00114   void SetLabelForUndecidedPixels( const OutputPixelType l )
00115   {
00116     this->m_LabelForUndecidedPixels = l;
00117     this->m_HasLabelForUndecidedPixels = true;
00118     this->Modified();
00119   }
00121 
00128   OutputPixelType GetLabelForUndecidedPixels() const
00129   {
00130     return this->m_LabelForUndecidedPixels;
00131   }
00132 
00135   void UnsetLabelForUndecidedPixels()
00136   {
00137     if ( this->m_HasLabelForUndecidedPixels )
00138       {
00139       this->m_HasLabelForUndecidedPixels = false;
00140       this->Modified();
00141       }
00142   }
00144 
00145 #ifdef ITK_USE_CONCEPT_CHECKING
00146 
00147   itkConceptMacro(InputConvertibleToOutputCheck,
00148     (Concept::Convertible<InputPixelType, OutputPixelType>));
00149   itkConceptMacro(IntConvertibleToInputCheck,
00150     (Concept::Convertible<int, InputPixelType>));
00151   itkConceptMacro(SameDimensionCheck,
00152     (Concept::SameDimension<InputImageDimension, ImageDimension>));
00153   itkConceptMacro(InputConvertibleToUnsignedIntCheck,
00154     (Concept::Convertible<InputPixelType, unsigned int>));
00155   itkConceptMacro(IntConvertibleToOutputPixelType,
00156     (Concept::Convertible<int, OutputPixelType>));
00157   itkConceptMacro(InputPlusIntCheck,
00158     (Concept::AdditiveOperators<InputPixelType, int>));
00159   itkConceptMacro(InputIncrementDecrementOperatorsCheck,
00160     (Concept::IncrementDecrementOperators<InputPixelType>));
00161   itkConceptMacro(OutputOStreamWritableCheck,
00162     (Concept::OStreamWritable<OutputPixelType>));
00163 
00165 #endif
00166 
00167 protected:
00168   LabelVotingImageFilter() { this->m_HasLabelForUndecidedPixels = false; }
00169   virtual ~LabelVotingImageFilter() {}  
00170 
00172   void BeforeThreadedGenerateData ();
00173   void ThreadedGenerateData
00174   ( const OutputImageRegionType &outputRegionForThread, int threadId);
00176 
00177   void PrintSelf(std::ostream&, Indent) const;
00178 
00180   InputPixelType ComputeMaximumInputValue();
00181 
00182 private:
00183   LabelVotingImageFilter(const Self&); //purposely not implemented
00184   void operator=(const Self&); //purposely not implemented
00185 
00186   OutputPixelType m_LabelForUndecidedPixels;
00187   bool m_HasLabelForUndecidedPixels;
00188   InputPixelType m_TotalLabelCount;
00189 };
00190   
00191 } // end namespace itk
00192 
00193 #ifndef ITK_MANUAL_INSTANTIATION
00194 #include "itkLabelVotingImageFilter.txx"
00195 #endif
00196 
00197 #endif
00198 

Generated at Wed Nov 5 22:36:38 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000