File: itkAdvancedCombinationTransform.h

package info (click to toggle)
elastix 5.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 42,480 kB
  • sloc: cpp: 68,403; lisp: 4,118; python: 1,013; xml: 182; sh: 177; makefile: 33
file content (633 lines) | stat: -rw-r--r-- 28,467 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
/*=========================================================================
 *
 *  Copyright UMC Utrecht and contributors
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0.txt
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 *=========================================================================*/
#ifndef itkAdvancedCombinationTransform_h
#define itkAdvancedCombinationTransform_h

#include "itkAdvancedTransform.h"
#include "itkMacro.h"

namespace itk
{

/**
 * \class AdvancedCombinationTransform
 *
 * \brief This class combines two transforms: an 'initial transform'
 * with a 'current transform'.
 *
 * The CombinationTransform class combines an initial transform \f$T_0\f$ with a
 * current transform \f$T_1\f$.
 *
 * Two methods of combining the transforms are supported:
 * \li Addition: \f$T(x) = T_0(x) + T_1(x)\f$
 * \li Composition: \f$T(x) = T_1( T_0(x) )\f$
 *
 * The TransformPoint(), the GetJacobian() and the GetInverse() methods
 * depend on this setting.
 *
 * If the transform is used in a registration framework,
 * the initial transform is assumed constant, and the current
 * transform is assumed to be the transform that is optimised.
 * So, the transform parameters of the CombinationTransform are the
 * parameters of the CurrentTransform \f$T_1\f$.
 *
 * Note: It is mandatory to set a current transform. An initial transform
 * is not mandatory.
 *
 * \ingroup Transforms
 */

template <typename TScalarType, unsigned int NDimensions = 3>
class ITK_TEMPLATE_EXPORT AdvancedCombinationTransform : public AdvancedTransform<TScalarType, NDimensions, NDimensions>
{
public:
  ITK_DISALLOW_COPY_AND_MOVE(AdvancedCombinationTransform);

  /** Standard itk. */
  using Self = AdvancedCombinationTransform;
  using Superclass = AdvancedTransform<TScalarType, NDimensions, NDimensions>;
  using Pointer = SmartPointer<Self>;
  using ConstPointer = SmartPointer<const Self>;

  /** New method for creating an object using a factory. */
  itkNewMacro(Self);

  /** ITK Type info. */
  itkTypeMacro(AdvancedCombinationTransform, AdvancedTransform);

  /** Input and Output space dimension. */
  itkStaticConstMacro(SpaceDimension, unsigned int, NDimensions);

  /** Typedefs inherited from Superclass.*/
  using typename Superclass::ScalarType;
  using typename Superclass::ParametersType;
  using typename Superclass::FixedParametersType;
  using typename Superclass::ParametersValueType;
  using typename Superclass::NumberOfParametersType;
  using typename Superclass::DerivativeType;
  using typename Superclass::JacobianType;
  using typename Superclass::InputVectorType;
  using typename Superclass::OutputVectorType;
  using typename Superclass::InputCovariantVectorType;
  using typename Superclass::OutputCovariantVectorType;
  using typename Superclass::InputVnlVectorType;
  using typename Superclass::OutputVnlVectorType;
  using typename Superclass::InputPointType;
  using typename Superclass::OutputPointType;
  using typename Superclass::NonZeroJacobianIndicesType;
  using typename Superclass::SpatialJacobianType;
  using typename Superclass::JacobianOfSpatialJacobianType;
  using typename Superclass::SpatialHessianType;
  using typename Superclass::JacobianOfSpatialHessianType;
  using typename Superclass::InternalMatrixType;
  using InverseTransformBaseType = typename Superclass::InverseTransformBaseType;
  using typename Superclass::InverseTransformBasePointer;
  using typename Superclass::TransformCategoryEnum;
  using typename Superclass::MovingImageGradientType;
  using typename Superclass::MovingImageGradientValueType;

