def test_dilate_points(self): shape = (9, 8, 7) vol = volume.zeros(shape, voxelspacing=1, origin=(1,0,0)) dilate_points(np.asarray([[1, 0, 0]]), np.asarray([1]), vol) answer = volume.zeros(shape, voxelspacing=1, origin=(1,0,0)) answer.array[0, 0, 0] = 1 answer.array[0, 0, 1] = 1 answer.array[0, 0, -1] = 1 answer.array[0, 1, 0] = 1 answer.array[0, -1, 0] = 1 answer.array[1, 0, 0] = 1 answer.array[-1, 0, 0] = 1 self.assertTrue(np.allclose(answer.array, vol.array))
def rsurface(points, radius, shape, voxelspacing): dimensions = [x*voxelspacing for x in shape] origin = volume_origin(points, dimensions) rsurf = volume.zeros(shape, voxelspacing, origin) rsurf = dilate_points(points, radius, rsurf) return rsurf
def rsurface(points, radius, shape, voxelspacing): """Calculate a shape out of the points""" dimensions = [x * voxelspacing for x in shape] origin = volume_origin(points, dimensions) rsurf = volume.zeros(shape, voxelspacing, origin) rsurf = dilate_points(points, radius, rsurf) return rsurf