def on_fitButton_clicked(self): "Fitting a sphere to the line hoping the sphere to capture a circular movement" ids = [] lps = sl.firstLineAsArray(self.polyLine, ids) slps = sl.smoothLine(lps) dslps = (len(ids) - slps.shape[0]) / 2 pts = self.polyLine.GetPoints() for (idx, j) in enumerate(range(dslps, len(lps) - dslps)): pts.SetPoint(ids[j], slps[idx, :])
def on_fitButton_clicked(self): "Fitting a sphere to the line hoping the sphere to capture a circular movement" ids = [] lps = sl.firstLineAsArray(self.polyLine, ids) slps = sl.smoothLine(lps) dslps = (len(ids) - slps.shape[0]) / 2 pts = self.polyLine.GetPoints() for (idx,j) in enumerate(range(dslps, len(lps)-dslps)): pts.SetPoint(ids[j], slps[idx,:])
def on_smoothButton_clicked(self): ids = [] lps = sl.firstLineAsArray(self.polyLine, ids) slps = sl.smoothLine(lps) dslps = (len(ids) - slps.shape[0]) / 2 pts = self.polyLine.GetPoints() for (idx, j) in enumerate(range(dslps, len(lps) - dslps)): pts.SetPoint(ids[j], slps[idx, :]) self.RenderLine() return
def on_smoothButton_clicked(self): ids = [] lps = sl.firstLineAsArray(self.polyLine, ids) slps = sl.smoothLine(lps) dslps = (len(ids) - slps.shape[0]) / 2 pts = self.polyLine.GetPoints() for (idx,j) in enumerate(range(dslps, len(lps)-dslps)): pts.SetPoint(ids[j], slps[idx,:]) self.RenderLine() return
def RenderLine(self): self.ren.RemoveAllViewProps() p = self.polyLine m = vtk.vtkPolyDataMapper() m.SetInput(p) a = vtk.vtkActor() a.SetMapper(m) self.AddGeometry() self.ren.AddActor(a) self.ren.ResetCamera() self.i.Render() ids = [] line = sl.firstLineAsArray(p, ids) curvatures = sl.computeCurvatureForLine(line) self.ax.clear() if (self.bPlotK.isChecked()): self.ax.plot(curvatures) (p1, p2, dk) = sl.bracketPeaks(curvatures, -400, 400) if (self.bPlotdK.isChecked()): self.ax.plot(dk) if (self.bPlotKFFT.isChecked()): fftK = np.abs(np.fft.rfft(curvatures)) self.ax.plot(fftK) self.canvasWidget.draw()