  /** Transform typedefs for the from Superclass. */
  using TransformType = typename Superclass::TransformType;
  using TransformTypePointer = typename TransformType::Pointer;
  using TransformTypeConstPointer = typename TransformType::ConstPointer;

  /** Typedefs for the InitialTransform. */
  using InitialTransformType = Superclass;
  using InitialTransformPointer = typename InitialTransformType::Pointer;
  using InitialTransformConstPointer = typename InitialTransformType::ConstPointer;
  using InitialTransformInverseTransformBaseType = typename InitialTransformType::InverseTransformBaseType;
  using InitialTransformInverseTransformBasePointer = typename InitialTransformType::InverseTransformBasePointer;

  /** Typedefs for the CurrentTransform. */
  using CurrentTransformType = Superclass;
  using CurrentTransformPointer = typename CurrentTransformType::Pointer;
  using CurrentTransformConstPointer = typename CurrentTransformType::ConstPointer;
  using CurrentTransformInverseTransformBaseType = typename CurrentTransformType::InverseTransformBaseType;
  using CurrentTransformInverseTransformBasePointer = typename CurrentTransformType::InverseTransformBasePointer;

  /** Set/Get a pointer to the InitialTransform. */
  void
  SetInitialTransform(InitialTransformType * _arg);

  itkGetModifiableObjectMacro(InitialTransform, InitialTransformType);

  /** Set/Get a pointer to the CurrentTransform.
   * Make sure to set the CurrentTransform before calling functions like
   * TransformPoint(), GetJacobian(), SetParameters() etc.
   */
  void
  SetCurrentTransform(CurrentTransformType * _arg);

  itkGetModifiableObjectMacro(CurrentTransform, CurrentTransformType);

  /** Return the number of sub-transforms. */
  SizeValueType
  GetNumberOfTransforms() const;

  /** Get the Nth current transform.
   * Exact interface to the ITK4 MultiTransform::GetNthTransform( SizeValueType n )
   * \warning The bounds checking is performed.
   */
  const TransformTypePointer
  GetNthTransform(SizeValueType n) const;

  /** Control the way transforms are combined. */
  void
  SetUseComposition(bool _arg);

  itkGetConstMacro(UseComposition, bool);

  /** Control the way transforms are combined. */
  void
  SetUseAddition(bool _arg);

  itkGetConstMacro(UseAddition, bool);

  /**  Method to transform a point. */
  OutputPointType
  TransformPoint(const InputPointType & point) const override;

  /** ITK4 change:
   * The following pure virtual functions must be overloaded.
   * For now just throw an exception, since these are not used in elastix.
   */
  OutputVectorType
  TransformVector(const InputVectorType &) const override
  {
    itkExceptionMacro("TransformVector(const InputVectorType &) is not implemented for AdvancedCombinationTransform");
  }


  OutputVnlVectorType
  TransformVector(const InputVnlVectorType &) const override
  {
    itkExceptionMacro(
      "TransformVector(const InputVnlVectorType &) is not implemented for AdvancedCombinationTransform");
  }


  OutputCovariantVectorType
  TransformCovariantVector(const InputCovariantVectorType &) const override
  {
    itkExceptionMacro("TransformCovariantVector(const InputCovariantVectorType &) is not implemented for "
                      "AdvancedCombinationTransform");
  }


  /** Return the number of parameters that completely define the CurrentTransform. */
  NumberOfParametersType
  GetNumberOfParameters() const override;

  /** Get the number of nonzero Jacobian indices. By default all. */
  NumberOfParametersType
  GetNumberOfNonZeroJacobianIndices() const override;

  /** Get the transformation parameters from the CurrentTransform. */
  const ParametersType &
  GetParameters() const override;

  /** Get the fixed parameters from the CurrentTransform. */
  const FixedParametersType &
  GetFixedParameters() const override;

