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 __itkShapePriorMAPCostFunctionBase_h 00019 #define __itkShapePriorMAPCostFunctionBase_h 00020 00021 #include "itkSingleValuedCostFunction.h" 00022 #include "itkLevelSet.h" 00023 #include "itkShapeSignedDistanceFunction.h" 00024 00025 namespace itk 00026 { 00047 template< class TFeatureImage, class TOutputPixel > 00048 class ITK_EXPORT ShapePriorMAPCostFunctionBase: 00049 public SingleValuedCostFunction 00050 { 00051 public: 00053 typedef ShapePriorMAPCostFunctionBase Self; 00054 typedef SingleValuedCostFunction Superclass; 00055 typedef SmartPointer< Self > Pointer; 00056 typedef SmartPointer< const Self > ConstPointer; 00057 00059 itkTypeMacro(ShapePriorMAPCostFunctionBase, SingleValuedCostFunction); 00060 00063 typedef typename Superclass::MeasureType MeasureType; 00064 00067 typedef typename Superclass::DerivativeType DerivativeType; 00068 00071 typedef typename Superclass::ParametersType ParametersType; 00072 00074 typedef TFeatureImage FeatureImageType; 00075 typedef typename FeatureImageType::ConstPointer FeatureImagePointer; 00076 00078 itkStaticConstMacro(ImageDimension, unsigned int, TFeatureImage::ImageDimension); 00079 00081 typedef TOutputPixel PixelType; 00082 00084 typedef LevelSetNode< PixelType, itkGetStaticConstMacro(ImageDimension) > NodeType; 00085 00087 typedef VectorContainer< unsigned int, NodeType > NodeContainerType; 00088 typedef typename NodeContainerType::ConstPointer NodeContainerPointer; 00089 00091 typedef ShapeSignedDistanceFunction< double, 00092 itkGetStaticConstMacro(ImageDimension) > ShapeFunctionType; 00093 typedef typename ShapeFunctionType::Pointer ShapeFunctionPointer; 00094 00096 itkSetObjectMacro(ShapeFunction, ShapeFunctionType); 00097 itkGetObjectMacro(ShapeFunction, ShapeFunctionType); 00099 00101 itkSetConstObjectMacro(ActiveRegion, NodeContainerType); 00102 itkGetConstObjectMacro(ActiveRegion, NodeContainerType); 00104 00106 itkSetConstObjectMacro(FeatureImage, FeatureImageType); 00107 itkGetConstObjectMacro(FeatureImage, FeatureImageType); 00109 00112 virtual MeasureType GetValue(const ParametersType & parameters) const; 00113 00116 virtual void GetDerivative(const ParametersType &, DerivativeType &) const 00117 { itkExceptionMacro(<< "This function is currently not supported."); } 00118 00120 virtual unsigned int GetNumberOfParameters(void) const 00121 { return m_ShapeFunction->GetNumberOfParameters(); } 00122 00125 virtual MeasureType ComputeLogInsideTerm(const ParametersType &) const = 0; 00126 00129 virtual MeasureType ComputeLogGradientTerm(const ParametersType &) const = 0; 00130 00133 virtual MeasureType ComputeLogShapePriorTerm(const ParametersType &) const = 0; 00134 00137 virtual MeasureType ComputeLogPosePriorTerm(const ParametersType &) const = 0; 00138 00141 virtual void Initialize(void) 00142 throw ( ExceptionObject ); 00143 00144 protected: 00145 ShapePriorMAPCostFunctionBase(); 00146 virtual ~ShapePriorMAPCostFunctionBase() {} 00147 00148 void PrintSelf(std::ostream & os, Indent indent) const; 00149 00150 ShapeFunctionPointer m_ShapeFunction; 00151 NodeContainerPointer m_ActiveRegion; 00152 00153 FeatureImagePointer m_FeatureImage; 00154 private: 00155 ShapePriorMAPCostFunctionBase(const Self &); //purposely not implemented 00156 void operator=(const Self &); //purposely not implemented 00157 }; 00158 } // end namespace itk 00159 00160 #ifndef ITK_MANUAL_INSTANTIATION 00161 #include "itkShapePriorMAPCostFunctionBase.hxx" 00162 #endif 00163 00164 #endif 00165