| Bsoft 2.0.5 Bernard's software package

Classes | Macros | Functions
marker.h File Reference

Header file for image parameter functions. More...

`#include "rwmodel.h"`
`#include "Transform.h"`

Go to the source code of this file.

## Classes
struct | Bmarker

## Macros
#define | _MarkerLinker_

## Functions
long | marker_stats (Bmarker *markers)
| Calculating marker statistics. More...
Bmarker * | markers_copy (Bmarker *mark)
| Copies a set of markers. More...
Bmarker * | markers_copy_selected (Bmarker *mark)
| Copies a set of markers based on selection. More...
long | markers_add (Bmarker **mark, Bmarker *mark2, double mindist, int sel)
| Adds a set of markers to another. More...
long | markers_delete_non_selected (Bmarker **mark)
| Deletes markers not selected. More...
int | marker_shift (Bmarker *markers, Vector3< double > shift)
| Shifting markers. More...
int | marker_scale (Bmarker *markers, Vector3< double > scale)
| Scaling markers. More...
int | marker_transform (Bmarker *markers, Transform t)
| Transforming markers. More...
double | marker_compare (Bmarker *mark1, Bmarker *mark2)
| Compare marker sets and calculates the root-mean-square deviation. More...
Matrix3 | marker_find_matrix (Bmarker *markers1, Bmarker *markers2, Vector3< double > origin1, Vector3< double > origin2)
| Determines the rotation matrix between two sets of markers. More...
Transform | marker_find_transform (Bmarker *markers1, Bmarker *markers2, Vector3< double > origin)
| Determines the rotation matrix between two sets of markers. More...
Transform | markers_find_rottrans (Bmarker *set1, Bmarker *set2, double tolerance)
| Finds the rotation and shift between two sets of vectors. More...
Transform * | markers_map_and_find_transform (Bmarker **set, int nseries, int refset, Vector3< long > size)
| This function finds the transform parameters between sets of coordinates. These sets are expected to have a large intersection, but do not have to be 1 to 1. More...
long | markers_limit (int target_num, int sign, Bmarker **set)
| This method constricts a marker set to target_num points. More...
Bmodel * | model_from_markers (Bmarker *markers, Vector3< double > origin, Vector3< double > sam)
| Convert markers to a model. More...
int | marker_plane (Bmarker *markers, Vector3< double > origin)
| Fits a plane to a set of markers. More...
Bmarker * | markers_sort_by_id (Bmarker **mark)
| Sorts a set of markers by ID number. More...
long | markers_renumber (Bmarker *mark)
| Renumbers a set of markers. More...
long | markers_center (Bmarker *mark, Vector3< double > center)
| Centers a set of markers. More...
Bmarker * | marker_set_at_radius (double rad, double ainc)
| Generates a marker set at a given radius with z=0. More...
int | marker_sets_to_bild (Bstring &filename, Bmarker *mark1, Bmarker *mark2)
| Generates a bild file with the two marker sets. More...

## Detailed Description

Header file for image parameter functions.

Author
  Bernard Heymann

Date
  Created: 20051226
  Modified: 20170823

Definition in file marker.h.

## Macro Definition Documentation

## ◆ _MarkerLinker_

#define _MarkerLinker_

Definition at line 13 of file marker.h.

## Function Documentation

## ◆ marker_compare()

double marker_compare | ( | Bmarker * | mark1,
|  | Bmarker * | mark2
| ) |  |

Compare marker sets and calculates the root-mean-square deviation.

Parameters

  *mark1 | linked list of markers.
  *mark2 | linked list of markers.

Returns
  double RMSD.

Definition at line 248 of file marker.cpp.

## ◆ marker_find_matrix()

Matrix3 marker_find_matrix | ( | Bmarker * | markers1,
|  | Bmarker * | markers2,
|  | Vector3< double > | origin1,
|  | Vector3< double > | origin2
| ) |  |

Determines the rotation matrix between two sets of markers.

Parameters

  *markers1 | linked list of markers.
  *markers2 | linked list of markers.
  origin1 | origin of first set.
  origin2 | origin of second set.

Returns
  Matrix3 rotation matrix.

      The function calculates the rotation matrix required to superimposed
      the first set onto the second set.
      Requirement: The two marker sets must share a significant number of markers.

