ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkHardConnectedComponentImageFilter.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 __itkHardConnectedComponentImageFilter_h
00019 #define __itkHardConnectedComponentImageFilter_h
00020 
00021 #include "itkImageToImageFilter.h"
00022 #include "itkImage.h"
00023 
00024 namespace itk
00025 {
00048 template< class TInputImage, class TOutputImage >
00049 class ITK_EXPORT HardConnectedComponentImageFilter:
00050   public ImageToImageFilter< TInputImage, TOutputImage >
00051 {
00052 public:
00053 
00057   typedef HardConnectedComponentImageFilter               Self;
00058   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00059 
00064   typedef typename TOutputImage::PixelType         OutputPixelType;
00065   typedef typename TOutputImage::InternalPixelType OutputInternalPixelType;
00066   typedef typename TInputImage::PixelType          InputPixelType;
00067   typedef typename TInputImage::InternalPixelType  InputInternalPixelType;
00068   itkStaticConstMacro(InputImageDimension, unsigned int,
00069                       TInputImage::ImageDimension);
00070   itkStaticConstMacro(ImageDimension, unsigned int,
00071                       TOutputImage::ImageDimension);
00073 
00077   typedef TInputImage                         InputImageType;
00078   typedef TOutputImage                        OutputImageType;
00079   typedef   typename TInputImage::IndexType   IndexType;
00080   typedef   typename TInputImage::SizeType    SizeType;
00081   typedef   typename TOutputImage::RegionType RegionType;
00082   typedef   std::list< IndexType >            ListType;
00083 
00087   typedef SmartPointer< Self >       Pointer;
00088   typedef SmartPointer< const Self > ConstPointer;
00089 
00093   itkTypeMacro(HardConnectedComponentImageFilter, ImageToImageFilter);
00094 
00098   itkNewMacro(Self);
00099 
00101   void SetObjectSeed(const IndexType & seed)
00102   { m_Seeds.push_front(seed); }
00103 
00104 #ifdef ITK_USE_CONCEPT_CHECKING
00105 
00106   itkConceptMacro( SameDimensionCheck,
00107                    ( Concept::SameDimension< InputImageDimension, ImageDimension > ) );
00108   itkConceptMacro( IntConvertibleToOutputCheck,
00109                    ( Concept::Convertible< int, OutputPixelType > ) );
00110   itkConceptMacro( UnsignedShortConvertibleToOutputCheck,
00111                    ( Concept::Convertible< unsigned short, OutputPixelType > ) );
00112   itkConceptMacro( OutputEqualityComparableCheck,
00113                    ( Concept::EqualityComparable< OutputPixelType > ) );
00114   itkConceptMacro( UnsignedCharConvertibleToOutputCheck,
00115                    ( Concept::Convertible< unsigned char, OutputPixelType > ) );
00116   itkConceptMacro( OutputIncrementDecrementOperatorsCheck,
00117                    ( Concept::IncrementDecrementOperators< OutputPixelType > ) );
00118 
00120 #endif
00121 protected:
00122   HardConnectedComponentImageFilter() {}
00123   virtual ~HardConnectedComponentImageFilter() {}
00125 
00129   void GenerateData();
00130 
00131   void PrintSelf(std::ostream & os, Indent indent) const
00132   { Superclass::PrintSelf(os, indent); }
00133 
00134 private:
00135   HardConnectedComponentImageFilter(const Self &); //purposely not implemented
00136   void operator=(const Self &); //purposely not implemented
00137 
00138   ListType m_Seeds;
00139 };
00140 } // end namespace itk
00141 
00142 #ifndef ITK_MANUAL_INSTANTIATION
00143 #include "itkHardConnectedComponentImageFilter.hxx"
00144 #endif
00145 
00146 #endif
00147