ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkConnectedComponentFunctorImageFilter.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 __itkConnectedComponentFunctorImageFilter_h
00019 #define __itkConnectedComponentFunctorImageFilter_h
00020 
00021 #include "itkConnectedComponentImageFilter.h"
00022 
00023 namespace itk
00024 {
00053 template< class TInputImage, class TOutputImage, class TFunctor, class TMaskImage = TInputImage >
00054 class ITK_EXPORT ConnectedComponentFunctorImageFilter:
00055   public ConnectedComponentImageFilter< TInputImage, TOutputImage, TMaskImage >
00056 {
00057 public:
00061   typedef ConnectedComponentFunctorImageFilter                                   Self;
00062   typedef ConnectedComponentImageFilter< TInputImage, TOutputImage, TMaskImage > Superclass;
00063 
00067   typedef typename Superclass::InputImagePointer InputImagePointer;
00068 
00073   typedef typename TOutputImage::PixelType         OutputPixelType;
00074   typedef typename TOutputImage::InternalPixelType OutputInternalPixelType;
00075   typedef typename TInputImage::PixelType          InputPixelType;
00076   typedef typename TInputImage::InternalPixelType  InputInternalPixelType;
00077   typedef typename TMaskImage::PixelType           MaskPixelType;
00078   itkStaticConstMacro(ImageDimension, unsigned int,
00079                       TOutputImage::ImageDimension);
00080   itkStaticConstMacro(InputImageDimension, unsigned int,
00081                       TInputImage::ImageDimension);
00083 
00087   typedef TFunctor     FunctorType;
00088   typedef TInputImage  InputImageType;
00089   typedef TMaskImage   MaskImageType;
00090   typedef TOutputImage OutputImageType;
00091 
00092   typedef   typename TInputImage::IndexType   IndexType;
00093   typedef   typename TInputImage::SizeType    SizeType;
00094   typedef   typename TOutputImage::RegionType RegionType;
00095   typedef   std::list< IndexType >            ListType;
00096 
00097   typedef typename MaskImageType::Pointer MaskImagePointer;
00098 
00102   typedef SmartPointer< Self >       Pointer;
00103   typedef SmartPointer< const Self > ConstPointer;
00104 
00108   itkTypeMacro(ConnectedComponentFunctorImageFilter, ImageToImageFilter);
00109 
00113   itkNewMacro(Self);
00114 
00119   FunctorType &       GetFunctor() { return m_Functor; }
00120   const FunctorType & GetFunctor() const { return m_Functor; }
00122 
00129   void SetFunctor(const FunctorType & functor)
00130   {
00131     m_Functor = functor;
00132     this->Modified();
00133   }
00135 
00136 #ifdef ITK_USE_CONCEPT_CHECKING
00137 
00138   itkConceptMacro( SameDimensionCheck,
00139                    ( Concept::SameDimension< InputImageDimension, ImageDimension > ) );
00140   itkConceptMacro( InputEqualityComparableCheck,
00141                    ( Concept::EqualityComparable< InputPixelType > ) );
00142   itkConceptMacro( OutputEqualityComparableCheck,
00143                    ( Concept::EqualityComparable< OutputPixelType > ) );
00144   itkConceptMacro( OutputConvertibleToUnsignedIntCheck,
00145                    ( Concept::Convertible< OutputPixelType, unsigned int > ) );
00146   itkConceptMacro( OutputConvertibleToUnsignedLongCheck,
00147                    ( Concept::Convertible< OutputPixelType, unsigned long > ) );
00148   itkConceptMacro( OutputConvertibleToLongCheck,
00149                    ( Concept::Convertible< OutputPixelType, long > ) );
00150   itkConceptMacro( UnsignedLongConvertibleToOutputCheck,
00151                    ( Concept::Convertible< unsigned long, OutputPixelType > ) );
00152   itkConceptMacro( OutputIncrementDecrementOperatorsCheck,
00153                    ( Concept::IncrementDecrementOperators< OutputPixelType > ) );
00154 
00156 #endif
00157 protected:
00158   ConnectedComponentFunctorImageFilter() {}
00159   virtual ~ConnectedComponentFunctorImageFilter() {}
00160   ConnectedComponentFunctorImageFilter(const Self &) {}
00162 
00163   FunctorType m_Functor;
00164 
00168   void GenerateData();
00169 };
00170 } // end namespace itk
00171 
00172 #ifndef ITK_MANUAL_INSTANTIATION
00173 #include "itkConnectedComponentFunctorImageFilter.hxx"
00174 #endif
00175 
00176 #endif
00177