Definition at line 279 of file marker.cpp.

## ◆ marker_find_transform()

Transform marker_find_transform | ( | Bmarker * | markers1,
|  | Bmarker * | markers2,
|  | Vector3< double > | origin
| ) |  |

Determines the rotation matrix between two sets of markers.

Parameters

  *markers1 | linked list of markers.
  *markers2 | linked list of markers.
  origin | origin of rotation.

Returns
  Transform transform structure.

      The function calculates the rotation matrix required to superimposed
      the first set onto the second set.
      Requirement: The two marker sets must share a significant number of markers.

Definition at line 346 of file marker.cpp.

## ◆ marker_plane()

int marker_plane | ( | Bmarker * | markers,
|  | Vector3< double > | origin
| ) |  |

Fits a plane to a set of markers.

Parameters

  *markers | linked list of markers.
  origin | marker origin.

Returns
  int 0.

      The plane is given by:
          a*x + b*y + c*z = d
      The fit is assessed by calculating the distance of each marker to
      the plane:
          R = sqrt(sum(|a*x + b*y + c*z - d|^2)/n)

Definition at line 1042 of file marker.cpp.

## ◆ marker_scale()

int marker_scale | ( | Bmarker * | markers,
|  | Vector3< double > | scale
| ) |  |

Scaling markers.

Parameters

  *markers | linked list of markers.
  scale | scale vector.

Returns
  int error code (<0 means failure).

Definition at line 208 of file marker.cpp.

## ◆ marker_set_at_radius()

Bmarker* marker_set_at_radius | ( | double | rad,
|  | double | ainc
| ) |  |

Generates a marker set at a given radius with z=0.

Parameters

  rad | radius.
  ainc | angular increment.

Returns
  int 0, <0 on error.

      Markers are generated at the given radius and angular increments.

Definition at line 1208 of file marker.cpp.

## ◆ marker_sets_to_bild()

int marker_sets_to_bild | ( | Bstring & | filename,
|  | Bmarker * | mark1,
|  | Bmarker * | mark2
| ) |  |

Generates a bild file with the two marker sets.

Parameters

  &filename | bild format file name.
  *mark1 | marker list 1.
  *mark2 | marker list 2.

Returns
  int 0, <0 on error.

      A sphere is drawn for every marker.
      The first set is red and the second set is blue.

Definition at line 1237 of file marker.cpp.

## ◆ marker_shift()

int marker_shift | ( | Bmarker * | markers,
|  | Vector3< double > | shift
| ) |  |

Shifting markers.

Parameters

  *markers | linked list of markers.
  shift | shift vector.

Returns
  int error code (<0 means failure).

Definition at line 192 of file marker.cpp.

## ◆ marker_stats()

long marker_stats | ( | Bmarker * | markers | ) |

Calculating marker statistics.

Parameters

  *markers | list of markers.

Returns
  long number of markers (<0 means failure).

Definition at line 34 of file marker.cpp.

## ◆ marker_transform()

int marker_transform | ( | Bmarker * | markers,
|  | Transform | t
| ) |  |

Transforming markers.

Parameters

  *markers | linked list of markers.
  t | transform structure.

Returns
  int number of markers.

Definition at line 226 of file marker.cpp.

## ◆ markers_add()

long markers_add | ( | Bmarker ** | mark,
|  | Bmarker * | mark2,
|  | double | mindist,
|  | int | sel
| ) |  |

Adds a set of markers to another.

Parameters

  **mark | marker list.
  *mark2 | marker list to add.
  mindist | minimum distance between markers.
  sel | selection flag to set for second list.

Returns
  Bmarker* new marker list.

      The second list of markers are checked to eliminate those close to
      markers in the first set. The remaining markers are then added and
      their selection flags set if the variable sel is greater than zero.

Definition at line 120 of file marker.cpp.

## ◆ markers_center()

long markers_center | ( | Bmarker * | mark,
|  | Vector3< double > | center
| ) |  |

Centers a set of markers.

Parameters

  **mark | pointer to marker list.
  center | center to shift to.

Returns
  long number of markers.

      The marker center is calculated and the all markers shifted by the
      difference with the target center.

Definition at line 1176 of file marker.cpp.

