direction_to_voxel_axis

bidsaid.metadata.direction_to_voxel_axis(nifti_file_or_img, anatomical_directions)[source]

Returns the voxel coordinate axis (and position) of a given anatomical direction.

Parameters

nifti_file_or_imgstr, Path, or Nifti1Image, default=None

Path to the NIfTI file or a NIfTI image.

anatomical_directionsIterable[str]

The anatomical directions.

Returns

tuple(str, int)

A tuple of the axis and its position (axis, position).

Example

Assuming image has RAS orientation >>> from bidsaid.simulate import simulate_nifti_image >>> nifti_img = simulate_nifti_image(img_shape=(5, 5, 5, 5)) >>> direction_to_voxel_axis(nifti_img, (“A”, “P”))

(“j”, 2)