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

itkObjectMorphologyImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkObjectMorphologyImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-04-25 12:27:45 $
00007   Version:   $Revision: 1.10 $
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 __itkObjectMorphologyImageFilter_h
00018 #define __itkObjectMorphologyImageFilter_h
00019 
00020 #include "itkImageToImageFilter.h"
00021 #include "itkNeighborhoodIterator.h"
00022 #include "itkNeighborhood.h"
00023 #include "itkConstSliceIterator.h"
00024 #include "itkConstantBoundaryCondition.h"
00025 #include "itkImageBoundaryCondition.h"
00026 #include "itkImageRegionIterator.h"
00027 
00028 namespace itk {
00029 
00072 template<class TInputImage, class TOutputImage, class TKernel>
00073 class ITK_EXPORT ObjectMorphologyImageFilter : 
00074     public ImageToImageFilter<TInputImage, TOutputImage>
00075 {
00076 public:
00078   typedef ObjectMorphologyImageFilter                   Self;
00079   typedef ImageToImageFilter<TInputImage,TOutputImage>  Superclass;
00080   typedef SmartPointer<Self>                            Pointer;
00081   typedef SmartPointer<const Self>                      ConstPointer;
00082 
00084   itkTypeMacro(ObjectMorphologyImageFilter, ImageToImageFilter);
00085 
00087   typedef TInputImage                      InputImageType;
00088   typedef TOutputImage                     OutputImageType;
00089   typedef typename TInputImage::RegionType RegionType;
00090   typedef typename TInputImage::SizeType   SizeType;
00091   typedef typename TInputImage::IndexType  IndexType;
00092   typedef typename TInputImage::PixelType  PixelType;
00093 
00094   typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00095 
00096   typedef ImageBoundaryCondition<InputImageType> * 
00097                ImageBoundaryConditionPointerType;
00098   typedef ImageBoundaryCondition<InputImageType> const * 
00099                ImageBoundaryConditionConstPointerType;
00100   typedef ConstantBoundaryCondition<InputImageType> 
00101                DefaultBoundaryConditionType;
00102   
00104   itkStaticConstMacro(ImageDimension, unsigned int,
00105                       TInputImage::ImageDimension);
00106   itkStaticConstMacro(OutputImageDimension, unsigned int,
00107                       TOutputImage::ImageDimension );
00108   itkStaticConstMacro(KernelDimension, unsigned int,
00109                       TKernel::NeighborhoodDimension);  
00111 
00113   typedef ConstNeighborhoodIterator<TInputImage> 
00114                                  InputNeighborhoodIteratorType;
00115   typedef NeighborhoodIterator<TOutputImage> 
00116                                  OutputNeighborhoodIteratorType;
00117 
00119   typedef TKernel KernelType;
00120 
00122   typedef typename KernelType::ConstIterator KernelIteratorType;
00123 
00125   typedef typename KernelType::SizeType RadiusType;
00126 
00128   itkSetMacro(Kernel, KernelType);
00129 
00131   itkGetConstReferenceMacro(Kernel, KernelType);
00132 
00134   itkGetConstMacro(ObjectValue, PixelType);
00135 
00137   itkSetMacro(ObjectValue, PixelType);
00138 
00144   void GenerateInputRequestedRegion();
00145 
00152   void OverrideBoundaryCondition(const ImageBoundaryConditionPointerType i)
00153     { m_BoundaryCondition = i; }
00154 
00156   void ResetBoundaryCondition()
00157     { m_BoundaryCondition = &m_DefaultBoundaryCondition; }
00158 
00160   itkGetConstMacro(BoundaryCondition, ImageBoundaryConditionPointerType);
00161 
00166   itkSetMacro(UseBoundaryCondition, bool);
00167 
00172   itkGetConstMacro(UseBoundaryCondition, bool);
00173 
00174 #ifdef ITK_USE_CONCEPT_CHECKING
00175 
00176   itkConceptMacro(SameDimensionCheck1,
00177     (Concept::SameDimension<ImageDimension, OutputImageDimension>));
00178   itkConceptMacro(SameDimensionCheck2,
00179     (Concept::SameDimension<ImageDimension, KernelDimension>));
00180   itkConceptMacro(OutputInputEqualityComparableCheck,
00181     (Concept::EqualityComparable<typename TOutputImage::PixelType,
00182                                  PixelType>));
00183   itkConceptMacro(InputConvertibleToOutputCheck,
00184     (Concept::Convertible<PixelType, typename TOutputImage::PixelType>));
00185   itkConceptMacro(IntConvertibleToOutputCheck,
00186     (Concept::Convertible<int, typename TOutputImage::PixelType>));
00187   itkConceptMacro(InputEqualityComparable,
00188     (Concept::EqualityComparable<PixelType>));
00189   itkConceptMacro(InputOStreamWritableCheck,
00190     (Concept::OStreamWritable<PixelType>));
00191 
00193 #endif
00194 
00195 protected:
00196   ObjectMorphologyImageFilter();
00197   ~ObjectMorphologyImageFilter() {};
00198   void PrintSelf(std::ostream& os, Indent indent) const;
00199 
00201   void  ThreadedGenerateData (const OutputImageRegionType& 
00202                               outputRegionForThread,
00203                               int threadId);
00204 
00207   virtual void Evaluate(OutputNeighborhoodIteratorType &nit,
00208                         const KernelType &kernel)=0;
00209 
00213   bool IsObjectPixelOnBoundary(const InputNeighborhoodIteratorType &nit);
00214 
00217   ImageBoundaryConditionPointerType m_BoundaryCondition;
00218 
00220   DefaultBoundaryConditionType m_DefaultBoundaryCondition;
00221 
00223   bool m_UseBoundaryCondition;
00224 
00226   KernelType m_Kernel;
00227 
00229   PixelType m_ObjectValue;
00230 
00231   void BeforeThreadedGenerateData();
00232 
00233 private:
00234   ObjectMorphologyImageFilter(const Self&); //purposely not implemented
00235   void operator=(const Self&); //purposely not implemented
00236 
00237   
00238 
00239 }; // end of class
00240 
00241 } // end namespace itk
00242   
00243 #ifndef ITK_MANUAL_INSTANTIATION
00244 #include "itkObjectMorphologyImageFilter.txx"
00245 #endif
00246 
00247 #endif
00248 

Generated at Mon Jul 12 2010 19:20:03 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000