  /** Set the transformation parameters in the CurrentTransform. */
  void
  SetParameters(const ParametersType & param) override;

  /** Set the transformation parameters in the CurrentTransform.
   * This method forces the transform to copy the parameters.
   */
  void
  SetParametersByValue(const ParametersType & param) override;

  /** Set the fixed parameters in the CurrentTransform. */
  void
  SetFixedParameters(const FixedParametersType & fixedParam) override;

  /** Return the inverse \f$T^{-1}\f$ of the transform.
   *  This is only possible when:
   * - both the inverses of the initial and the current transform
   *   are defined, and Composition is used:
   *   \f$T^{-1}(y) = T_0^{-1} ( T_1^{-1}(y) )\f$
   * - No initial transform is used and the current transform is defined.
   * In all other cases this function returns false and does not provide
   * an inverse transform. An exception is thrown when no CurrentTransform
   * is set.
   */
  bool
  GetInverse(Self * inverse) const;

  /** Return whether the transform is linear (or actually: affine)
   * Returns true when both initial and current transform are linear */
  bool
  IsLinear() const override;

  /** Special handling for combination transform. If all transforms
   * are linear, then return category Linear. Otherwise if all
   * transforms set to optimize are DisplacementFields, then
   * return DisplacementField category. */
  TransformCategoryEnum
  GetTransformCategory() const override;

  /** Whether the advanced transform has nonzero matrices. */
  bool
  GetHasNonZeroSpatialHessian() const override;

  bool
  HasNonZeroJacobianOfSpatialHessian() const;

  /** Compute the (sparse) Jacobian of the transformation. */
  void
  GetJacobian(const InputPointType &       inputPoint,
              JacobianType &               j,
              NonZeroJacobianIndicesType & nonZeroJacobianIndices) const override;

  /** Compute the inner product of the Jacobian with the moving image gradient. */
  void
  EvaluateJacobianWithImageGradientProduct(const InputPointType &          inputPoint,
                                           const MovingImageGradientType & movingImageGradient,
                                           DerivativeType &                imageJacobian,
                                           NonZeroJacobianIndicesType &    nonZeroJacobianIndices) const override;

  /** Compute the spatial Jacobian of the transformation. */
  void
  GetSpatialJacobian(const InputPointType & inputPoint, SpatialJacobianType & sj) const override;

  /** Compute the spatial Hessian of the transformation. */
  void
  GetSpatialHessian(const InputPointType & inputPoint, SpatialHessianType & sh) const override;

  /** Compute the Jacobian of the spatial Jacobian of the transformation. */
  void
  GetJacobianOfSpatialJacobian(const InputPointType &          inputPoint,
                               JacobianOfSpatialJacobianType & jsj,
                               NonZeroJacobianIndicesType &    nonZeroJacobianIndices) const override;

  /** Compute both the spatial Jacobian and the Jacobian of the
   * spatial Jacobian of the transformation.
   */
  void
  GetJacobianOfSpatialJacobian(const InputPointType &          inputPoint,
                               SpatialJacobianType &           sj,
                               JacobianOfSpatialJacobianType & jsj,
                               NonZeroJacobianIndicesType &    nonZeroJacobianIndices) const override;

  /** Compute the Jacobian of the spatial Hessian of the transformation. */
  void
  GetJacobianOfSpatialHessian(const InputPointType &         inputPoint,
                              JacobianOfSpatialHessianType & jsh,
                              NonZeroJacobianIndicesType &   nonZeroJacobianIndices) const override;

  /** Compute both the spatial Hessian and the Jacobian of the
   * spatial Hessian of the transformation.
   */
  void
  GetJacobianOfSpatialHessian(const InputPointType &         inputPoint,
                              SpatialHessianType &           sh,
                              JacobianOfSpatialHessianType & jsh,
                              NonZeroJacobianIndicesType &   nonZeroJacobianIndices) const override;

protected:
  /** Constructor. */
  AdvancedCombinationTransform();

