Example #1
0
def test_resampling_1():
    shape = (10, 10)
    d = diffeo_identity(shape)
    dc = d.astype('float32')
    
    du = diffeou_from_diffeoc(dc)
    d2 = diffeoc_from_diffeou(du)
    assert_allclose(dc, d2)
Example #2
0
def test_resampling_1():
    shape = (10, 10)
    d = diffeo_identity(shape)
    dc = d.astype("float32")

    du = diffeou_from_diffeoc(dc)
    d2 = diffeoc_from_diffeou(du)
    assert_allclose(dc, d2)
Example #3
0
    def flat_test1(self):
        """ Same if we give the identity as centers """
        shape = (10, 15)
        area = (4, 4)
        fs1 = FlatStructure(shape, area, None)

        centers = diffeo_identity(shape)
        fs2 = FlatStructure(shape, area, centers)
        
        n1 = fs1.neighbor_indices_flat
        n2 = fs2.neighbor_indices_flat
        
        assert_allclose(n1, n2)
Example #4
0
def test_resampling_2():
    shape = (10, 10)
    shape2 = (20, 20)
    d = diffeo_identity(shape)
    dc = d.astype('float32')
    order = 0  # invertible only for linear
    ec = diffeo_resample(dc, shape2, order=order)
    dc2 = diffeo_resample(ec, shape, order=order)
    print "first line"
    print dc[0, :, 0]
    print dc2[0, :, 0]
    print "last line"
    print dc[-1, :, 0]
    print dc2[-1, :, 0]
    assert_allclose(dc, dc2)
Example #5
0
def test_resampling_2():
    shape = (10, 10)
    shape2 = (20, 20)
    d = diffeo_identity(shape)
    dc = d.astype("float32")
    order = 0  # invertible only for linear
    ec = diffeo_resample(dc, shape2, order=order)
    dc2 = diffeo_resample(ec, shape, order=order)
    print "first line"
    print dc[0, :, 0]
    print dc2[0, :, 0]
    print "last line"
    print dc[-1, :, 0]
    print dc2[-1, :, 0]
    assert_allclose(dc, dc2)