dsb-2017
dsb-2017 copied to clipboard
HU value and the coordinates
hi anlthms, 1.mask = np.array(image > -320, dtype=np.int8) the '-320' is HU value,but u just use it on array value....
2.coord_z,coord_y,coord_x are the world coordinates.After you run
slices = ndimage.interpolation.zoom(data, spacing, mode='nearest')
, u should convert the world coordinates to voxel coordinates using the origin and spacing of the ct_scan, like:
'''
def world_2_voxel(world_coordinates, origin, spacing):
stretched_voxel_coordinates = np.absolute(world_coordinates - origin)
voxel_coordinates = stretched_voxel_coordinates / spacing
return voxel_coordinates
'''
Hi Bonsen, Do you mean anlthms should change to voxel coordinates before creating mask?
Best, Feng
@parkerzf sorry, I find the newspacing may be [ 1. 0.9999996 0.9999996] So, it equels to [1,1,1] and "convert" makes no difference.
-
Not sure I understand the issue.
-
Conversion from world coordinates to voxel coordinates is done here: https://github.com/anlthms/dsb-2017/blob/master/convert.py#L54.