  /** Destructor. */
  ~AdvancedCombinationTransform() override = default;

  /** Set the SelectedTransformPointFunction and the
   * SelectedGetJacobianFunction.
   */
  void
  UpdateCombinationMethod();

  /** ************************************************
   * Methods to transform a point.
   */

  /** ADDITION: \f$T(x) = T_0(x) + T_1(x) - x\f$ */
  OutputPointType
  TransformPointUseAddition(const InputPointType & point) const;

  /** COMPOSITION: \f$T(x) = T_1( T_0(x) )\f$
   * \warning: assumes that input and output point type are the same.
   */
  OutputPointType
  TransformPointUseComposition(const InputPointType & point) const;

  /** CURRENT ONLY: \f$T(x) = T_1(x)\f$ */
  OutputPointType
  TransformPointNoInitialTransform(const InputPointType & point) const;

  /** NO CURRENT TRANSFORM SET: throw an exception. */
  OutputPointType
  TransformPointNoCurrentTransform(const InputPointType & point) const;

  /** ************************************************
   * Methods to compute the sparse Jacobian.
   */

  /** ADDITION: \f$J(x) = J_1(x)\f$ */
  void
  GetJacobianUseAddition(const InputPointType &, JacobianType &, NonZeroJacobianIndicesType &) const;

  /** COMPOSITION: \f$J(x) = J_1( T_0(x) )\f$
   * \warning: assumes that input and output point type are the same.
   */
  void
  GetJacobianUseComposition(const InputPointType &, JacobianType &, NonZeroJacobianIndicesType &) const;

  /** CURRENT ONLY: \f$J(x) = J_1(x)\f$ */
  void
  GetJacobianNoInitialTransform(const InputPointType &, JacobianType &, NonZeroJacobianIndicesType &) const;

  /** NO CURRENT TRANSFORM SET: throw an exception. */
  void
  GetJacobianNoCurrentTransform(const InputPointType &, JacobianType &, NonZeroJacobianIndicesType &) const;

  /** ************************************************
   * Methods to compute the inner product of the Jacobian with the moving image gradient.
   */

  /** ADDITION: \f$J(x) = J_1(x)\f$ */
  void
  EvaluateJacobianWithImageGradientProductUseAddition(const InputPointType &,
                                                      const MovingImageGradientType &,
                                                      DerivativeType &,
                                                      NonZeroJacobianIndicesType &) const;

  /** COMPOSITION: \f$J(x) = J_1( T_0(x) )\f$
   * \warning: assumes that input and output point type are the same.
   */
  void
  EvaluateJacobianWithImageGradientProductUseComposition(const InputPointType &,
                                                         const MovingImageGradientType &,
                                                         DerivativeType &,
                                                         NonZeroJacobianIndicesType &) const;

  /** CURRENT ONLY: \f$J(x) = J_1(x)\f$ */
  void
  EvaluateJacobianWithImageGradientProductNoInitialTransform(const InputPointType &,
                                                             const MovingImageGradientType &,
                                                             DerivativeType &,
                                                             NonZeroJacobianIndicesType &) const;

  /** NO CURRENT TRANSFORM SET: throw an exception. */
  void
  EvaluateJacobianWithImageGradientProductNoCurrentTransform(const InputPointType &,
                                                             const MovingImageGradientType &,
                                                             DerivativeType &,
                                                             NonZeroJacobianIndicesType &) const;

  /** ************************************************
   * Methods to compute the spatial Jacobian.
   */

  /** ADDITION: \f$J(x) = J_1(x)\f$ */
  void
  GetSpatialJacobianUseAddition(const InputPointType & inputPoint, SpatialJacobianType & sj) const;

  /** COMPOSITION: \f$J(x) = J_1( T_0(x) )\f$
   * \warning: assumes that input and output point type are the same.
   */
  void
  GetSpatialJacobianUseComposition(const InputPointType & inputPoint, SpatialJacobianType & sj) const;

