ITK  5.2.0
Insight Toolkit
itkShapePriorMAPCostFunctionBase.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkShapePriorMAPCostFunctionBase_h
19 #define itkShapePriorMAPCostFunctionBase_h
20 
22 #include "itkLevelSet.h"
24 
25 namespace itk
26 {
47 template <typename TFeatureImage, typename TOutputPixel>
48 class ITK_TEMPLATE_EXPORT ShapePriorMAPCostFunctionBase : public SingleValuedCostFunction
49 {
50 public:
51  ITK_DISALLOW_COPY_AND_MOVE(ShapePriorMAPCostFunctionBase);
52 
58 
61 
64  using MeasureType = typename Superclass::MeasureType;
65 
68  using DerivativeType = typename Superclass::DerivativeType;
69 
72  using ParametersType = typename Superclass::ParametersType;
73 
75  using FeatureImageType = TFeatureImage;
76  using FeatureImagePointer = typename FeatureImageType::ConstPointer;
77 
79  static constexpr unsigned int ImageDimension = TFeatureImage::ImageDimension;
80 
82  using PixelType = TOutputPixel;
83 
86 
90 
94 
96  itkSetObjectMacro(ShapeFunction, ShapeFunctionType);
97  itkGetModifiableObjectMacro(ShapeFunction, ShapeFunctionType);
99 
101  itkSetConstObjectMacro(ActiveRegion, NodeContainerType);
102  itkGetConstObjectMacro(ActiveRegion, NodeContainerType);
104 
106  itkSetConstObjectMacro(FeatureImage, FeatureImageType);
107  itkGetConstObjectMacro(FeatureImage, FeatureImageType);
109 
113  GetValue(const ParametersType & parameters) const override;
114 
117  void
118  GetDerivative(const ParametersType &, DerivativeType &) const override
119  {
120  itkExceptionMacro(<< "This function is currently not supported.");
121  }
122 
124  unsigned int
125  GetNumberOfParameters() const override
126  {
127  return m_ShapeFunction->GetNumberOfParameters();
128  }
129 
132  virtual MeasureType
133  ComputeLogInsideTerm(const ParametersType &) const = 0;
134 
137  virtual MeasureType
138  ComputeLogGradientTerm(const ParametersType &) const = 0;
139 
142  virtual MeasureType
143  ComputeLogShapePriorTerm(const ParametersType &) const = 0;
144 
147  virtual MeasureType
148  ComputeLogPosePriorTerm(const ParametersType &) const = 0;
149 
152  virtual void
153  Initialize();
154 
155 protected:
157  ~ShapePriorMAPCostFunctionBase() override = default;
158 
159  void
160  PrintSelf(std::ostream & os, Indent indent) const override;
161 
164 
166 };
167 } // end namespace itk
168 
169 #ifndef ITK_MANUAL_INSTANTIATION
170 # include "itkShapePriorMAPCostFunctionBase.hxx"
171 #endif
172 
173 #endif
itk::ShapePriorMAPCostFunctionBase::m_ActiveRegion
NodeContainerPointer m_ActiveRegion
Definition: itkShapePriorMAPCostFunctionBase.h:163
itk::SingleValuedCostFunction::MeasureType
double MeasureType
Definition: itkSingleValuedCostFunction.h:50
itk::OptimizerParameters< TInternalComputationValueType >
itk::ShapePriorMAPCostFunctionBase::GetDerivative
void GetDerivative(const ParametersType &, DerivativeType &) const override
Definition: itkShapePriorMAPCostFunctionBase.h:118
itk::ShapePriorMAPCostFunctionBase::FeatureImagePointer
typename FeatureImageType::ConstPointer FeatureImagePointer
Definition: itkShapePriorMAPCostFunctionBase.h:76
itk::ShapePriorMAPCostFunctionBase::m_FeatureImage
FeatureImagePointer m_FeatureImage
Definition: itkShapePriorMAPCostFunctionBase.h:165
itkShapeSignedDistanceFunction.h
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::LevelSetNode
Represent a node in a level set.
Definition: itkLevelSetNode.h:45
itk::ShapePriorMAPCostFunctionBase::GetNumberOfParameters
unsigned int GetNumberOfParameters() const override
Definition: itkShapePriorMAPCostFunctionBase.h:125
itk::ShapePriorMAPCostFunctionBase::ShapeFunctionPointer
typename ShapeFunctionType::Pointer ShapeFunctionPointer
Definition: itkShapePriorMAPCostFunctionBase.h:93
itk::ShapePriorMAPCostFunctionBase::NodeContainerPointer
typename NodeContainerType::ConstPointer NodeContainerPointer
Definition: itkShapePriorMAPCostFunctionBase.h:89
itk::ShapePriorMAPCostFunctionBase::FeatureImageType
TFeatureImage FeatureImageType
Definition: itkShapePriorMAPCostFunctionBase.h:75
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::ShapeSignedDistanceFunction
Base class for functions which evaluates the signed distance from a shape.
Definition: itkShapeSignedDistanceFunction.h:53
itk::SingleValuedCostFunction
This class is a base for the CostFunctions returning a single value.
Definition: itkSingleValuedCostFunction.h:34
itk::ShapePriorMAPCostFunctionBase
Represents the base class of maximum aprior (MAP) cost function used ShapePriorSegmentationLevelSetIm...
Definition: itkShapePriorMAPCostFunctionBase.h:48
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itkLevelSet.h
itk::Array
Array class with size defined at construction time.
Definition: itkArray.h:47
itkSingleValuedCostFunction.h
itk::ShapePriorMAPCostFunctionBase::m_ShapeFunction
ShapeFunctionPointer m_ShapeFunction
Definition: itkShapePriorMAPCostFunctionBase.h:162
itk::VectorContainer
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.
Definition: itkVectorContainer.h:48
itk::ShapePriorMAPCostFunctionBase::PixelType
TOutputPixel PixelType
Definition: itkShapePriorMAPCostFunctionBase.h:82