ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkSobelOperator.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 __itkSobelOperator_h
00019 #define __itkSobelOperator_h
00020 
00021 #include "itkNeighborhoodOperator.h"
00022 
00023 namespace itk
00024 {
00094 template< class TPixel, unsigned int VDimension = 2,
00095           class TAllocator = NeighborhoodAllocator< TPixel > >
00096 class ITK_EXPORT SobelOperator:
00097   public NeighborhoodOperator< TPixel, VDimension, TAllocator >
00098 {
00099 public:
00100 
00102   typedef SobelOperator                                          Self;
00103   typedef NeighborhoodOperator< TPixel, VDimension, TAllocator > Superclass;
00104 
00105   itkTypeMacro(SobelOperator, NeighborhoodOperator);
00106 
00107   SobelOperator() {}
00108   SobelOperator(const Self & other):
00109     NeighborhoodOperator< TPixel, VDimension, TAllocator >(other)
00110   {}
00111 
00117   virtual void CreateDirectional()
00118   {
00119     this->CreateToRadius(1);
00120   }
00121 
00126   // virtual void CreateToRadius(const unsigned long);
00127 
00131   Self & operator=(const Self & other)
00132   {
00133     Superclass::operator=(other);
00134     return *this;
00135   }
00137 
00141   virtual void PrintSelf(std::ostream & os, Indent i) const
00142   {
00143     os << i << "SobelOperator { this=" << this  << "}" << std::endl;
00144     Superclass::PrintSelf( os, i.GetNextIndent() );
00145   }
00147 
00148 protected:
00153   typedef typename Superclass::CoefficientVector CoefficientVector;
00154   typedef typename Superclass::PixelType         PixelType;
00155 
00159   CoefficientVector GenerateCoefficients();
00160 
00164   void Fill(const CoefficientVector & c);
00165 };
00166 } // namespace itk
00167 
00168 // Define instantiation macro for this template.
00169 #define ITK_TEMPLATE_SobelOperator(_, EXPORT, TypeX, TypeY)     \
00170   namespace itk                                                 \
00171   {                                                             \
00172   _( 2 ( class EXPORT SobelOperator< ITK_TEMPLATE_2 TypeX > ) ) \
00173   namespace Templates                                           \
00174   {                                                             \
00175   typedef SobelOperator< ITK_TEMPLATE_2 TypeX >                 \
00176   SobelOperator##TypeY;                                       \
00177   }                                                             \
00178   }
00179 
00180 #if ITK_TEMPLATE_EXPLICIT
00181 #include "Templates/itkSobelOperator+-.h"
00182 #endif
00183 
00184 #if ITK_TEMPLATE_TXX
00185 #include "itkSobelOperator.hxx"
00186 #endif
00187 
00188 #endif
00189