go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkKNNGraphAlphaMutualInformationImageToImageMetric.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright UMC Utrecht and contributors
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 itkKNNGraphAlphaMutualInformationImageToImageMetric_h
19#define itkKNNGraphAlphaMutualInformationImageToImageMetric_h
20
23
25#include "itkArray.h"
26#include "itkListSampleCArray.h"
27#include "itkBinaryTreeBase.h"
29
31#include "itkANNkDTree.h"
32#include "itkANNbdTree.h"
34
39
41#include "itkArray2D.h"
42
43namespace itk
44{
73template <class TFixedImage, class TMovingImage>
75 : public MultiInputImageToImageMetricBase<TFixedImage, TMovingImage>
76{
77public:
79
83 using Pointer = SmartPointer<Self>;
84 using ConstPointer = SmartPointer<const Self>;
85
87 itkNewMacro(Self);
88
91
93 using typename Superclass::CoordinateRepresentationType;
94 using typename Superclass::MovingImageType;
95 using typename Superclass::MovingImagePixelType;
96 using typename Superclass::MovingImageConstPointer;
97 using typename Superclass::FixedImageType;
98 using typename Superclass::FixedImageConstPointer;
99 using typename Superclass::FixedImageRegionType;
100 using typename Superclass::TransformType;
101 using typename Superclass::TransformPointer;
102 using typename Superclass::InputPointType;
103 using typename Superclass::OutputPointType;
104 using typename Superclass::TransformParametersType;
105 using typename Superclass::TransformJacobianType;
106 using typename Superclass::InterpolatorType;
107 using typename Superclass::InterpolatorPointer;
108 using typename Superclass::RealType;
109 using typename Superclass::GradientPixelType;
110 using typename Superclass::GradientImageType;
111 using typename Superclass::GradientImagePointer;
112 using typename Superclass::GradientImageFilterType;
113 using typename Superclass::GradientImageFilterPointer;
114 using typename Superclass::FixedImageMaskType;
115 using typename Superclass::FixedImageMaskPointer;
116 using typename Superclass::MovingImageMaskType;
117 using typename Superclass::MovingImageMaskPointer;
118 using typename Superclass::MeasureType;
119 using typename Superclass::DerivativeType;
120 using typename Superclass::ParametersType;
121 using typename Superclass::FixedImagePixelType;
123 using typename Superclass::ImageSamplerType;
124 using typename Superclass::ImageSamplerPointer;
132
141
143 itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension);
144 itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension);
145
147 using MeasurementVectorType = Array<double>;
148 using MeasurementVectorValueType = typename MeasurementVectorType::ValueType;
150 using ListSamplePointer = typename ListSampleType::Pointer;
151
158
165
168
169 using DerivativeValueType = typename DerivativeType::ValueType;
170 using TransformJacobianValueType = typename TransformJacobianType::ValueType;
171
178 void
179 SetANNkDTree(unsigned int bucketSize, std::string splittingRule);
180
182 void
183 SetANNkDTree(unsigned int bucketSize,
184 std::string splittingRuleFixed,
185 std::string splittingRuleMoving,
186 std::string splittingRuleJoint);
187
189 void
190 SetANNbdTree(unsigned int bucketSize, std::string splittingRule, std::string shrinkingRule);
191
193 void
194 SetANNbdTree(unsigned int bucketSize,
195 std::string splittingRuleFixed,
196 std::string splittingRuleMoving,
197 std::string splittingRuleJoint,
198 std::string shrinkingRuleFixed,
199 std::string shrinkingRuleMoving,
200 std::string shrinkingRuleJoint);
201
203 void
205
212 void
213 SetANNStandardTreeSearch(unsigned int kNearestNeighbors, double errorBound);
214
216 void
217 SetANNFixedRadiusTreeSearch(unsigned int kNearestNeighbors, double errorBound, double squaredRadius);
218
220 void
221 SetANNPriorityTreeSearch(unsigned int kNearestNeighbors, double errorBound);
222
228 void
229 Initialize() override;
230
232 void
233 GetDerivative(const TransformParametersType & parameters, DerivativeType & Derivative) const override;
234
236 MeasureType
237 GetValue(const TransformParametersType & parameters) const override;
238
240 void
241 GetValueAndDerivative(const TransformParametersType & parameters,
242 MeasureType & Value,
243 DerivativeType & Derivative) const override;
244
246 itkSetClampMacro(Alpha, double, 0.0, 1.0);
247
249 itkGetConstReferenceMacro(Alpha, double);
250
252 itkSetClampMacro(AvoidDivisionBy, double, 0.0, 1.0);
253
255 itkGetConstReferenceMacro(AvoidDivisionBy, double);
256
257protected:
260
263
265 void
266 PrintSelf(std::ostream & os, Indent indent) const override;
267
272
276
277 double m_Alpha;
279
280private:
282 using typename Superclass::FixedImagePointType;
286 using TransformJacobianContainerType = std::vector<TransformJacobianType>;
287 // typedef std::vector<ParameterIndexArrayType> TransformJacobianIndicesContainerType;
288 using TransformJacobianIndicesContainerType = std::vector<NonZeroJacobianIndicesType>;
289 using SpatialDerivativeType = Array2D<double>;
290 using SpatialDerivativeContainerType = std::vector<SpatialDerivativeType>;
291
303 void
305 const ListSamplePointer & listSampleMoving,
306 const ListSamplePointer & listSampleJoint,
307 const bool doDerivative,
309 TransformJacobianIndicesContainerType & jacobiansIndices,
310 SpatialDerivativeContainerType & spatialDerivatives) const;
311
316 virtual void
318 SpatialDerivativeType & featureGradients) const;
319
324 virtual void
326 const SpatialDerivativeType & D2sparse_M,
327 const SpatialDerivativeType & D2sparse_J,
328 // const ParameterIndexArrayType & D1indices,
329 // const ParameterIndexArrayType & D2indices_M,
330 // const ParameterIndexArrayType & D2indices_J,
331 const NonZeroJacobianIndicesType & D1indices,
332 const NonZeroJacobianIndicesType & D2indices_M,
333 const NonZeroJacobianIndicesType & D2indices_J,
334 const MeasurementVectorType & diff_M,
335 const MeasurementVectorType & diff_J,
336 const MeasureType & distance_M,
337 const MeasureType & distance_J,
338 DerivativeType & dGamma_M,
339 DerivativeType & dGamma_J) const;
340};
341
342} // end namespace itk
343
344#ifndef ITK_MANUAL_INSTANTIATION
345# include "itkKNNGraphAlphaMutualInformationImageToImageMetric.hxx"
346#endif
347
348#endif // end #ifndef itkKNNGraphAlphaMutualInformationImageToImageMetric_h
typename ImageSamplerType::OutputVectorContainerPointer ImageSampleContainerPointer
typename MovingImageType::RegionType MovingImageRegionType
typename AdvancedTransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
typename FixedImageType::PixelType FixedImagePixelType
typename ImageSamplerType::OutputVectorContainerType ImageSampleContainerType
typename MovingImageLimiterType::OutputType MovingImageLimiterOutputType
typename TransformType::InputPointType FixedImagePointType
typename FixedImageLimiterType::OutputType FixedImageLimiterOutputType
typename ImageSamplerType::Pointer ImageSamplerPointer
SmartPointer< Self > Pointer
This class is a base class for any image sampler.
ITK_DISALLOW_COPY_AND_MOVE(KNNGraphAlphaMutualInformationImageToImageMetric)
void SetANNPriorityTreeSearch(unsigned int kNearestNeighbors, double errorBound)
void SetANNbdTree(unsigned int bucketSize, std::string splittingRuleFixed, std::string splittingRuleMoving, std::string splittingRuleJoint, std::string shrinkingRuleFixed, std::string shrinkingRuleMoving, std::string shrinkingRuleJoint)
virtual void UpdateDerivativeOfGammas(const SpatialDerivativeType &D1sparse, const SpatialDerivativeType &D2sparse_M, const SpatialDerivativeType &D2sparse_J, const NonZeroJacobianIndicesType &D1indices, const NonZeroJacobianIndicesType &D2indices_M, const NonZeroJacobianIndicesType &D2indices_J, const MeasurementVectorType &diff_M, const MeasurementVectorType &diff_J, const MeasureType &distance_M, const MeasureType &distance_J, DerivativeType &dGamma_M, DerivativeType &dGamma_J) const
void SetANNkDTree(unsigned int bucketSize, std::string splittingRule)
void SetANNbdTree(unsigned int bucketSize, std::string splittingRule, std::string shrinkingRule)
void PrintSelf(std::ostream &os, Indent indent) const override
void GetValueAndDerivative(const TransformParametersType &parameters, MeasureType &Value, DerivativeType &Derivative) const override
void GetDerivative(const TransformParametersType &parameters, DerivativeType &Derivative) const override
void SetANNFixedRadiusTreeSearch(unsigned int kNearestNeighbors, double errorBound, double squaredRadius)
itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension)
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
void SetANNkDTree(unsigned int bucketSize, std::string splittingRuleFixed, std::string splittingRuleMoving, std::string splittingRuleJoint)
void SetANNStandardTreeSearch(unsigned int kNearestNeighbors, double errorBound)
typename Statistics::ListSampleCArray< MeasurementVectorType, double > ListSampleType
void ComputeListSampleValuesAndDerivativePlusJacobian(const ListSamplePointer &listSampleFixed, const ListSamplePointer &listSampleMoving, const ListSamplePointer &listSampleJoint, const bool doDerivative, TransformJacobianContainerType &jacobians, TransformJacobianIndicesContainerType &jacobiansIndices, SpatialDerivativeContainerType &spatialDerivatives) const
MeasureType GetValue(const TransformParametersType &parameters) const override
virtual void EvaluateMovingFeatureImageDerivatives(const MovingImagePointType &mappedPoint, SpatialDerivativeType &featureGradients) const
Base class for all ITK limiter function objects.
Implements a metric base class that takes multiple inputs.
typename TransformType::OutputPointType MovingImagePointType
std::vector< MovingImageConstPointer > MovingImageVectorType
std::vector< FixedImageInterpolatorPointer > FixedImageInterpolatorVectorType
std::vector< InterpolatorPointer > InterpolatorVectorType
std::vector< MovingImageMaskPointer > MovingImageMaskVectorType
typename BSplineInterpolatorType::CovariantVectorType MovingImageDerivativeType
std::vector< FixedImageConstPointer > FixedImageVectorType
std::vector< FixedImageMaskPointer > FixedImageMaskVectorType
std::vector< FixedImageRegionType > FixedImageRegionVectorType
typename InterpolatorType::ContinuousIndexType MovingImageContinuousIndexType
A ListSampleBase that internally uses a CArray, which can be accessed.


Generated on 2023-01-13 for elastix by doxygen 1.9.6 elastix logo