go home Home | Main Page | Topics | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
Loading...
Searching...
No Matches
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{
72
73template <typename TFixedImage, typename 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::TransformJacobianType;
105 using typename Superclass::InterpolatorType;
106 using typename Superclass::InterpolatorPointer;
107 using typename Superclass::RealType;
108 using typename Superclass::GradientPixelType;
109 using typename Superclass::GradientImageType;
110 using typename Superclass::GradientImagePointer;
111 using typename Superclass::FixedImageMaskType;
113 using typename Superclass::MovingImageMaskType;
115 using typename Superclass::MeasureType;
116 using typename Superclass::DerivativeType;
117 using typename Superclass::ParametersType;
118 using typename Superclass::FixedImagePixelType;
120 using typename Superclass::ImageSamplerType;
121 using typename Superclass::ImageSamplerPointer;
129
138
140 itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension);
141 itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension);
142
144 using MeasurementVectorType = Array<double>;
145 using MeasurementVectorValueType = typename MeasurementVectorType::ValueType;
147 using ListSamplePointer = typename ListSampleType::Pointer;
148
155
162
165
166 using typename Superclass::DerivativeValueType;
167 using TransformJacobianValueType = typename TransformJacobianType::ValueType;
168
173
175 void
176 SetANNkDTree(unsigned int bucketSize, std::string splittingRule);
177
179 void
180 SetANNkDTree(unsigned int bucketSize,
181 std::string splittingRuleFixed,
182 std::string splittingRuleMoving,
183 std::string splittingRuleJoint);
184
186 void
187 SetANNbdTree(unsigned int bucketSize, std::string splittingRule, std::string shrinkingRule);
188
190 void
191 SetANNbdTree(unsigned int bucketSize,
192 std::string splittingRuleFixed,
193 std::string splittingRuleMoving,
194 std::string splittingRuleJoint,
195 std::string shrinkingRuleFixed,
196 std::string shrinkingRuleMoving,
197 std::string shrinkingRuleJoint);
198
200 void
202
207
209 void
210 SetANNStandardTreeSearch(unsigned int kNearestNeighbors, double errorBound);
211
213 void
214 SetANNFixedRadiusTreeSearch(unsigned int kNearestNeighbors, double errorBound, double squaredRadius);
215
217 void
218 SetANNPriorityTreeSearch(unsigned int kNearestNeighbors, double errorBound);
219
223
225 void
226 Initialize() override;
227
229 void
230 GetDerivative(const ParametersType & parameters, DerivativeType & Derivative) const override;
231
233 MeasureType
234 GetValue(const ParametersType & parameters) const override;
235
237 void
238 GetValueAndDerivative(const ParametersType & parameters,
239 MeasureType & Value,
240 DerivativeType & Derivative) const override;
241
243 itkSetClampMacro(Alpha, double, 0.0, 1.0);
244
246 itkGetConstReferenceMacro(Alpha, double);
247
249 itkSetClampMacro(AvoidDivisionBy, double, 0.0, 1.0);
250
252 itkGetConstReferenceMacro(AvoidDivisionBy, double);
253
254protected:
257
260
262 void
263 PrintSelf(std::ostream & os, Indent indent) const override;
264
269
273
274 double m_Alpha{ 0.99 };
275 double m_AvoidDivisionBy{ 1e-10 };
276
277private:
279 using typename Superclass::FixedImagePointType;
280 using typename Superclass::MovingImagePointType;
281 using typename Superclass::MovingImageDerivativeType;
282 using typename Superclass::MovingImageContinuousIndexType;
283 using TransformJacobianContainerType = std::vector<TransformJacobianType>;
284 // typedef std::vector<ParameterIndexArrayType> TransformJacobianIndicesContainerType;
285 using TransformJacobianIndicesContainerType = std::vector<NonZeroJacobianIndicesType>;
286 using SpatialDerivativeType = vnl_matrix<double>;
287 using SpatialDerivativeContainerType = std::vector<SpatialDerivativeType>;
288
300 void
302 const ListSamplePointer & listSampleMoving,
303 const ListSamplePointer & listSampleJoint,
304 const bool doDerivative,
306 TransformJacobianIndicesContainerType & jacobiansIndices,
307 SpatialDerivativeContainerType & spatialDerivatives) const;
308
313 virtual void
315 SpatialDerivativeType & featureGradients) const;
316
321 virtual void
323 const SpatialDerivativeType & D2sparse_M,
324 const SpatialDerivativeType & D2sparse_J,
325 // const ParameterIndexArrayType & D1indices,
326 // const ParameterIndexArrayType & D2indices_M,
327 // const ParameterIndexArrayType & D2indices_J,
328 const NonZeroJacobianIndicesType & D1indices,
329 const NonZeroJacobianIndicesType & D2indices_M,
330 const NonZeroJacobianIndicesType & D2indices_J,
331 const MeasurementVectorType & diff_M,
332 const MeasurementVectorType & diff_J,
333 const MeasureType & distance_M,
334 const MeasureType & distance_J,
335 DerivativeType & dGamma_M,
336 DerivativeType & dGamma_J) const;
337};
338
339} // end namespace itk
340
341#ifndef ITK_MANUAL_INSTANTIATION
342# include "itkKNNGraphAlphaMutualInformationImageToImageMetric.hxx"
343#endif
344
345#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
LimiterFunctionBase< RealType, FixedImageDimension > FixedImageLimiterType
ImageSamplerBase< FixedImageType > ImageSamplerType
LimiterFunctionBase< RealType, MovingImageDimension > MovingImageLimiterType
typename MovingImageLimiterType::OutputType MovingImageLimiterOutputType
typename FixedImageLimiterType::OutputType FixedImageLimiterOutputType
typename ImageSamplerType::Pointer ImageSamplerPointer
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 ParametersType &parameters, MeasureType &Value, DerivativeType &Derivative) const override
void SetANNFixedRadiusTreeSearch(unsigned int kNearestNeighbors, double errorBound, double squaredRadius)
itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension)
void GetDerivative(const ParametersType &parameters, DerivativeType &Derivative) const override
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)
itkOverrideGetNameOfClassMacro(KNNGraphAlphaMutualInformationImageToImageMetric)
MultiInputImageToImageMetricBase< typename MetricBase< TElastix >::FixedImageType, typename MetricBase< TElastix >::MovingImageType > Superclass
MeasureType GetValue(const ParametersType &parameters) const override
void ComputeListSampleValuesAndDerivativePlusJacobian(const ListSamplePointer &listSampleFixed, const ListSamplePointer &listSampleMoving, const ListSamplePointer &listSampleJoint, const bool doDerivative, TransformJacobianContainerType &jacobians, TransformJacobianIndicesContainerType &jacobiansIndices, SpatialDerivativeContainerType &spatialDerivatives) const
virtual void EvaluateMovingFeatureImageDerivatives(const MovingImagePointType &mappedPoint, SpatialDerivativeType &featureGradients) const
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 1774142652 for elastix by doxygen 1.15.0 elastix logo