ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkAnchorOpenCloseImageFilter.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 __itkAnchorOpenCloseImageFilter_h
00019 #define __itkAnchorOpenCloseImageFilter_h
00020 
00021 #include "itkKernelImageFilter.h"
00022 #include "itkProgressReporter.h"
00023 #include "itkAnchorOpenCloseLine.h"
00024 #include "itkAnchorErodeDilateLine.h"
00025 #include "itkBresenhamLine.h"
00026 
00027 namespace itk
00028 {
00050 template< class TImage, class TKernel, class TCompare1, class TCompare2 >
00051 class ITK_EXPORT AnchorOpenCloseImageFilter:
00052   public KernelImageFilter< TImage, TImage, TKernel >
00053 {
00054 public:
00055 
00057   typedef AnchorOpenCloseImageFilter           Self;
00058   typedef KernelImageFilter< TImage, TImage, TKernel >
00059                                                Superclass;
00060   typedef SmartPointer< Self >                 Pointer;
00061   typedef SmartPointer< const Self >           ConstPointer;
00062 
00066   typedef TKernel                    KernelType;
00067   typedef typename KernelType::LType KernelLType;
00068 
00069   typedef TImage                                InputImageType;
00070   typedef typename InputImageType::Pointer      InputImagePointer;
00071   typedef typename InputImageType::ConstPointer InputImageConstPointer;
00072   typedef typename InputImageType::RegionType   InputImageRegionType;
00073   typedef typename InputImageType::PixelType    InputImagePixelType;
00074 
00076   itkStaticConstMacro(InputImageDimension, unsigned int,
00077                       TImage::ImageDimension);
00078   itkStaticConstMacro(OutputImageDimension, unsigned int,
00079                       TImage::ImageDimension);
00081 
00083   itkNewMacro(Self);
00084 
00086   itkTypeMacro(AnchorOpenCloseImageFilter,
00087                KernelImageFilter);
00088 
00089 protected:
00090   AnchorOpenCloseImageFilter();
00091   ~AnchorOpenCloseImageFilter() {}
00092   void PrintSelf(std::ostream & os, Indent indent) const;
00093 
00095   void  ThreadedGenerateData(const InputImageRegionType & outputRegionForThread,
00096                              ThreadIdType threadId);
00097 
00098   InputImagePixelType m_Boundary1, m_Boundary2;
00099 private:
00100   AnchorOpenCloseImageFilter(const Self &); //purposely not implemented
00101   void operator=(const Self &);             //purposely not implemented
00102 
00103   typedef BresenhamLine< itkGetStaticConstMacro(InputImageDimension) > BresType;
00104   typedef typename BresType::OffsetArray                               BresOffsetArray;
00105 
00106   // the class that operates on lines -- does the opening in one
00107   // operation. The classes following are named on the assumption that
00108   // we are doing an opening
00109 
00110 //  typedef AnchorOpenCloseLine<InputImagePixelType, THistogramCompare,
00111 // TFunction1, TFunction2> AnchorLineOpenType;
00112   typedef AnchorOpenCloseLine< InputImagePixelType, TCompare1 > AnchorLineOpenType;
00113 
00114   typedef AnchorErodeDilateLine< InputImagePixelType, TCompare1 > AnchorLineErodeType;
00115 
00116   // the class that does the dilation
00117   typedef AnchorErodeDilateLine< InputImagePixelType, TCompare2 > AnchorLineDilateType;
00118 
00119   void DoFaceOpen(InputImageConstPointer input,
00120                   InputImagePointer output,
00121                   InputImagePixelType border,
00122                   KernelLType line,
00123                   AnchorLineOpenType & AnchorLineOpen,
00124                   const BresOffsetArray LineOffsets,
00125                   std::vector<InputImagePixelType> & outbuffer,
00126                   const InputImageRegionType AllImage,
00127                   const InputImageRegionType face);
00128 }; // end of class
00129 } // end namespace itk
00130 
00131 #ifndef ITK_MANUAL_INSTANTIATION
00132 #include "itkAnchorOpenCloseImageFilter.hxx"
00133 #endif
00134 
00135 #endif
00136