Density.match_densities#

classmethod Density.match_densities(target, template, cutoff_target=0, cutoff_template=0, scoring_method='NormalizedCrossCorrelation', **kwargs)[source]#

Aligns two Density instances target and template and returns the aligned template.

If voxel sizes of target and template dont match coordinates are scaled to the numerically smaller voxel size. Instances are prealigned based on their center of mass. Finally tme.matching_optimization.optimize_match() is used to determine translation and rotation to map template to target.

Parameters:
targetDensity

The target map for alignment.

templateDensity

The template that should be aligned to the target.

cutoff_targetfloat, optional

The cutoff value for the target map, by default 0.

cutoff_templatefloat, optional

The cutoff value for the template map, by default 0.

scoring_methodstr, optional

The scoring method to use for alignment. See tme.matching_optimization.create_score_object for available methods, by default “NormalizedCrossCorrelation”.

kwargsdict, optional

Optional keyword arguments passed to tme.matching_optimization.optimize_match().

Returns:
Tuple

Tuple containing template aligned to target as Density object, translation in voxels and rotation matrix used for the transformation.

Notes

No densities below cutoff_template are present in the returned Density object.