unravel.coordinates.points_to_sphere_masks module#

Use coords_points_to_sphere_masks or points_to_sphere_masks from UNRAVEL to create one binary sphere/ellipsoid mask per point in a CSV.

This is useful for generating local-neighborhood masks around transformed coordinates, e.g. MERFISH-space unit locations.

Input:
  • CSV with voxel coordinate columns

  • Reference image for output shape/header

Output:
  • One .nii.gz binary mask per input row

Note

  • Radius and voxel size must be in the same physical units, usually µm.

  • Coordinates are voxel/index coordinates, not physical coordinates.

  • For MERFISH-CCF, voxel size is often 10 10 200 µm.

Usage:#

points_to_sphere_masks

-i points_MERFISH.csv -ri resampled_annotation.nii.gz -x merfish_x -y merfish_y -z merfish_z -id voxel_label -r 100 -vx 10 10 200 -o unit_sphere_masks_MERFISH -v

unravel.coordinates.points_to_sphere_masks.parse_args()[source]#
unravel.coordinates.points_to_sphere_masks.parse_voxel_size(voxel_size)[source]#

Return voxel size as a length-3 numpy array.

unravel.coordinates.points_to_sphere_masks.sanitize_filename(text)[source]#

Make a safe filename component.

unravel.coordinates.points_to_sphere_masks.make_mask_name(row, row_index, id_col=None, name_cols=None, radius=None)[source]#

Create a filename stem for one point/mask.

unravel.coordinates.points_to_sphere_masks.sphere_mask_for_coord(shape, center, radius, voxel_size)[source]#

Create a binary physical-radius sphere/ellipsoid mask around a voxel coordinate.

unravel.coordinates.points_to_sphere_masks.main()[source]#