def bundle_min_distance_asymmetric_fast(t, static, moving, block_size): """ MDF-based pairwise distance optimization function (MIN) We minimize the distance between moving streamlines as they align with the static streamlines. Parameters ----------- t : array 1D array. t is a vector of of affine transformation parameters with size at least 6. If size is 6, t is interpreted as translation + rotation. If size is 7, t is interpreted as translation + rotation + isotropic scaling. If size is 12, t is interpreted as translation + rotation + scaling + shearing. static : array N*M x 3 array. All the points of the static streamlines. With order of streamlines intact. Where N is the number of streamlines and M is the number of points per streamline. moving : array K*M x 3 array. All the points of the moving streamlines. With order of streamlines intact. Where K is the number of streamlines and M is the number of points per streamline. block_size : int Number of points per streamline. All streamlines in static and moving should have the same number of points M. Returns ------- cost: float """ aff = compose_matrix44(t) moving = np.dot(aff[:3, :3], moving.T).T + aff[:3, 3] moving = np.ascontiguousarray(moving, dtype=np.float64) rows = static.shape[0] / block_size cols = moving.shape[0] / block_size return _bundle_minimum_distance_asymmetric(static, moving, rows, cols, block_size)