PointCorrespondence.h
1 /*
2  * Medical Image Registration ToolKit (MIRTK)
3  *
4  * Copyright 2013-2015 Imperial College London
5  * Copyright 2013-2015 Andreas Schuh
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 #ifndef MIRTK_PointCorrespondence_H
21 #define MIRTK_PointCorrespondence_H
22 
23 #include "mirtk/Observable.h"
24 
25 #include "mirtk/Array.h"
26 #include "mirtk/Point.h"
27 #include "mirtk/PointLocator.h"
28 #include "mirtk/RegisteredPointSet.h"
29 
30 #include "vtkSmartPointer.h"
31 #include "vtkPointSet.h"
32 
33 
34 namespace mirtk {
35 
36 
37 /**
38  * Locator of corresponding points of point clouds, curves, or surfaces
39  *
40  * An instance of a subclass derived from PointCorrespondence
41  * finds the point of the source data set which corresponds to the specified
42  * point in the target data set, i.e., a solution of the linear assignment
43  * problem. In case of curves or surfaces, the corresponding point need not be
44  * an explicit point of the source data set, but can also be a point on the
45  * line segment or surface element (cell), respectively.
46  */
48 {
49  mirtkAbstractMacro(PointCorrespondence);
50 
51  // ---------------------------------------------------------------------------
52  // Types
53 public:
54 
55  /// Enumeration of available point correspondence maps
56  enum TypeId
57  {
58  Unknown, ///< Unknown/invalid/default correspondence
59  FiducialMatch, ///< Match points by their respective indices
60  ClosestPoint, ///< Find closest point in source data set
61  ClosestPointLabel, ///< Find closest point in source data set with identical label
62  ClosestCell, ///< Find closest cell in source data set
63  SpectralMatch, ///< Closest point interpolated using spectral similarity
64  RobustClosestPoint, ///< Find closest points within proximity in both directions
65  RobustPointMatch ///< Robust point matching (RPM) correspondence
66  };
67 
68  /// Enumeration of correspondence mapping direction
69  enum Direction
70  {
71  TargetToSource,
72  SourceToTarget
73  };
74 
75  /// List of point features to use for point matching
77 
78  /// Info structure of point feature to use for point matching
80 
81  // ---------------------------------------------------------------------------
82  // Static helpers for subclass implementation
83 public:
84 
85  /// Get number of points
86  ///
87  /// \param[in] dataset Dataset.
88  /// \param[in] sample Indices of points in \p dataset to consider only or NULL for all.
89  ///
90  /// \returns Number of (sample) points.
91  static int GetNumberOfPoints(vtkPointSet *dataset, const Array<int> *sample = NULL);
92 
93  /// Get number of points
94  ///
95  /// \param[in] dataset Dataset.
96  /// \param[in] sample Indices of points in \p dataset to consider only or NULL for all.
97  ///
98  /// \returns Number of (sample) points.
99  static int GetNumberOfPoints(const RegisteredPointSet *dataset, const Array<int> *sample = NULL);
100 
101  /// Get size of feature vectors
102  ///
103  /// \param[in] dataset Dataset.
104  /// \param[in] feature Indices/names and weights/rescaling parameters of features.
105  static int GetPointDimension(vtkPointSet *dataset, const FeatureList *feature);
106 
107  /// Get size of feature vectors
108  ///
109  /// \param[in] dataset Dataset.
110  /// \param[in] feature Indices/names and weights/rescaling parameters of features.
111  static int GetPointDimension(const RegisteredPointSet *dataset, const FeatureList *feature);
112 
113  /// Get index of point
114  ///
115  /// \param[in] dataset Dataset.
116  /// \param[in] sample Indices of points in \p dataset to consider only or NULL for all.
117  /// \param[in] index Index of point in \p dataset or \p sample (if not NULL).
118  ///
119  /// \returns Index of feature vector/point in \p dataset.
120  static int GetPointIndex(vtkPointSet *dataset, const Array<int> *sample, int index);
121 
122  /// Get index of point
123  ///
124  /// \param[in] dataset Dataset.
125  /// \param[in] sample Indices of points in \p dataset to consider only or NULL for all.
126  /// \param[in] index Index of point in \p dataset or \p sample (if not NULL).
127  ///
128  /// \returns Index of feature vector/point in \p dataset.
129  static int GetPointIndex(const RegisteredPointSet *dataset, const Array<int> *sample, int index);
130 
131  /// Get spatial (sample) point
132  ///
133  /// \param[out] point Feature vector.
134  /// \param[in] dataset Dataset.
135  /// \param[in] sample Indices of points in \p dataset to consider only or NULL for all.
136  /// \param[in] index Index of point in \p dataset or \p sample (if not NULL).
137  static void GetPoint(Point &point, vtkPointSet *dataset, const Array<int> *sample, int index);
138 
139  /// Get spatial (sample) point
140  ///
141  /// \param[out] point Feature vector.
142  /// \param[in] dataset Dataset.
143  /// \param[in] sample Indices of points in \p dataset to consider only or NULL for all.
144  /// \param[in] index Index of point in \p dataset or \p sample (if not NULL).
145  static void GetPoint(Point &point, const RegisteredPointSet *dataset, const Array<int> *sample, int index);
146 
147  /// Get feature vector
148  ///
149  /// \param[out] point Feature vector.
150  /// \param[in] dataset Dataset.
151  /// \param[in] sample Indices of points in \p dataset to consider only or NULL for all.
152  /// \param[in] index Index of point in \p dataset or \p sample (if not NULL).
153  /// \param[in] feature Indices/names and weights/rescaling parameters of features.
154  static void GetPoint(double *point, vtkPointSet *dataset, const Array<int> *sample,
155  int index, const FeatureList *feature = NULL);
156 
157  /// Get feature vector
158  ///
159  /// \param[out] point Feature vector.
160  /// \param[in] dataset Dataset.
161  /// \param[in] sample Indices of points in \p dataset to consider only or NULL for all.
162  /// \param[in] index Index of point in \p dataset or \p sample (if not NULL).
163  /// \param[in] feature Indices/names and weights/rescaling parameters of features.
164  static void GetPoint(double *point, const RegisteredPointSet *dataset,
165  const Array<int> *sample, int index, const FeatureList *feature = NULL);
166 
167  /// Calculate squared Euclidean distance between feature vectors
168  ///
169  /// \param[in] a First feature vector.
170  /// \param[in] b Second feature vector.
171  /// \param[in] d Dimension of feature vectors.
172  ///
173  /// \returns Squared Euclidean distance, i.e., dot product of a and b.
174  static double Distance2BetweenPoints(const double *a, const double *b, int d = 3);
175 
176  /// Get subset of sample points
177  ///
178  /// \param[in] dataset Dataset.
179  /// \param[in] sample Indices of points in \p dataset to extract or NULL for all.
180  ///
181  /// \returns Set of \p sample points only.
182  static vtkSmartPointer<vtkPoints> GetPoints(vtkPointSet *dataset, const Array<int> *sample);
183 
184  /// Get subset of sample points
185  ///
186  /// \param[in] dataset Registered dataset.
187  /// \param[in] sample Indices of points in \p dataset to extract or NULL for all.
188  ///
189  /// \returns Set of \p sample points only.
190  static vtkSmartPointer<vtkPoints> GetPoints(const RegisteredPointSet *dataset, const Array<int> *sample);
191 
192  /// Get subset of sample points
193  ///
194  /// \param[in] dataset Dataset.
195  /// \param[in] sample Indices of points in \p dataset to extract or NULL for all.
196  ///
197  /// \returns Dataset consisting of \p sample points only.
198  static vtkSmartPointer<vtkPointSet> GetPointSet(vtkPointSet *dataset, const Array<int> *sample);
199 
200  /// Get subset of sample points
201  ///
202  /// \param[in] dataset Registered dataset.
203  /// \param[in] sample Indices of points in \p dataset to extract or NULL for all.
204  ///
205  /// \returns Dataset consisting of \p sample points only.
206  static vtkSmartPointer<vtkPointSet> GetPointSet(const RegisteredPointSet *dataset, const Array<int> *sample);
207 
208  /// Get index of point data array using case insensitive name
209  static int GetPointDataIndexByCaseInsensitiveName(vtkPointData *, const string &);
210 
211  // ---------------------------------------------------------------------------
212  // Attributes
213 protected:
214 
215  /// Number of point (samples) in target data set
216  mirtkAttributeMacro(int, M);
217 
218  /// Number of point (samples) in source data set
219  mirtkAttributeMacro(int, N);
220 
221  /// Dimension of feature vectors
222  mirtkReadOnlyAttributeMacro(int, NumberOfFeatures);
223 
224  /// (Transformed) target data set
226 
227  /// Indices of target point samples or NULL if all points are considered
228  mirtkPublicAggregateMacro(const Array<int>, TargetSample);
229 
230  /// Indices and rescaling parameters of target point features
231  mirtkPublicAttributeMacro(FeatureList, TargetFeatures);
232 
233  /// (Transformed) source data set
235 
236  /// Indices of source point samples or NULL if all points are considered
237  mirtkPublicAggregateMacro(const Array<int>, SourceSample);
238 
239  /// Indices and rescaling parameters of source point features
240  mirtkPublicAttributeMacro(FeatureList, SourceFeatures);
241 
242  /// Eigenvalues corresponding to spectral coordinates of target
243  mirtkAttributeMacro(Vector, TargetEigenvalues);
244 
245  /// Eigenvalues corresponding to spectral coordinates of source
246  mirtkAttributeMacro(Vector, SourceEigenvalues);
247 
248  /// Number of eigenmodes used for spectral features if used
249  mirtkPublicAttributeMacro(int, DimensionOfSpectralPoints);
250 
251  /// Whether to use diffeomorphic spectral matching for spectral decomposition
252  mirtkPublicAttributeMacro(bool, DiffeomorphicSpectralDecomposition);
253 
254  /// Whether to update spectral coordinates of moving dataset
255  mirtkPublicAttributeMacro(bool, UpdateSpectralPoints);
256 
257  /// Whether target to source correspondences are needed (i.e., GetSourcePoint)
258  mirtkPublicAttributeMacro(bool, FromTargetToSource);
259 
260  /// Whether source to target correspondences are needed (i.e., GetTargetPoint)
261  mirtkPublicAttributeMacro(bool, FromSourceToTarget);
262 
263  /// Default direction (i.e., GetPoint)
264  mirtkPublicAttributeMacro(Direction, DefaultDirection);
265 
266  // ---------------------------------------------------------------------------
267  // Construction/Destruction
268 protected:
269 
270  /// Constructor
272  const RegisteredPointSet * = NULL);
273 
274  /// Copy constructor
276 
277  /// Fill in missing point feature info
278  ///
279  /// This function is called by Initialize after the input data has
280  /// been set. The AddFeature function cannot inspect the input data
281  /// to determine the index of a named feature because the input may
282  /// not be set yet when AddFeature is called.
283  void CompleteFeatureInfo(const RegisteredPointSet *, FeatureList &);
284 
285 public:
286 
287  /// Construct new instance of specified type
288  static PointCorrespondence *New(TypeId);
289 
290  /// Construct new instance of specified type
291  static PointCorrespondence *New(const char *);
292 
293  /// Copy construct a new instance
294  virtual PointCorrespondence *NewInstance() const = 0;
295 
296  /// Destructor
297  virtual ~PointCorrespondence();
298 
299  /// Type enumeration value
300  virtual TypeId Type() const = 0;
301 
302  // ---------------------------------------------------------------------------
303  // Parameters
304 
305  /// Set parameter value from string
306  virtual bool Set(const char *, const char *);
307 
308  // Do not hide other overload
309  using Observable::Parameter;
310 
311  /// Get parameter key/value as string map
312  virtual ParameterList Parameter() const;
313 
314  /// Add point data array to use as feature in point matching
315  ///
316  /// This function is used to specify the point data to use as features in
317  /// the point matching. By default, if no features are specified, the
318  /// spatial coordinates of the points are used. When a feature is added
319  /// to the lists _TargetFeatures and _SourceFeatures, only the named features
320  /// are used. The point matching is then done between n-dimensional vectors
321  /// which are the concatenation of the selected features, where each feature
322  /// may be linearly rescaled to normalize them or adjust their weight in the
323  /// matching function. If the spatial coordinates are to be used as features
324  /// along with other point data features, the feature "spatial coordinates"
325  /// or "spatial point" must be added explicitly as well.
326  ///
327  /// The feature value used is \p weight * (\p slope * value + \p intercept).
328  ///
329  /// \param[in] name Case insensitive name of point data array in both
330  /// target and source dataset.
331  /// \param[in] weight Weight of feature.
332  /// \param[in] slope Slope of feature rescaling function.
333  /// \param[in] intercept Intercept of feature rescaling function, e.g., to
334  /// normalize feature to zero mean.
335  ///
336  /// \note Whether a feature name is valid is determined by FinalizeFeatureLists
337  /// called by Initialize. This cannot be done by AddFeature because the
338  /// input poly data objects may not be set yet.
339  bool AddFeature(const char *name, double weight = 1.0, double slope = 1.0, double intercept = .0);
340 
341  /// Remove point data array from list of features to use for point matching
342  ///
343  /// \param[in] name Name of point data array in both target and source dataset.
344  void RemoveFeature(const char *name);
345 
346  // ---------------------------------------------------------------------------
347  // Correspondences
348 
349  /// Initialize correspondence map
350  virtual void Initialize();
351 
352  /// Reinitialize correspondence map after change of input topology
353  virtual void Reinitialize();
354 
355 protected:
356 
357  /// Common (re-)initialization steps of this class
358  /// \note Must be a non-virtual function!
359  void Init();
360 
361 public:
362 
363  /// Update correspondence map after change of input data sets
364  virtual void Update();
365 
366  /// Update correspondence map after convergence
367  /// \returns Whether correspondences have changed.
368  virtual bool Upgrade();
369 
370  /// Get untransformed target point corresponding to i-th source (sample) point
371  virtual bool GetInputTargetPoint(int, Point &) const = 0;
372 
373  /// Get untransformed source point corresponding to i-th target (sample) point
374  virtual bool GetInputSourcePoint(int, Point &) const = 0;
375 
376  /// Get (transformed) target point corresponding to i-th source (sample) point
377  virtual bool GetTargetPoint(int, Point &) const = 0;
378 
379  /// Get (transformed) source point corresponding to i-th target (sample) point
380  virtual bool GetSourcePoint(int, Point &) const = 0;
381 
382  /// Get untransformed output point corresponding to i-th input (sample) point
383  bool GetInputPoint(int, Point &) const;
384 
385  /// Get (transformed) output point corresponding to i-th input (sample) point
386  bool GetPoint(int, Point &) const;
387 
388  /// Get index of target point corresponding to i-th source (sample) point
389  ///
390  /// \returns Index of corresponding target point and -1 if point is an outlier
391  /// or its corresponding point is not a target vertex position.
392  virtual int GetTargetIndex(int) const;
393 
394  /// Get index of source point corresponding to i-th target (sample) point
395  ///
396  /// \returns Index of corresponding source point and -1 if point is an outlier
397  /// or its corresponding point is not a source vertex position.
398  virtual int GetSourceIndex(int) const;
399 
400  /// \returns Index of corresponding point and -1 if point is an outlier
401  /// or its corresponding point is not a vertex position.
402  int GetIndex(int) const;
403 
404  // ---------------------------------------------------------------------------
405  // Debugging
406 
407  /// Write input of data fidelity term
408  virtual void WriteDataSets(const char *, const char *, bool = true) const;
409 
410  /// Write first three spectral coordinates as polydata points
411  virtual void WriteSpectralPoints(const char *, vtkPointSet *) const;
412 
413 };
414 
415 // -----------------------------------------------------------------------------
416 template <> bool FromString(const char *str, PointCorrespondence::TypeId &);
417 template <> string ToString(const PointCorrespondence::TypeId &, int, char, bool);
418 
419 ////////////////////////////////////////////////////////////////////////////////
420 // Inline definitions
421 ////////////////////////////////////////////////////////////////////////////////
422 
423 // =============================================================================
424 // Static helpers for subclass implementation
425 // =============================================================================
426 
427 // -----------------------------------------------------------------------------
428 inline int PointCorrespondence
429 ::GetNumberOfPoints(vtkPointSet *dataset, const Array<int> *sample)
430 {
431  return PointLocator::GetNumberOfPoints(dataset, sample);
432 }
433 
434 // -----------------------------------------------------------------------------
435 inline int PointCorrespondence
436 ::GetNumberOfPoints(const RegisteredPointSet *dataset, const Array<int> *sample)
437 {
438  return GetNumberOfPoints(dataset->PointSet(), sample);
439 }
440 
441 // -----------------------------------------------------------------------------
442 inline int PointCorrespondence
443 ::GetPointDimension(vtkPointSet *dataset, const FeatureList *features)
444 {
445  return PointLocator::GetPointDimension(dataset, features);
446 }
447 
448 // -----------------------------------------------------------------------------
449 inline int PointCorrespondence
450 ::GetPointDimension(const RegisteredPointSet *dataset, const FeatureList *features)
451 {
452  return GetPointDimension(dataset->PointSet(), features);
453 }
454 
455 // -----------------------------------------------------------------------------
456 inline int PointCorrespondence
457 ::GetPointIndex(vtkPointSet *dataset, const Array<int> *sample, int index)
458 {
459  return PointLocator::GetPointIndex(dataset, sample, index);
460 }
461 
462 // -----------------------------------------------------------------------------
463 inline int PointCorrespondence
464 ::GetPointIndex(const RegisteredPointSet *dataset, const Array<int> *sample, int index)
465 {
466  return GetPointIndex(dataset->PointSet(), sample, index);
467 }
468 
469 // -----------------------------------------------------------------------------
470 inline void PointCorrespondence
471 ::GetPoint(Point &point, vtkPointSet *dataset, const Array<int> *sample, int index)
472 {
473  return PointLocator::GetPoint(point, dataset, sample, index);
474 }
475 
476 // -----------------------------------------------------------------------------
477 inline void PointCorrespondence
478 ::GetPoint(Point &point, const RegisteredPointSet *dataset, const Array<int> *sample, int index)
479 {
480  return GetPoint(point, dataset->PointSet(), sample, index);
481 }
482 
483 // -----------------------------------------------------------------------------
484 inline void PointCorrespondence
485 ::GetPoint(double *point, vtkPointSet *dataset, const Array<int> *sample, int index, const FeatureList *features)
486 {
487  return PointLocator::GetPoint(point, dataset, sample, index, features);
488 }
489 
490 // -----------------------------------------------------------------------------
491 inline void PointCorrespondence
492 ::GetPoint(double *point, const RegisteredPointSet *dataset,
493  const Array<int> *sample, int index, const FeatureList *features)
494 {
495  return GetPoint(point, dataset->PointSet(), sample, index, features);
496 }
497 
498 // -----------------------------------------------------------------------------
499 inline double PointCorrespondence
500 ::Distance2BetweenPoints(const double *a, const double *b, int dim)
501 {
502  return PointLocator::Distance2BetweenPoints(a, b, dim);
503 }
504 
505 // -----------------------------------------------------------------------------
506 inline vtkSmartPointer<vtkPoints> PointCorrespondence
507 ::GetPoints(vtkPointSet *dataset, const Array<int> *sample)
508 {
509  vtkSmartPointer<vtkPoints> points;
510  if (sample && sample->size() > 0) {
511  points = vtkSmartPointer<vtkPoints>::New();
512  points->SetNumberOfPoints(sample->size());
513  double p[3];
514  for (size_t i = 0; i < sample->size(); ++i) {
515  dataset->GetPoint(i, p);
516  points ->SetPoint(i, p);
517  }
518  } else {
519  points = dataset->GetPoints();
520  }
521  return points;
522 }
523 
524 // -----------------------------------------------------------------------------
525 inline vtkSmartPointer<vtkPoints> PointCorrespondence
526 ::GetPoints(const RegisteredPointSet *dataset, const Array<int> *sample)
527 {
528  return GetPoints(dataset->PointSet(), sample);
529 }
530 
531 // -----------------------------------------------------------------------------
532 inline vtkSmartPointer<vtkPointSet> PointCorrespondence
533 ::GetPointSet(vtkPointSet *dataset, const Array<int> *sample)
534 {
535  vtkSmartPointer<vtkPointSet> output;
536  if (sample && sample->size() > 0) {
537  output.TakeReference(dataset->NewInstance());
538  output->SetPoints(GetPoints(dataset, sample));
539  } else {
540  output = dataset;
541  }
542  return output;
543 }
544 
545 // -----------------------------------------------------------------------------
546 inline vtkSmartPointer<vtkPointSet> PointCorrespondence
547 ::GetPointSet(const RegisteredPointSet *dataset, const Array<int> *sample)
548 {
549  return GetPointSet(dataset->PointSet(), sample);
550 }
551 
552 // =============================================================================
553 // Correspondences
554 // =============================================================================
555 
556 // -----------------------------------------------------------------------------
557 inline bool PointCorrespondence::GetInputPoint(int i, Point &p) const
558 {
559  if (_DefaultDirection == TargetToSource) return this->GetInputSourcePoint(i, p);
560  else return this->GetInputTargetPoint(i, p);
561 }
562 
563 // -----------------------------------------------------------------------------
564 inline bool PointCorrespondence::GetPoint(int i, Point &p) const
565 {
566  if (_DefaultDirection == TargetToSource) return this->GetSourcePoint(i, p);
567  else return this->GetTargetPoint(i, p);
568 }
569 
570 // -----------------------------------------------------------------------------
571 inline int PointCorrespondence::GetIndex(int i) const
572 {
573  if (_DefaultDirection == TargetToSource) return this->GetSourceIndex(i);
574  else return this->GetTargetIndex(i);
575 }
576 
577 // =============================================================================
578 // Auxiliary functions for subclass implementation
579 // =============================================================================
580 
581 namespace PointCorrespondenceUtils {
582 
583 
584 // -----------------------------------------------------------------------------
585 /// Draw spatially stratified sample points from given dataset
586 ///
587 /// \param[in] dataset Dataset from which to draw point samples.
588 /// \param[out] indices Indices of drawn points.
589 /// \param[in] maxnum Maximum number of samples.
590 /// \param[in] maxdist Approximate maximum distance between point samples.
591 /// \param[in] stratified Sample spatially stratified points.
592 void SamplePoints(vtkPointSet *dataset, Array<int> &indices, int maxnum,
593  double maxdist = .0, bool stratified = true);
594 
595 // -----------------------------------------------------------------------------
596 /// Draw spatially stratified sample points from given dataset
597 ///
598 /// \param[in] dataset Dataset from which to draw point samples.
599 /// \param[out] indices Indices of drawn points.
600 /// \param[in] maxnum Maximum number of samples.
601 /// \param[in] maxdist Approximate maximum distance between point samples.
602 /// \param[in] stratified Sample spatially stratified points.
603 inline void SamplePoints(const RegisteredPointSet *dataset, Array<int> &indices,
604  int maxnum, double maxdist = .0, bool stratified = true)
605 {
606  SamplePoints(dataset->InputPointSet(), indices, maxnum, maxdist, stratified);
607 }
608 
609 
610 } // namespace PointCorrespondenceUtils
611 
612 
613 } // namespace mirtk
614 
615 #endif // MIRTK_PointCorrespondence_H
Unknown/invalid/default correspondence.
TypeId
Enumeration of available point correspondence maps.
bool GetInputPoint(int, Point &) const
Get untransformed output point corresponding to i-th input (sample) point.
Direction
Enumeration of correspondence mapping direction.
virtual void Initialize()
Initialize correspondence map.
vtkPointSet * PointSet() const
Get (transformed) point set.
Find closest points within proximity in both directions.
static int GetPointIndex(vtkPointSet *dataset, const Array< int > *sample, int index)
static int GetPointDimension(vtkPointSet *dataset, const FeatureList *feature)
Definition: PointLocator.h:671
mirtkPublicAttributeMacro(FeatureList, TargetFeatures)
Indices and rescaling parameters of target point features.
virtual ParameterList Parameter() const
Get parameter key/value as string map.
mirtkPublicAggregateMacro(const RegisteredPointSet, Target)
(Transformed) target data set
bool AddFeature(const char *name, double weight=1.0, double slope=1.0, double intercept=.0)
static int GetNumberOfPoints(vtkPointSet *dataset, const Array< int > *sample=NULL)
Definition: PointLocator.h:665
Array< Pair< string, string > > ParameterList
Ordered list of parameter name/value pairs.
Definition: Object.h:38
void RemoveFeature(const char *name)
virtual bool GetInputTargetPoint(int, Point &) const =0
Get untransformed target point corresponding to i-th source (sample) point.
static double Distance2BetweenPoints(const double *a, const double *b, int d=3)
Definition: PointLocator.h:746
virtual int GetSourceIndex(int) const
Array< FeatureInfo > FeatureList
List of point features to use for nearest neighbor search.
Definition: PointLocator.h:118
static int GetPointDimension(vtkPointSet *dataset, const FeatureList *feature)
virtual int GetTargetIndex(int) const
virtual bool GetTargetPoint(int, Point &) const =0
Get (transformed) target point corresponding to i-th source (sample) point.
Definition: IOConfig.h:41
static double Distance2BetweenPoints(const double *a, const double *b, int d=3)
virtual bool GetSourcePoint(int, Point &) const =0
Get (transformed) source point corresponding to i-th target (sample) point.
PointCorrespondence(const RegisteredPointSet *=NULL, const RegisteredPointSet *=NULL)
Constructor.
static void GetPoint(Point &point, vtkPointSet *dataset, const Array< int > *sample, int index)
static int GetPointIndex(vtkPointSet *dataset, const Array< int > *sample, int index)
Definition: PointLocator.h:694
virtual void WriteDataSets(const char *, const char *, bool=true) const
Write input of data fidelity term.
virtual PointCorrespondence * NewInstance() const =0
Copy construct a new instance.
mirtkAttributeMacro(int, M)
Number of point (samples) in target data set.
static PointCorrespondence * New(TypeId)
Construct new instance of specified type.
mirtkReadOnlyAttributeMacro(int, NumberOfFeatures)
Dimension of feature vectors.
Find closest point in source data set.
string ToString(const EnergyMeasure &value, int w, char c, bool left)
Convert energy measure enumeration value to string.
bool FromString(const char *str, EnergyMeasure &value)
Convert energy measure string to enumeration value.
virtual bool Set(const char *, const char *)
Set parameter value from string.
void CompleteFeatureInfo(const RegisteredPointSet *, FeatureList &)
virtual void Reinitialize()
Reinitialize correspondence map after change of input topology.
virtual void Update()
Update correspondence map after change of input data sets.
static void GetPoint(Point &point, vtkPointSet *dataset, const Array< int > *sample, int index)
Definition: PointLocator.h:701
PointLocator::FeatureList FeatureList
List of point features to use for point matching.
virtual ParameterList Parameter() const
Get parameter name/value pairs.
Definition: Object.h:139
Find closest cell in source data set.
virtual ~PointCorrespondence()
Destructor.
static vtkSmartPointer< vtkPoints > GetPoints(vtkPointSet *dataset, const Array< int > *sample)
static vtkSmartPointer< vtkPointSet > GetPointSet(vtkPointSet *dataset, const Array< int > *sample)
Match points by their respective indices.
static int GetNumberOfPoints(vtkPointSet *dataset, const Array< int > *sample=NULL)
PointLocator::FeatureInfo FeatureInfo
Info structure of point feature to use for point matching.
static int GetPointDataIndexByCaseInsensitiveName(vtkPointData *, const string &)
Get index of point data array using case insensitive name.
virtual TypeId Type() const =0
Type enumeration value.
Closest point interpolated using spectral similarity.
Find closest point in source data set with identical label.
virtual void WriteSpectralPoints(const char *, vtkPointSet *) const
Write first three spectral coordinates as polydata points.
virtual bool GetInputSourcePoint(int, Point &) const =0
Get untransformed source point corresponding to i-th target (sample) point.