Utilities

Distopia utilities

distopia.utils.compute_affine_transform(fixed, moving)[source]

Compute the affine transform by point set registration. The affine transform is the composition of a translation and a linear map. The two ordered lists of points must be of the same length larger or equal to 3. The order of the points in the two list must match.

The 2D affine transform \(\mathbf{A}\) has 6 parameters (2 for the translation and 4 for the linear transform). The best estimate of \(\mathbf{A}\) can be computed using at least 3 pairs of matching points. Adding more pair of points will improve the quality of the estimate. The matching pairs are usually obtained by selecting unique features in both images and measuring their coordinates. :param list fixed: a list of the reference points. :param list moving: a list of the moving points to register on the fixed point. :returns translation, linear_map: the computed translation and linear map affine transform.

Based on pymicro.view.vol_utils.compute_affine_transform