def test_aligned_read():
delete_layer()
cv, data = create_layer(size=(50,50,50,1), offset=(0,0,0))
# the last dimension is the number of channels
assert cv[0:50,0:50,0:50].shape == (50,50,50,1)
assert np.all(cv[0:50,0:50,0:50] == data)
delete_layer()
cv, data = create_layer(size=(128,64,64,1), offset=(0,0,0))
# the last dimension is the number of channels
assert cv[0:64,0:64,0:64].shape == (64,64,64,1)
assert np.all(cv[0:64,0:64,0:64] == data[:64,:64,:64,:])
delete_layer()
cv, data = create_layer(size=(128,64,64,1), offset=(10,20,0))
cutout = cv[10:74,20:84,0:64]
# the last dimension is the number of channels
assert cutout.shape == (64,64,64,1)
assert np.all(cutout == data[:64,:64,:64,:])
# get the second chunk
cutout2 = cv[74:138,20:84,0:64]
assert cutout2.shape == (64,64,64,1)
assert np.all(cutout2 == data[64:128,:64,:64,:])
评论列表
文章目录