afids_utils.transforms#

Methods for transforming between different coordinate systems

afids_utils.transforms.world_to_voxel(afid_world, nii_affine)#

Transform fiducials from world coordinates to voxel coordinates

Parameters:
  • afid_world (AfidPosition) – AfidPosition containing floating-point spatial coordinates (x, y, z) to transform

  • nii_affine (ndarray[Any, dtype[float64]]) – NumPy array containing affine transformation associated with NifTI image

Returns:

Object containing transformed integer voxel coordinates (i, j, k)

Return type:

AfidVoxel

afids_utils.transforms.voxel_to_world(afid_voxel, nii_affine)#

Transform fiducials from world coordinates to voxel coordinates

Parameters:
  • afid_voxel (AfidVoxel) – AfidVoxel containing integer voxel coordinates (i, j, k)

  • nii_affine (ndarray[Any, dtype[float64]]) – NumPy array containing affine transformation associated with NifTI image

Returns:

Object containing approximate floating-point spatial coordinates (x, y, z)

Return type:

AfidPosition

afids_utils.transforms.xfm_coord_system(afid_set, new_coord_system='LPS')#

Convert AFID set between RAS and LPS coordinates

Parameters:
  • afid_set (AfidSet) – Object containing valid AfidSet

  • new_coord_system (str) – Convert AFID set to defined coordinate system (default: ‘LPS’)

Returns:

Object containing AFIDs stored in defined coordinate system

Return type:

AfidSet

Raises:

ValueError – If invalid coordinate system