ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkLevelSetEquationChanAndVeseInternalTerm.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 
00019 #ifndef __itkLevelSetEquationChanAndVeseInternalTerm_h
00020 #define __itkLevelSetEquationChanAndVeseInternalTerm_h
00021 
00022 #include "itkLevelSetEquationTermBase.h"
00023 
00024 namespace itk
00025 {
00046 template< class TInput, // Input image or mesh
00047           class TLevelSetContainer >
00048 class LevelSetEquationChanAndVeseInternalTerm :
00049     public LevelSetEquationTermBase< TInput, TLevelSetContainer >
00050 {
00051 public:
00052   typedef LevelSetEquationChanAndVeseInternalTerm         Self;
00053   typedef SmartPointer< Self >                            Pointer;
00054   typedef SmartPointer< const Self >                      ConstPointer;
00055   typedef LevelSetEquationTermBase< TInput,
00056                                     TLevelSetContainer >  Superclass;
00058 
00060   itkNewMacro( Self );
00061 
00063   itkTypeMacro( LevelSetEquationChanAndVeseInternalTerm,
00064                 LevelSetEquationTermBase );
00065 
00066   typedef typename Superclass::InputImageType     InputImageType;
00067   typedef typename Superclass::InputImagePointer  InputImagePointer;
00068   typedef typename Superclass::InputPixelType     InputPixelType;
00069   typedef typename Superclass::InputPixelRealType InputPixelRealType;
00070 
00071   typedef typename Superclass::LevelSetContainerType      LevelSetContainerType;
00072   typedef typename Superclass::LevelSetContainerPointer   LevelSetContainerPointer;
00073   typedef typename Superclass::LevelSetType               LevelSetType;
00074   typedef typename Superclass::LevelSetPointer            LevelSetPointer;
00075   typedef typename Superclass::LevelSetOutputPixelType    LevelSetOutputPixelType;
00076   typedef typename Superclass::LevelSetOutputRealType     LevelSetOutputRealType;
00077   typedef typename Superclass::LevelSetInputIndexType     LevelSetInputIndexType;
00078   typedef typename Superclass::LevelSetGradientType       LevelSetGradientType;
00079   typedef typename Superclass::LevelSetHessianType        LevelSetHessianType;
00080   typedef typename Superclass::LevelSetIdentifierType     LevelSetIdentifierType;
00081 
00082   typedef typename Superclass::HeavisideType              HeavisideType;
00083   typedef typename Superclass::HeavisideConstPointer      HeavisideConstPointer;
00084 
00085   typedef typename Superclass::LevelSetDataType LevelSetDataType;
00086 
00087   typedef typename Superclass::DomainMapImageFilterType   DomainMapImageFilterType;
00088   typedef typename Superclass::CacheImageType             CacheImageType;
00089 
00090   itkSetMacro( Mean, InputPixelRealType );
00091   itkGetMacro( Mean, InputPixelRealType );
00092 
00094   virtual void Update();
00095 
00097   virtual void InitializeParameters();
00098 
00100   virtual void Initialize( const LevelSetInputIndexType& iP );
00101 
00103   virtual void ComputeProduct( const LevelSetInputIndexType& iP,
00104                               LevelSetOutputRealType& prod );
00105 
00108   virtual void ComputeProductTerm( const LevelSetInputIndexType& ,
00109                                   LevelSetOutputRealType& )
00110   {}
00111 
00113   virtual void UpdatePixel( const LevelSetInputIndexType& iP,
00114                            const LevelSetOutputRealType & oldValue,
00115                            const LevelSetOutputRealType & newValue );
00116 
00117 protected:
00118   LevelSetEquationChanAndVeseInternalTerm();
00119 
00120   virtual ~LevelSetEquationChanAndVeseInternalTerm();
00121 
00124   virtual LevelSetOutputRealType Value( const LevelSetInputIndexType& iP );
00125 
00128   virtual LevelSetOutputRealType Value( const LevelSetInputIndexType& iP,
00129                                         const LevelSetDataType& iData );
00130 
00132   void Accumulate( const InputPixelType& iPix,
00133                    const LevelSetOutputRealType& iH );
00134 
00135   InputPixelRealType      m_Mean;
00136   InputPixelRealType      m_TotalValue;
00137   LevelSetOutputRealType  m_TotalH;
00138 
00139 private:
00140   LevelSetEquationChanAndVeseInternalTerm( const Self& ); // purposely not implemented
00141   void operator = ( const Self& ); // purposely not implemented
00142 };
00143 
00144 }
00145 #ifndef ITK_MANUAL_INSTANTIATION
00146 #include "itkLevelSetEquationChanAndVeseInternalTerm.hxx"
00147 #endif
00148 
00149 #endif
00150