'Find MRI scaling and rotation to match head shape points.'

def fit_scale_hsp_points(self):

    src_pts = (self.hsp.points - self.hsp.nasion)
    tgt_pts = (self.processed_mri_points - self.mri.nasion)
    if (self.n_scale_params == 1):
        x0 = (self.rot_x, self.rot_y, self.rot_z, (1.0 / self.scale_x))
        est = fit_point_cloud(src_pts, tgt_pts, rotate=True, translate=False, scale=1, x0=x0)
        self.scale_x = (1.0 / est[3])
    else:
        x0 = (self.rot_x, self.rot_y, self.rot_z, (1.0 / self.scale_x), (1.0 / self.scale_y), (1.0 / self.scale_z))
        est = fit_point_cloud(src_pts, tgt_pts, rotate=True, translate=False, scale=3, x0=x0)
        (self.scale_x, self.scale_y, self.scale_z) = (1.0 / est[3:])
    (self.rot_x, self.rot_y, self.rot_z) = est[:3]
