class SimpleSplineTracker(lib.FeatureTracker): @classmethod def getDisplayName(cls): return "Simple spline-fit" def __init__(self): lib.FeatureTracker.__init__(self) self.fitFunction = ScaledSpline() self.xValues = np.array([]) def initialize(self,intensityProfile): valuesDict = self.fitFunction.estimateInitialParameters(intensityProfile,filter_sigma=1) self.p0 = valuesDict.values() self.xValues = np.arange(len(intensityProfile)) def findNextPosition(self,intensityProfile): popt,pcov = curve_fit(self.fitFunction, self.xValues[self.rangeSlice],intensityProfile[self.rangeSlice],self.p0,maxfev=10000) self.p0 = popt return self.fitFunction.getDisplacement(*popt)
def __init__(self): lib.FeatureTracker.__init__(self) self.fitFunction = ScaledSpline() self.xValues = np.array([])