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: 2009-01-24 20:02:57 $
00007   Version:   $Revision: 1.5 $
00008 
00009   Copyright (c) Insight Software 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 
00173   void BeforeThreadedGenerateData ();
00174   void ThreadedGenerateData
00175     ( const OutputImageRegionType &outputRegionForThread, int threadId);
00177 
00178   void PrintSelf(std::ostream&, Indent) const;
00179 
00181   InputPixelType ComputeMaximumInputValue();
00182 
00183 private:
00184   LabelVotingImageFilter(const Self&); //purposely not implemented
00185   void operator=(const Self&); //purposely not implemented
00186 
00187   OutputPixelType m_LabelForUndecidedPixels;
00188   bool            m_HasLabelForUndecidedPixels;
00189   InputPixelType  m_TotalLabelCount;
00190 };
00191   
00192 } // end namespace itk
00193 
00194 #ifndef ITK_MANUAL_INSTANTIATION
00195 #include "itkLabelVotingImageFilter.txx"
00196 #endif
00197 
00198 #endif
00199 

Generated at Fri Apr 16 18:56:07 2010 for ITK by doxygen 1.6.1 written by Dimitri van Heesch, © 1997-2000