  /** CURRENT ONLY: \f$J(x) = J_1(x)\f$ */
  void
  GetSpatialJacobianNoInitialTransform(const InputPointType & inputPoint, SpatialJacobianType & sj) const;

  /** NO CURRENT TRANSFORM SET: throw an exception. */
  void
  GetSpatialJacobianNoCurrentTransform(const InputPointType & inputPoint, SpatialJacobianType & sj) const;

  /** ************************************************
   * Methods to compute the spatial Hessian.
   */

  /** ADDITION: \f$J(x) = J_1(x)\f$ */
  void
  GetSpatialHessianUseAddition(const InputPointType & inputPoint, SpatialHessianType & sh) const;

  /** COMPOSITION: \f$J(x) = J_1( T_0(x) )\f$
   * \warning: assumes that input and output point type are the same.
   */
  void
  GetSpatialHessianUseComposition(const InputPointType & inputPoint, SpatialHessianType & sh) const;

  /** CURRENT ONLY: \f$J(x) = J_1(x)\f$ */
  void
  GetSpatialHessianNoInitialTransform(const InputPointType & inputPoint, SpatialHessianType & sh) const;

  /** NO CURRENT TRANSFORM SET: throw an exception. */
  void
  GetSpatialHessianNoCurrentTransform(const InputPointType & inputPoint, SpatialHessianType & sh) const;

  /** ************************************************
   * Methods to compute the Jacobian of the spatial Jacobian.
   */

  /** ADDITION: \f$J(x) = J_1(x)\f$ */
  void
  GetJacobianOfSpatialJacobianUseAddition(const InputPointType &          inputPoint,
                                          JacobianOfSpatialJacobianType & jsj,
                                          NonZeroJacobianIndicesType &    nonZeroJacobianIndices) const;

  void
  GetJacobianOfSpatialJacobianUseAddition(const InputPointType &          inputPoint,
                                          SpatialJacobianType &           sj,
                                          JacobianOfSpatialJacobianType & jsj,
                                          NonZeroJacobianIndicesType &    nonZeroJacobianIndices) const;

  /** COMPOSITION: \f$J(x) = J_1( T_0(x) )\f$
   * \warning: assumes that input and output point type are the same.
   */
  void
  GetJacobianOfSpatialJacobianUseComposition(const InputPointType &          inputPoint,
                                             JacobianOfSpatialJacobianType & jsj,
                                             NonZeroJacobianIndicesType &    nonZeroJacobianIndices) const;

  void
  GetJacobianOfSpatialJacobianUseComposition(const InputPointType &          inputPoint,
                                             SpatialJacobianType &           sj,
                                             JacobianOfSpatialJacobianType & jsj,
                                             NonZeroJacobianIndicesType &    nonZeroJacobianIndices) const;

  /** CURRENT ONLY: \f$J(x) = J_1(x)\f$ */
  void
  GetJacobianOfSpatialJacobianNoInitialTransform(const InputPointType &          inputPoint,
                                                 JacobianOfSpatialJacobianType & jsj,
                                                 NonZeroJacobianIndicesType &    nonZeroJacobianIndices) const;

  void
  GetJacobianOfSpatialJacobianNoInitialTransform(const InputPointType &          inputPoint,
                                                 SpatialJacobianType &           sj,
                                                 JacobianOfSpatialJacobianType & jsj,
                                                 NonZeroJacobianIndicesType &    nonZeroJacobianIndices) const;

  /** NO CURRENT TRANSFORM SET: throw an exception. */
  void
  GetJacobianOfSpatialJacobianNoCurrentTransform(const InputPointType &          inputPoint,
                                                 JacobianOfSpatialJacobianType & jsj,
                                                 NonZeroJacobianIndicesType &    nonZeroJacobianIndices) const;

