afids_utils.afids#

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

Base class for a set of AFIDs

Attributes:
afids
coord_system
slicer_version
Parameters:
  • slicer_version (str) –

  • coord_system (str) –

  • afids (list[AfidPosition]) –

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:

afid_position

Raises:

InvalidFiducialError – If AFID label given out of valid range