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::FixedImageMaskType;
114 using typename Superclass::MovingImageMaskType;
116 using typename Superclass::MeasureType;
117 using typename Superclass::DerivativeType;
118 using typename Superclass::ParametersType;
119 using typename Superclass::FixedImagePixelType;
121 using typename Superclass::ImageSamplerType;
122 using typename Superclass::ImageSamplerPointer;
130
139
141 itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension);
142 itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension);
143
145 using MeasurementVectorType = Array<double>;
146 using MeasurementVectorValueType = typename MeasurementVectorType::ValueType;
148 using ListSamplePointer = typename ListSampleType::Pointer;
149
156
163
166
167 using typename Superclass::DerivativeValueType;
168 using TransformJacobianValueType = typename TransformJacobianType::ValueType;
169
176 void
177 SetANNkDTree(unsigned int bucketSize, std::string splittingRule);
178
180 void
181 SetANNkDTree(unsigned int bucketSize,
182 std::string splittingRuleFixed,
183 std::string splittingRuleMoving,
184 std::string splittingRuleJoint);
185
187 void
188 SetANNbdTree(unsigned int bucketSize, std::string splittingRule, std::string shrinkingRule);
189
191 void
192 SetANNbdTree(unsigned int bucketSize,
193 std::string splittingRuleFixed,
194 std::string splittingRuleMoving,
195 std::string splittingRuleJoint,
196 std::string shrinkingRuleFixed,
197 std::string shrinkingRuleMoving,
198 std::string shrinkingRuleJoint);
199
201 void
203
210 void
211 SetANNStandardTreeSearch(unsigned int kNearestNeighbors, double errorBound);
212
214 void
215 SetANNFixedRadiusTreeSearch(unsigned int kNearestNeighbors, double errorBound, double squaredRadius);
216
218 void
219 SetANNPriorityTreeSearch(unsigned int kNearestNeighbors, double errorBound);
220
226 void
227 Initialize() override;
228
230 void
231 GetDerivative(const TransformParametersType & parameters, DerivativeType & Derivative) const override;
232
234 MeasureType
235 GetValue(const TransformParametersType & parameters) const override;
236
238 void
239 GetValueAndDerivative(const TransformParametersType & parameters,
240 MeasureType & Value,
241 DerivativeType & Derivative) const override;
242
244 itkSetClampMacro(Alpha, double, 0.0, 1.0);
245
247 itkGetConstReferenceMacro(Alpha, double);
248
250 itkSetClampMacro(AvoidDivisionBy, double, 0.0, 1.0);
251
253 itkGetConstReferenceMacro(AvoidDivisionBy, double);
254
255protected:
258
261
263 void
264 PrintSelf(std::ostream & os, Indent indent) const override;
265
267 BinaryKNNTreePointer m_BinaryKNNTreeFixed{ nullptr };
268 BinaryKNNTreePointer m_BinaryKNNTreeMoving{ nullptr };
269 BinaryKNNTreePointer m_BinaryKNNTreeJoint{ nullptr };
270
271 BinaryKNNTreeSearchPointer m_BinaryKNNTreeSearcherFixed{ nullptr };
272 BinaryKNNTreeSearchPointer m_BinaryKNNTreeSearcherMoving{ nullptr };
273 BinaryKNNTreeSearchPointer m_BinaryKNNTreeSearcherJoint{ nullptr };
274
275 double m_Alpha{ 0.99 };
276 double m_AvoidDivisionBy{ 1e-10 };
277
278private:
280 using typename Superclass::FixedImagePointType;
281 using typename Superclass::MovingImagePointType;
282 using typename Superclass::MovingImageDerivativeType;
283 using typename Superclass::MovingImageContinuousIndexType;
284 using TransformJacobianContainerType = std::vector<TransformJacobianType>;
285 // typedef std::vector<ParameterIndexArrayType> TransformJacobianIndicesContainerType;
286 using TransformJacobianIndicesContainerType = std::vector<NonZeroJacobianIndicesType>;
287 using SpatialDerivativeType = vnl_matrix<double>;
288 using SpatialDerivativeContainerType = std::vector<SpatialDerivativeType>;
289
301 void
303 const ListSamplePointer & listSampleMoving,
304 const ListSamplePointer & listSampleJoint,
305 const bool doDerivative,
307 TransformJacobianIndicesContainerType & jacobiansIndices,
308 SpatialDerivativeContainerType & spatialDerivatives) const;
309
314 virtual void
316 SpatialDerivativeType & featureGradients) const;
317
322 virtual void
324 const SpatialDerivativeType & D2sparse_M,
325 const SpatialDerivativeType & D2sparse_J,
326 // const ParameterIndexArrayType & D1indices,
327 // const ParameterIndexArrayType & D2indices_M,
328 // const ParameterIndexArrayType & D2indices_J,
329 const NonZeroJacobianIndicesType & D1indices,
330 const NonZeroJacobianIndicesType & D2indices_M,
331 const NonZeroJacobianIndicesType & D2indices_J,
332 const MeasurementVectorType & diff_M,
333 const MeasurementVectorType & diff_J,
334 const MeasureType & distance_M,
335 const MeasureType & distance_J,
336 DerivativeType & dGamma_M,
337 DerivativeType & dGamma_J) const;
338};
339
340} // end namespace itk
341
342#ifndef ITK_MANUAL_INSTANTIATION
343# include "itkKNNGraphAlphaMutualInformationImageToImageMetric.hxx"
344#endif
345
346#endif // end #ifndef itkKNNGraphAlphaMutualInformationImageToImageMetric_h
typename ImageSamplerType::OutputVectorContainerPointer ImageSampleContainerPointer
typename MovingImageType::RegionType MovingImageRegionType
typename AdvancedTransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
typename FixedImageType::PixelType FixedImagePixelType
typename DerivativeType::ValueType DerivativeValueType
typename ImageSamplerType::OutputVectorContainerType ImageSampleContainerType
typename MovingImageLimiterType::OutputType MovingImageLimiterOutputType
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.
std::vector< MovingImageConstPointer > MovingImageVectorType
std::vector< FixedImageInterpolatorPointer > FixedImageInterpolatorVectorType
ImageMaskSpatialObject< Self::FixedImageDimension > FixedImageMaskType
std::vector< InterpolatorPointer > InterpolatorVectorType
std::vector< MovingImageMaskConstPointer > MovingImageMaskVectorType
SmartPointer< MovingImageMaskType > MovingImageMaskPointer
std::vector< FixedImageMaskConstPointer > FixedImageMaskVectorType
std::vector< FixedImageConstPointer > FixedImageVectorType
SmartPointer< FixedImageMaskType > FixedImageMaskPointer
std::vector< FixedImageRegionType > FixedImageRegionVectorType
ImageMaskSpatialObject< Self::MovingImageDimension > MovingImageMaskType
A ListSampleBase that internally uses a CArray, which can be accessed.


Generated on 2024-07-17 for elastix by doxygen 1.11.0 (9b424b03c9833626cd435af22a444888fbbb192d) elastix logo