Closed github-actions[bot] closed 1 year ago
https://github.com/simoneponcioni/spline-mesher/blob/3c9d558608e9e291a52501b64106c622945bd7a1/src/spline_mesher/spline-volume-creation.py#L513
self.xnew (numpy.ndarray): x array of sorted points interpolated with bspline and in the same direction self.ynew (numpy.ndarray): y array of sorted points interpolated with bspline and in the same direction """ x = self.coordsX[image_slice == 1][0 :: self.UNDERSAMPLING] y = self.coordsY[image_slice == 1][0 :: self.UNDERSAMPLING] x_s, y_s = self.sort_xy(x, y) xy_sorted = np.c_[x_s, y_s] xy_sorted_closed = np.vstack([xy_sorted, xy_sorted[0]]) x_mahalanobis, y_mahalanobis = self.sort_mahalanobis( xy_sorted.T, "mahalanobis", 0 ) x_mahalanobis = np.append(x_mahalanobis, x_mahalanobis[0]) y_mahalanobis = np.append(y_mahalanobis, y_mahalanobis[0]) # find the knot points tckp, u = splprep( [x_mahalanobis, y_mahalanobis], s=self.S, k=self.K, per=True, ub=[x_mahalanobis, y_mahalanobis][0], ue=[x_mahalanobis, y_mahalanobis][0], ) # evaluate spline, including interpolated points xnew, ynew = splev(np.linspace(0, 1, self.INTERP_POINTS_S), tckp) xnew = np.append(xnew, xnew[0]) ynew = np.append(ynew, ynew[0]) # Sanity check to ensure directionality of sorting in cw- or ccw-direction xnew, ynew = self.check_orient(xnew, ynew, direction=1) return ( xy_sorted_closed, xnew[1:], ynew[1:], ) # TODO: evaluate if point removal is necessary def input_sanity_check(self, ext_contour_s: np.ndarray, int_contour_s: np.ndarray): """
https://github.com/simoneponcioni/spline-mesher/blob/3c9d558608e9e291a52501b64106c622945bd7a1/src/spline_mesher/spline-volume-creation.py#L513