unravel.coordinates.physical_points_add_regions module#

Use coords_physical_points_add_regions or ppar from UNRAVEL to add atlas region IDs and region metadata to a CSV containing physical-space point coordinates.

This is useful when point coordinates are in physical units, e.g. µm, rather than voxel/index space. Coordinates are converted to voxel indices using the provided spacing, then atlas IDs are looked up directly from an atlas image.

Input:
  • CSV with physical coordinate columns, e.g. channel_ml, channel_dv, channel_ap

  • Atlas image in the same array orientation as the coordinate columns

  • Region info CSV, e.g. CCFv3-2020_info.csv

Output:
  • CSV with original metadata plus:

    x, y, z Region_ID atlas_lookup_status abbreviation full_structure_name

Note

  • Coordinates are assumed to be in the same axis order as the atlas image:

    x -> atlas axis 0 y -> atlas axis 1 z -> atlas axis 2

  • For Kevin’s CCF-space images, this appeared to work:

    x = channel_ml y = channel_dv z = channel_ap

  • Points outside atlas bounds are retained but assigned Region_ID = 0.

Usage:#

coords_physical_points_add_regions

-i ISOTRP_all_recordings_units_CCFcoordinates.csv -a CCF25/atlas_CCFv3_2020_25um_in_kevin_space.nii.gz -x channel_ml -y channel_dv -z channel_ap -s 25 -csv CCFv3-2020_info.csv -id lowered_ID -o units_with_regions.csv

Usage example for one recording:#

coords_physical_points_add_regions

-i ISOTRP_all_recordings_units_CCFcoordinates.csv -a CCF25/atlas_CCFv3_2020_25um_in_kevin_space.nii.gz -x channel_ml -y channel_dv -z channel_ap -s 25 -f “recording_name == ‘NP09_R1’” -csv CCFv3-2020_info.csv -id lowered_ID -o NP09_R1_units_with_regions.csv

unravel.coordinates.physical_points_add_regions.parse_args()[source]#
unravel.coordinates.physical_points_add_regions.lookup_region_ids(atlas_img, voxel_coords)[source]#
unravel.coordinates.physical_points_add_regions.main()[source]#