registration module¶
Package for dealing with registration methods between two AmpObject meshes Copyright: Joshua Steer 2020, Joshua.Steer@soton.ac.uk
- class registration(baseline, target, method='point2plane', *args, **kwargs)
Bases:
object
Registration methods between two AmpObject meshes. This function morphs the baseline vertices onto the surface of the target and returns a new AmpObject
- Parameters
baseline (AmpObject) – The baseline AmpObject, the vertices from this will be morphed onto the target
target (AmpObject) – The target AmpObject, the shape that the baseline attempts to morph onto
method (str: default 'point2plane') – A string of the method used for registration
*args – The arguments used for the registration methods
**kwargs – The keyword arguments used for the registration methods
- Returns
reg – The registered AmpObject, the vertices of this are on the surface of the target and it has the same number of vertices and face array as the baseline AmpObject Access this accessing the registration.reg
- Return type
AmpObject
Examples
>>> from ampscan.core import AmpObject >>> baseline = AmpObject(basefh) >>> target = AmpObject(targfh) >>> reg = registration(baseline, target, steps=10, neigh=10, smooth=1).reg
- calcError(method='norm')
Calculate the magnitude of distances between the baseline and registered array
- Parameters
method (str, default 'norm') – The method used to calculate the distances. ‘abs’ returns the absolute distance. ‘cent’calculates polarity based upon distance from centroid. ‘norm’ calculates dot product between baseline vertex normal and distance normal
- Returns
values – Magnitude of distances
- Return type
array_like
- getReg()
Return the registered AmpObject
- getValues()
” Return the values array from the registration
- plotResults(name=None, xrange=None, color=None, alpha=None)
Function to generate a mpl figure. Includes a rendering of the AmpObject, a histogram of the registration values
- Returns
fig – A matplot figure of the standard analysis
- Return type
mplfigure
- point2plane(steps=1, neigh=10, inside=True, subset=None, scale=None, smooth=1, fixBrim=False, error='norm')
Point to Plane method for registration between the two meshes
- Parameters
steps (int, default 1) – Number of iterations
int – Number of nearest neighbours to interrogate for each baseline point
10 (default) – Number of nearest neighbours to interrogate for each baseline point
inside (bool, default True) – If True, a barycentric centre check is made to ensure the registered point lines within the target triangle
subset (array_like, default None) – Indicies of the baseline nodes to include in the registration, default is none so all are used
scale (float, default None) – If not None scale the baseline mesh to match the target mesh in the z-direction, the value of scale will be used as a plane from which the nodes are scaled. Nodes with a higher z value will not be scaled.
smooth (int, default 1) – Indicate number of Laplacian smooth steps in between the steps
fixBrim (bool, default False) – If True, the nodes on the brim line will not be included in the smooth
error (bool, default False) – If True, the polarity will be included when calculating the distance between the target and baseline mesh
- setBaseline(amp)
Set the baseline AmpObject
- setTarget(amp)
Set the target AmpObject