afids_utils.afids#

class afids_utils.afids.AfidPosition(*, label, x, y, z, desc)#

Base class for a single AFID position

Parameters:
  • label (int) – Unique label for AFID

  • x (float) – Spatial position along x-axis (in mm)

  • y (float) – Spatial position along y-axis (in mm)

  • z (float) – Spatial position along z-axis (in mm)

  • desc (str) – Description for AFID (e.g. AC, PC)

class afids_utils.afids.AfidVoxel(label, i, j, k, desc)#

Class for Afid voxel position

Parameters:
  • label (int) – Unique label for AFID

  • i (int) – Spatial position along i-axis

  • j (int) – Spatial position along j-axis

  • k (int) – Spatial position along k-axis

  • desc (str) – Description for AFID (e.g. AC, PC)

class afids_utils.afids.AfidSet(*, slicer_version, coord_system, afids)#

Base class for a set of AFIDs

Parameters:
  • slicer_version (str) – Version of Slicer associated with AfidSet

  • coord_system (str) – Coordinate system AFIDs are placed in (e.g. RAS)

  • afids (list[afids_utils.afids.AfidPosition]) – List of AFID labels and their coordinates

Methods

get_afid(label)

Extract a specific AFID's spatial coordinates

load(afids_fpath)

Load an AFIDs file

save(out_fpath)

Save AFIDs to Slicer-compatible file

classmethod load(afids_fpath)#

Load an AFIDs file

Parameters:

afids_fpath (PathLike[str] | str) – Path to .fcsv or .json file containing AFIDs information

Returns:

Set of anatomical fiducials containing coordinates and metadata

Return type:

AfidSet

Raises:
  • IOError – If extension to fiducial file is not supported

  • InvalidFileError – If fiducial file has none or more than expected number of fiducials

  • InvalidFiducialError – If description in fiducial file does not match expected

save(out_fpath)#

Save AFIDs to Slicer-compatible file

Parameters:

out_fpath (PathLike[str] | str) – Path of file (including filename and extension) to save AFIDs to

Raises:

ValueError – If file extension is not supported

Return type:

None

get_afid(label)#

Extract a specific AFID’s spatial coordinates

Parameters:

label (int) – Unique AFID label to extract from

Returns:

Spatial position of Afid (as class AfidPosition)

Return type:

AfidPosition

Raises:

InvalidFiducialError – If AFID label given out of valid range

class afids_utils.afids.AfidDistance(afid_position1, afid_position2)#

Class to store distances between two AfidPosition objects

Parameters:

Methods

get(component)

Return value of specified component

get(component)#

Return value of specified component

Parameters:

component (str) –

property AfidDistance.x#

Floating-point distance between AFIDs along x-axis

property AfidDistance.y#

Floating-point distance between AFIDs along y-axis

property AfidDistance.z#

Floating-point distance between AFIDs along z-axis

property AfidDistance.distance#

Floating-point distance between a pair of AFIDs

class afids_utils.afids.AfidDistanceSet(afid_set1, afid_set2)#

Class to store distances between a pair of valid AfidSet objects

Parameters:
property AfidDistanceSet.afids#

List of distances of corresponding AFIDs between the two AfidSet objects

Raises:

ValueError – If coordinate systems are mismatched between AfidSet objects