Sisyphe.core.sisypheFiducialBox

External packages/modules

class Sisyphe.core.sisypheFiducialBox.SisypheFiducialBox

Description

This class detects the Elekta Leksell frame’s fiducial markers. It computes a rigid transformation to calculate coordinates between the geometric Leksell reference and the image coordinates, and vice versa.

Inheritance

QObject -> SisypheFiducialBox

Creation: 26/07/2022 Last revision: 11/12/2023

ProgressTextChanged

Private attributes

_nbfid int, fiducials count (6 or 9) _fidtol float, distance tolerance of fiducial markers _fidlist dict, fiducial markers coordinates _errorlist dict, fiducial markers errors _errorstats dict, fiducial markers errors statistics _volume SisypheVolume _trf SisypheTransform

addTransformToVolume() None

Add the calculated geometric transformation to the Sisyphe.core.sisypheTransform.SisypheTransforms attribute of the processed volume.

calcErrors() None

Calculate errors i.e. euclidean distances between coordinates of the detected fiducial markers and their theoretical coordinates in mm.

calcTransform() None

Calculate rigid transformation between image and Leksell geometric reference.

execute(vol: SisypheVolume) None

Execute Leksell fiducial markers detection to calculate rigid transformation between image and Leksell geometric reference.

Parameters

volSisyphe.core.sisypheVolume.SisypheVolume

PySisyphe volume

getAllMarkers() dict[int, dict[int, list[float]]]

Get all fiducial markers coordinates.

Marker indexes (axial slice):
  • Left markers: 0 posterior, 1 middle, 2 anterior

  • right markers: 3 anterior, 4 middle, 5 posterior

  • anterior markers: 6 right, 7 middle, 8 left

Returns

dict[int, dict[int, list[float]]
  • key int, slice index

  • value dict[int, float]
    • key int, marker index (6 or 9 markers)

    • value list[float, float, float], list of x, y, z fiducial marker coordinates

getErrorStatistics() dict[str, float]

Get errors statistics.

Returns

dict[str, float]
str keys, float values
  • ‘Mean’ mean error

  • ‘RMS’ root-mean-square error

  • ‘Median’ median error

  • ‘Std’ standard deviation error

  • ‘25th’ first quantile error

  • ‘75th’ third quantile error

  • ‘Min’ minimum error

  • ‘Max’ maximum error

getErrors() dict[int, dict[int, float]] | None

Get errors i.e. euclidean distances between coordinates of the detected fiducial markers and their theoretical coordinates in mm.

Marker indexes (axial slice):
  • Left markers: 0 posterior, 1 middle, 2 anterior

  • right markers: 3 anterior, 4 middle, 5 posterior

  • anterior markers: 6 right, 7 middle, 8 left

Returns

dict[int, dict[int, float]],
  • key int, slice index

  • value dict[int, float]
    • key int, marker index (6 or 9 markers)

    • value float, euclidean distance error in mm

classmethod getFileExt() str

Get SisypheFiducialBox file extension.

Returns

str

‘.xfid’

classmethod getFilterExt() str

Get SisypheFiducialBox filter used by QFileDialog.getOpenFileName() and QFileDialog.getSaveFileName().

Returns

str

‘PySisyphe Fiducial markers (.xfid)’

getMarker(n: int, m: int) list[float]

Get coordinates of a fiducial marker.

Marker indexes (axial slice):
  • Left markers: 0 posterior, 1 middle, 2 anterior

  • right markers: 3 anterior, 4 middle, 5 posterior

  • anterior markers: 6 right, 7 middle, 8 left

Parameters

nint

slice index

mint

marker index

Returns

list[float]

x, y, z fiducial marker coordinates

getMarkersCount() int

Get fiducial markers count.

Two possible configurations:

  • 6: 3 to the left and 3 to the right

  • 9: 3 to the left, 3 to the right, 3 to the front (front markers are optional)

Marker indexes (axial slice):

  • Left markers: 0 posterior, 1 middle, 2 anterior

  • right markers: 3 anterior, 4 middle, 5 posterior

  • anterior markers: 6 right, 7 middle, 8 left

Returns

bool

True if slice index is valid (i.e. less than slice count)

getSliceMarkers(n: int) dict[int, list[float]]

Get coordinates of fiducial markers in a slice.

Marker indexes (axial slice):
  • Left markers: 0 posterior, 1 middle, 2 anterior

  • right markers: 3 anterior, 4 middle, 5 posterior

  • anterior markers: 6 right, 7 middle, 8 left

Parameters

nint

slice index

Returns

dict[int, list[float]]
  • key int, marker index

  • value list[float], x, y, z fiducial marker coordinates

getSliceNumbers() list[int]

Get list of valid slice indexes (i.e. slices with at least 6 or 9 fiducial markers depending on configuration).

Returns

list[int]

list of valid indexes

getTransform() SisypheTransform

Get rigid transformation between image and Leksell geometric reference.

Returns

Sisyphe.core.SisypheTransform.SisypheTransform

rigid transformation

getVolume() SisypheVolume

Get PySisyphe volume

Returns

Sisyphe.core.sisypheVolume.SisypheVolume

volume to process

hasErrors() bool

Checks whether errors are calculated.

Returns

bool

True if errors are calculated

hasSlice(n: int) bool

Check whether slice index is valid (i.e. it contains at least 6 or 9 fiducial markers depending on configuration).

Returns

bool

True if slice index is valid

hasTransform() bool

Checks whether rigid transformation between image and Leksell geometric reference is calculated.

Returns

bool

True if rigid transformation is calculated

hasVolume() bool

Check whether PySisyphe volume to process is available.

Returns

bool

True if PySisyphe volume is defined

hasXML(filename: str) bool

Check that fiducial markers coordinates file (.xfid) exists.

Parameters

filenamestr

file name, file extension is replaced by .xfid if necessary

Returns

bool

True if file name exists

isEmpty() bool

Check that fiduciary marker coordinates are calculated.

Returns

bool

True if fiduciary marker coordinates are calculated

loadFromXML(filename: str) None

Load fiducial markers coordinates file (.xfid).

Parameters

filenamestr

file name (.xfid)

markersSearch(vol: SisypheVolume, slc: int | None = None) bool

Leksell fiducial markers detection in a slice.

Parameters

volSisyphe.core.sisypheVolume.SisypheVolume

PySisyphe volume

slcint

slice index

Returns

bool

False if no frame or frame detection failed

removeFrontPlateMarkers() None

Remove front fiducial markers. Six markers configuration, 3 on the left and 3 on the right.

Marker indexes (axial slice):
  • Left markers: 0 posterior, 1 middle, 2 anterior

  • right markers: 3 anterior, 4 middle, 5 posterior

  • anterior markers: 6 right, 7 middle, 8 left

removeSliceMarkers(n: int) None

Removes all fiduciary markers from a slice.

Parameters

nint

slice index

saveToXML(filename: str) None

Save fiducial markers coordinates file (.xfid).

Parameters

filenamestr

file name (.xfid)

setVolume(v: SisypheVolume) None

Set PySisyphe volume to process.

Parameters

vSisyphe.core.sisypheVolume.SisypheVolume

volume to process