Exemple #1
0
def goTest():
    f, g = getSinoImages()
    f = copy(ni, nx, f)
    g = copy(ni + nl, nx, g)
    SimplePlot.asPixels(f)
    SimplePlot.asPixels(g)
    mx = 4
    ht = 50
    #for mx in [1,5,10,20,40,80]:
    #for mx in [1,4,16,64]:
    for ht in [1, 25, 50, 100]:
        ixl = nx / 2 - mx / 2
        ixu = ixl + mx
        nj = 1 + (ni - 1) / ht
        i = rampint(0, ht, nj)
        e = zerofloat(nl, ni)
        for ix in range(ixl, ixu):
            ei = DynamicWarpingS.computeErrors(nl, f[ix], g[ix])
            add(ei, e, e)
        u1 = DynamicWarpingS.findShifts(0.0, 2.0, e)
        uj = DynamicWarpingS.findShiftsI(0.0, 2.0, e, i)
        tj = rampfloat(0.0, ht, nj)
        ti = rampfloat(0.0, 1.0, ni)
        ci = CubicInterpolator(CubicInterpolator.Method.MONOTONIC, tj, uj)
        u2 = ci.interpolate(ti)
        plotErrors(e)
        if ht > 1:
            plotErrors(e, None, u2, tj, uj)
        else:
            plotErrors(e, None, u2)
Exemple #2
0
def goTest():
  f,g = getSinoImages()
  f = copy(ni,nx,f)
  g = copy(ni+nl,nx,g)
  SimplePlot.asPixels(f)
  SimplePlot.asPixels(g)
  mx = 4
  ht = 50
  #for mx in [1,5,10,20,40,80]:
  #for mx in [1,4,16,64]:
  for ht in [1,25,50,100]:
    ixl = nx/2-mx/2
    ixu = ixl+mx
    nj = 1+(ni-1)/ht
    i = rampint(0,ht,nj)
    e = zerofloat(nl,ni)
    for ix in range(ixl,ixu):
      ei = DynamicWarpingS.computeErrors(nl,f[ix],g[ix])
      add(ei,e,e)
    u1 = DynamicWarpingS.findShifts(0.0,2.0,e)
    uj = DynamicWarpingS.findShiftsI(0.0,2.0,e,i)
    tj = rampfloat(0.0,ht,nj)
    ti = rampfloat(0.0,1.0,ni)
    ci = CubicInterpolator(CubicInterpolator.Method.MONOTONIC,tj,uj)
    u2 = ci.interpolate(ti)
    plotErrors(e)
    if ht>1:
      plotErrors(e,None,u2,tj,uj)
    else:
      plotErrors(e,None,u2)
Exemple #3
0
def computeErrors(mx, f, g):
    ixl = nx / 2 - mx / 2
    ixu = ixl + mx
    e = zerofloat(nl, ni)
    for ix in range(ixl, ixu):
        ei = DynamicWarpingS.computeErrors(nl, f[ix], g[ix])
        add(ei, e, e)
    return e
Exemple #4
0
def computeErrors(mx,f,g):
  ixl = nx/2-mx/2
  ixu = ixl+mx
  e = zerofloat(nl,ni)
  for ix in range(ixl,ixu):
    ei = DynamicWarpingS.computeErrors(nl,f[ix],g[ix])
    add(ei,e,e)
  return e