ITK  5.4.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  * https://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 
60  itkOverrideGetNameOfClassMacro(ShapePriorMAPCostFunctionBase);
61 
64  using typename Superclass::MeasureType;
65 
68  using typename Superclass::DerivativeType;
69 
72  using typename Superclass::ParametersType;
73 
75  using FeatureImageType = TFeatureImage;
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);
101  itkSetConstObjectMacro(ActiveRegion, NodeContainerType);
102  itkGetConstObjectMacro(ActiveRegion, NodeContainerType);
106  itkSetConstObjectMacro(FeatureImage, FeatureImageType);
107  itkGetConstObjectMacro(FeatureImage, FeatureImageType);
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 
162  ShapeFunctionPointer m_ShapeFunction{};
163  NodeContainerPointer m_ActiveRegion{};
164 
165  FeatureImagePointer m_FeatureImage{};
166 };
167 } // end namespace itk
168 
169 #ifndef ITK_MANUAL_INSTANTIATION
170 # include "itkShapePriorMAPCostFunctionBase.hxx"
171 #endif
172 
173 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
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
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
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:55
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::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