## ◆ markers_copy()

Bmarker* markers_copy | ( | Bmarker * | mark | ) |

Copies a set of markers.

Parameters

  *mark | marker list.

Returns
  Bmarker* new marker list.

Definition at line 92 of file marker.cpp.

## ◆ markers_copy_selected()

Bmarker* markers_copy_selected | ( | Bmarker * | mark | ) |

Copies a set of markers based on selection.

Parameters

  *mark | marker list.

Returns
  Bmarker* new marker list.

Definition at line 102 of file marker.cpp.

## ◆ markers_delete_non_selected()

long markers_delete_non_selected | ( | Bmarker ** | mark | ) |

Deletes markers not selected.

Parameters

  **mark | pointer to marker list.

Returns
  long number of remaining markers.

Definition at line 159 of file marker.cpp.

## ◆ markers_find_rottrans()

Transform markers_find_rottrans | ( | Bmarker * | set1,
|  | Bmarker * | set2,
|  | double | tolerance
| ) |  |

Finds the rotation and shift between two sets of vectors.

Parameters

  *set1 | first coordinate set.
  *set2 | second coordinate set.
  tolerance | acceptable deviation for fit.

Returns
  Transform structure with shift, scale, rotation angle, and R factor.

      A large number of angles is tested and the shift calculated at each angle.
      The best angle is selected based on the sum of the standard deviations of
      the x, y and z shifts.
      Outliers are iteratively removed until the shift standard deviations drop
      below a tolerance value.
      The angle returned is the rotation applied to the first set to obtain
      an estimate of the second set.
      Requirement: The two sets must have the same number of points.

Definition at line 416 of file marker.cpp.

## ◆ markers_limit()

long markers_limit | ( | int | target_num,
|  | int | sign,
|  | Bmarker ** | set
| ) |  |

This method constricts a marker set to target_num points.

Author
  Samuel Payne

Parameters

  target_num | number of points desired in set.
  sign | sign to direct sorting.
  **set | pointer to set containing all the points.

Returns
  long number of points selected.

      This finds the target_num darkest points in the set.  The extreme
      grey scale value associated with each point is held in value field
      of the Point structure.  This is copied into an array and sorted. The
      cutoff value is the target_num index in the array.  A new array of
      points is created containing points below the cutoff and then returned.

Definition at line 909 of file marker.cpp.

## ◆ markers_map_and_find_transform()

Transform* markers_map_and_find_transform | ( | Bmarker ** | set,
|  | int | nseries,
|  | int | refset,
|  | Vector3< long > | size
| ) |  |

This function finds the transform parameters between sets of coordinates. These sets are expected to have a large intersection, but do not have to be 1 to 1.

Author
  Samuel Payne

Parameters

  **set | set of coordinates from images to be aligned.
  nseries | number of images in the set.
  refset | reference set number.
  size | size of images/frames of sets.

Returns
  Transform* list with shift, scale, rotation angle, and R factor.

      Gets a one to one mapping of the two coordinate sets using
      markers_find_rottrans to compare pairs of sets.
      A postscript file is made to graphically show the deviations of each
      point from its calculated position.
      Assumptions: This assumes each set has been sorted according to
      distance from the center of the set.

Definition at line 585 of file marker.cpp.

## ◆ markers_renumber()

long markers_renumber | ( | Bmarker * | mark | ) |

Renumbers a set of markers.

Parameters

  **mark | pointer to marker list.

Returns
  long number of markers.

Definition at line 1150 of file marker.cpp.

## ◆ markers_sort_by_id()

Bmarker* markers_sort_by_id | ( | Bmarker ** | mark | ) |

Sorts a set of markers by ID number.

Parameters

  **mark | pointer to marker list.

Returns
  Bmarker* new pointer to marker list.

Definition at line 1104 of file marker.cpp.

## ◆ model_from_markers()

Bmodel* model_from_markers | ( | Bmarker * | markers,
|  | Vector3< double > | origin,
|  | Vector3< double > | sam
| ) |  |

Convert markers to a model.

Parameters

  *markers | linked list of markers.
  origin | marker origin.
  sam | scaling marker coordinates.

Returns
  Bmodel* new model.

Definition at line 1002 of file marker.cpp.