unravel.coordinates.physical_points_to_img module#
Use coords_physical_points_to_img or pp2i from UNRAVEL to convert physical-space point coordinates (e.g., coordinates in µm) into a 3D image using a reference image.
This is useful when point coordinates are given in physical units rather than voxel indices. For example, Allen CCF25 coordinates in µm can be converted to voxel coordinates by dividing by 25.
- Input:
CSV with physical coordinate columns, e.g. x, y, z
- Output:
3D image where each voxel contains the number of points at that location
Note
- Coordinates are assumed to be in the same axis order as the output image:
x -> axis 0 y -> axis 1 z -> axis 2
- For Allen CCF25 AP/DV/ML coordinates matching a PIR CCF image:
x = AP y = DV z = ML
Points outside the reference image bounds are skipped.
Usage:#
coords_physical_points_to_img -i coordinates.csv -ri atlas_CCFv3_2020_25um.nii.gz -x x -y y -z z -s 25 -o units_CCF25.nii.gz
- unravel.coordinates.physical_points_to_img.parse_spacing(spacing)[source]#
Return spacing as a length-3 numpy array.
- unravel.coordinates.physical_points_to_img.validate_columns(df, columns)[source]#
Raise a helpful error if required columns are missing.