ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
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 __itkLaplacianOperator_h 00019 #define __itkLaplacianOperator_h 00020 00021 #include "itkNeighborhoodOperator.h" 00022 00023 namespace itk 00024 { 00062 template< class TPixel, unsigned int VDimension = 2, 00063 class TAllocator = NeighborhoodAllocator< TPixel > > 00064 class ITK_EXPORT LaplacianOperator: 00065 public NeighborhoodOperator< TPixel, VDimension, TAllocator > 00066 { 00067 public: 00068 00070 typedef LaplacianOperator Self; 00071 00073 typedef NeighborhoodOperator< TPixel, VDimension, TAllocator > Superclass; 00074 00075 typedef typename Superclass::PixelType PixelType; 00076 typedef typename Superclass::SizeType SizeType; 00077 00079 LaplacianOperator() 00080 { 00081 for ( unsigned i = 0; i < VDimension; ++i ) 00082 { 00083 m_DerivativeScalings[i] = 1.0; 00084 } 00085 } 00087 00089 LaplacianOperator(const Self & other): 00090 NeighborhoodOperator< TPixel, VDimension, TAllocator >(other) 00091 { 00092 for ( unsigned i = 0; i < VDimension; ++i ) 00093 { 00094 m_DerivativeScalings[i] = other.m_DerivativeScalings[i]; 00095 } 00096 } 00098 00100 void CreateOperator(); 00101 00103 Self & operator=(const Self & other) 00104 { 00105 Superclass::operator=(other); 00106 return *this; 00107 } 00109 00111 virtual void PrintSelf(std::ostream & os, Indent i) const 00112 { 00113 os << i << "LaplacianOperator { this=" << this 00114 << "}" << std::endl; 00115 Superclass::PrintSelf( os, i.GetNextIndent() ); 00116 } 00118 00122 void SetDerivativeScalings(const double *s); 00123 00124 protected: 00127 typedef typename Superclass::CoefficientVector CoefficientVector; 00128 00130 CoefficientVector GenerateCoefficients(); 00131 00134 void Fill(const CoefficientVector &); 00135 00136 private: 00138 double m_DerivativeScalings[VDimension]; 00139 }; 00140 } // namespace itk 00141 00142 // Define instantiation macro for this template. 00143 #define ITK_TEMPLATE_LaplacianOperator(_, EXPORT, TypeX, TypeY) \ 00144 namespace itk \ 00145 { \ 00146 _( 2 ( class EXPORT LaplacianOperator< ITK_TEMPLATE_2 TypeX > ) ) \ 00147 namespace Templates \ 00148 { \ 00149 typedef LaplacianOperator< ITK_TEMPLATE_2 TypeX > \ 00150 LaplacianOperator##TypeY; \ 00151 } \ 00152 } 00153 00154 #if ITK_TEMPLATE_EXPLICIT 00155 #include "Templates/itkLaplacianOperator+-.h" 00156 #endif 00157 00158 #if ITK_TEMPLATE_TXX 00159 #include "itkLaplacianOperator.hxx" 00160 #endif 00161 00162 #endif 00163