ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkVotingBinaryHoleFillingImageFilter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkVotingBinaryHoleFillingImageFilter_h
00019 #define __itkVotingBinaryHoleFillingImageFilter_h
00020 
00021 #include "itkVotingBinaryImageFilter.h"
00022 #include "itkArray.h"
00023 
00024 namespace itk
00025 {
00040 template< class TInputImage, class TOutputImage >
00041 class ITK_EXPORT VotingBinaryHoleFillingImageFilter:
00042   public VotingBinaryImageFilter< TInputImage, TOutputImage >
00043 {
00044 public:
00046   itkStaticConstMacro(InputImageDimension, unsigned int,
00047                       TInputImage::ImageDimension);
00048   itkStaticConstMacro(OutputImageDimension, unsigned int,
00049                       TOutputImage::ImageDimension);
00051 
00053   typedef TInputImage  InputImageType;
00054   typedef TOutputImage OutputImageType;
00055 
00057   typedef VotingBinaryHoleFillingImageFilter                         Self;
00058   typedef VotingBinaryImageFilter< InputImageType, OutputImageType > Superclass;
00059   typedef SmartPointer< Self >                                       Pointer;
00060   typedef SmartPointer< const Self >                                 ConstPointer;
00061 
00063   itkNewMacro(Self);
00064 
00066   itkTypeMacro(VotingBinaryHoleFillingImageFilter, VotingBinaryImageFilter);
00067 
00069   typedef typename InputImageType::PixelType  InputPixelType;
00070   typedef typename OutputImageType::PixelType OutputPixelType;
00071 
00072   typedef typename InputImageType::RegionType  InputImageRegionType;
00073   typedef typename OutputImageType::RegionType OutputImageRegionType;
00074 
00075   typedef typename InputImageType::SizeType      InputSizeType;
00076   typedef typename InputImageType::SizeValueType SizeValueType;
00077 
00084   itkGetConstReferenceMacro(MajorityThreshold, unsigned int);
00085   itkSetMacro(MajorityThreshold, unsigned int);
00087 
00089   itkGetConstReferenceMacro(NumberOfPixelsChanged, SizeValueType);
00090 
00091 #ifdef ITK_USE_CONCEPT_CHECKING
00092 
00093   itkConceptMacro( IntConvertibleToInputCheck,
00094                    ( Concept::Convertible< int, InputPixelType > ) );
00095   itkConceptMacro( UnsignedIntConvertibleToInputCheck,
00096                    ( Concept::Convertible< unsigned int, InputPixelType > ) );
00097 
00099 #endif
00100 protected:
00101   VotingBinaryHoleFillingImageFilter();
00102   virtual ~VotingBinaryHoleFillingImageFilter() {}
00103   void PrintSelf(std::ostream & os, Indent indent) const;
00105 
00109   void SetBirthThreshold(const unsigned int value)
00110   { this->Superclass::SetBirthThreshold(value);  }
00111   void SetSurvivalThreshold(const unsigned int value)
00112   { this->Superclass::SetSurvivalThreshold(value);  }
00114 
00125   void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
00126                             ThreadIdType threadId);
00127 
00130   void BeforeThreadedGenerateData();
00131 
00132   void AfterThreadedGenerateData();
00133 
00134 private:
00135   VotingBinaryHoleFillingImageFilter(const Self &); //purposely not implemented
00136   void operator=(const Self &);                     //purposely not implemented
00137 
00138   unsigned int m_MajorityThreshold;
00139 
00140   SizeValueType m_NumberOfPixelsChanged;
00141 
00142   // Auxiliary array for multi-threading
00143   Array< SizeValueType > m_Count;
00144 };
00145 } // end namespace itk
00146 
00147 #ifndef ITK_MANUAL_INSTANTIATION
00148 #include "itkVotingBinaryHoleFillingImageFilter.hxx"
00149 #endif
00150 
00151 #endif
00152