Example #1
0
 def __init__(self, dd):
     self._dd = dd
     H, W = dd.shape[:2]
     self.shape = (H, W)
     self.f = Flattening.by_rows((H, W))
     indices = self.f.get_cell2index()
     assert indices.shape == (H, W)
     indices_phi = diffeo_apply(dd, indices)
     assert indices_phi.shape == (H, W)
     self.indices_phi_flat = self.f.rect2flat(indices_phi)
Example #2
0
 def __init__(self, dd):
     self._dd = dd
     H, W = dd.shape[:2]
     self.shape = (H, W)
     self.f = Flattening.by_rows((H, W))
     indices = self.f.get_cell2index()
     assert indices.shape == (H, W)
     indices_phi = diffeo_apply(dd, indices)
     assert indices_phi.shape == (H, W)
     self.indices_phi_flat = self.f.rect2flat(indices_phi)
def diffeo_quick1(id_dd, dd):  # @UnusedVariable
    M, N = dd.shape[0], dd.shape[1]

    template = np.random.rand(M, N)
    y1 = diffeo_apply(dd, template)
    
    fda = FastDiffeoApply(dd)
    y2 = fda(template)
    
    assert_allclose(y1, y2)
def diffeo_quick1(id_dd, dd):  # @UnusedVariable
    M, N = dd.shape[0], dd.shape[1]

    template = np.random.rand(M, N)
    y1 = diffeo_apply(dd, template)

    fda = FastDiffeoApply(dd)
    y2 = fda(template)

    assert_allclose(y1, y2)
Example #5
0
 def _d_apply(self, template):
     if not 'fda' in self.__dict__:
         # print('Initializing fast diffeo apply')
         # note that we do one of this for each new diffeomorphism
         from diffeo2d import FastDiffeoApply
         self.fda = FastDiffeoApply(self.d)
     result = self.fda(template)
     
     # Change to True to test 
     if False:
         from diffeo2d import diffeo_apply
         assert_allclose(result, diffeo_apply(self.d, template))
     
     return result
Example #6
0
    def _d_apply(self, template):
        if not 'fda' in self.__dict__:
            # print('Initializing fast diffeo apply')
            # note that we do one of this for each new diffeomorphism
            from diffeo2d import FastDiffeoApply
            self.fda = FastDiffeoApply(self.d)
        result = self.fda(template)

        # Change to True to test
        if False:
            from diffeo2d import diffeo_apply
            assert_allclose(result, diffeo_apply(self.d, template))

        return result