  void
  GetJacobianOfSpatialJacobianNoCurrentTransform(const InputPointType &          inputPoint,
                                                 SpatialJacobianType &           sj,
                                                 JacobianOfSpatialJacobianType & jsj,
                                                 NonZeroJacobianIndicesType &    nonZeroJacobianIndices) const;

  /** ************************************************
   * Methods to compute the Jacobian of the spatial Hessian.
   */

  /** ADDITION: \f$J(x) = J_1(x)\f$ */
  void
  GetJacobianOfSpatialHessianUseAddition(const InputPointType &         inputPoint,
                                         JacobianOfSpatialHessianType & jsh,
                                         NonZeroJacobianIndicesType &   nonZeroJacobianIndices) const;

  void
  GetJacobianOfSpatialHessianUseAddition(const InputPointType &         inputPoint,
                                         SpatialHessianType &           sh,
                                         JacobianOfSpatialHessianType & jsh,
                                         NonZeroJacobianIndicesType &   nonZeroJacobianIndices) const;

  /** COMPOSITION: \f$J(x) = J_1( T_0(x) )\f$
   * \warning: assumes that input and output point type are the same.
   */
  void
  GetJacobianOfSpatialHessianUseComposition(const InputPointType &         inputPoint,
                                            JacobianOfSpatialHessianType & jsh,
                                            NonZeroJacobianIndicesType &   nonZeroJacobianIndices) const;

  void
  GetJacobianOfSpatialHessianUseComposition(const InputPointType &         inputPoint,
                                            SpatialHessianType &           sh,
                                            JacobianOfSpatialHessianType & jsh,
                                            NonZeroJacobianIndicesType &   nonZeroJacobianIndices) const;

  /** CURRENT ONLY: \f$J(x) = J_1(x)\f$ */
  void
  GetJacobianOfSpatialHessianNoInitialTransform(const InputPointType &         inputPoint,
                                                JacobianOfSpatialHessianType & jsh,
                                                NonZeroJacobianIndicesType &   nonZeroJacobianIndices) const;

  void
  GetJacobianOfSpatialHessianNoInitialTransform(const InputPointType &         inputPoint,
                                                SpatialHessianType &           sh,
                                                JacobianOfSpatialHessianType & jsh,
                                                NonZeroJacobianIndicesType &   nonZeroJacobianIndices) const;

  /** NO CURRENT TRANSFORM SET: throw an exception. */
  void
  GetJacobianOfSpatialHessianNoCurrentTransform(const InputPointType &         inputPoint,
                                                JacobianOfSpatialHessianType & jsh,
                                                NonZeroJacobianIndicesType &   nonZeroJacobianIndices) const;

  void
  GetJacobianOfSpatialHessianNoCurrentTransform(const InputPointType &         inputPoint,
                                                SpatialHessianType &           sh,
                                                JacobianOfSpatialHessianType & jsh,
                                                NonZeroJacobianIndicesType &   nonZeroJacobianIndices) const;

private:
  // Private using-declarations, to avoid `-Woverloaded-virtual` warnings from GCC (GCC 11.4).
  using Superclass::TransformCovariantVector;
  using Superclass::TransformVector;

  /** Exception text. */
  static constexpr const char * NoCurrentTransformSet = "No current transform set in the AdvancedCombinationTransform";

  /** Declaration of members. */
  InitialTransformPointer m_InitialTransform{ nullptr };
  CurrentTransformPointer m_CurrentTransform{ nullptr };

  /** Typedefs for function pointers. */
  using TransformPointFunctionPointer = OutputPointType (Self::*)(const InputPointType &) const;
  using GetSparseJacobianFunctionPointer = void (Self::*)(const InputPointType &,
                                                          JacobianType &,
                                                          NonZeroJacobianIndicesType &) const;
  using EvaluateJacobianWithImageGradientProductFunctionPointer = void (Self::*)(const InputPointType &,
                                                                                 const MovingImageGradientType &,
                                                                                 DerivativeType &,
                                                                                 NonZeroJacobianIndicesType &) const;
  using GetSpatialJacobianFunctionPointer = void (Self::*)(const InputPointType &, SpatialJacobianType &) const;
  using GetSpatialHessianFunctionPointer = void (Self::*)(const InputPointType &, SpatialHessianType &) const;
  using GetJacobianOfSpatialJacobianFunctionPointer = void (Self::*)(const InputPointType &,
                                                                     JacobianOfSpatialJacobianType &,
                                                                     NonZeroJacobianIndicesType &) const;
  using GetJacobianOfSpatialJacobianFunctionPointer2 = void (Self::*)(const InputPointType &,
                                                                      SpatialJacobianType &,
                                                                      JacobianOfSpatialJacobianType &,
                                                                      NonZeroJacobianIndicesType &) const;
  using GetJacobianOfSpatialHessianFunctionPointer = void (Self::*)(const InputPointType &,
                                                                    JacobianOfSpatialHessianType &,
                                                                    NonZeroJacobianIndicesType &) const;
  using GetJacobianOfSpatialHessianFunctionPointer2 = void (Self::*)(const InputPointType &,
                                                                     SpatialHessianType &,
                                                                     JacobianOfSpatialHessianType &,
                                                                     NonZeroJacobianIndicesType &) const;

  /**  A pointer to one of the following functions:
   * - TransformPointUseAddition,
   * - TransformPointUseComposition,
   * - TransformPointNoCurrentTransform
   * - TransformPointNoInitialTransform.
   */
  TransformPointFunctionPointer m_SelectedTransformPointFunction{ &Self::TransformPointNoCurrentTransform };

  /**  A pointer to one of the following functions:
   * - GetJacobianUseAddition,
   * - GetJacobianUseComposition,
   * - GetJacobianNoCurrentTransform
   * - GetJacobianNoInitialTransform.
   */
  // GetJacobianFunctionPointer m_SelectedGetJacobianFunction;

  /** More of these. Set everything to have no current transform. */
  GetSparseJacobianFunctionPointer m_SelectedGetSparseJacobianFunction{ &Self::GetJacobianNoCurrentTransform };
  EvaluateJacobianWithImageGradientProductFunctionPointer m_SelectedEvaluateJacobianWithImageGradientProductFunction{
    &Self::EvaluateJacobianWithImageGradientProductNoInitialTransform
  };
  GetSpatialJacobianFunctionPointer m_SelectedGetSpatialJacobianFunction{ &Self::GetSpatialJacobianNoCurrentTransform };
  GetSpatialHessianFunctionPointer  m_SelectedGetSpatialHessianFunction{ &Self::GetSpatialHessianNoCurrentTransform };
  GetJacobianOfSpatialJacobianFunctionPointer m_SelectedGetJacobianOfSpatialJacobianFunction{
    &Self::GetJacobianOfSpatialJacobianNoCurrentTransform
  };
  GetJacobianOfSpatialJacobianFunctionPointer2 m_SelectedGetJacobianOfSpatialJacobianFunction2{
    &Self::GetJacobianOfSpatialJacobianNoCurrentTransform
  };
  GetJacobianOfSpatialHessianFunctionPointer m_SelectedGetJacobianOfSpatialHessianFunction{
    &Self::GetJacobianOfSpatialHessianNoCurrentTransform
  };
  GetJacobianOfSpatialHessianFunctionPointer2 m_SelectedGetJacobianOfSpatialHessianFunction2{
    &Self::GetJacobianOfSpatialHessianNoCurrentTransform
  };

  /** How to combine the transformations. Composition by default. */
  bool m_UseAddition{ false };
  bool m_UseComposition{ true };
};

} // end namespace itk

#ifndef ITK_MANUAL_INSTANTIATION
#  include "itkAdvancedCombinationTransform.hxx"
#endif

#endif // end #ifndef itkAdvancedCombinationTransform_h