Sisyphe.core.sisypheXml

External packages/modules

class Sisyphe.core.sisypheXml.AbstractXml(filename: str)

Description

Abstract ancestor class of XmlVolume, XmlRoi and XmlStreamlines classes. These classes provide direct access to the xml fields in PySisyphe Volume (.xvol), Roi (.xroi) and Streamlines (.xtracts) files.

Inheritance

object -> AbstractXml

Creation: 08/09/2022 Last revision: 16/12/2023

getFieldList() list[str]

Get field list in the current AbstractXml instance.

Returns

list[str]

list of field names

getFieldNodes(field: str) NodeList

Get field nodes in the current AbstractXml instance.

Parameters

fieldstr

field name

Returns

xml.dom.minicompat.NodeList

list of nodes

getFieldValues(field: str) str | list[str] | None

Get field value(s) in the current AbstractXml instance.

Parameters

fieldstr

field name

Returns

str | list[str]

field value(s)

hasField(field: str) bool

Check whether a field is in the current AbstractXml instance.

Parameters

fieldstr

field name

Returns

bool

True if field is defined

class Sisyphe.core.sisypheXml.XmlROI(filename: str)

Description

Class for accessing the xml fields of the PySisyphe ROI (.xroi).

Inheritance

object -> AbstractXml -> XmlROI

Creation: 08/09/2022 Last revision: 16/12/2023

getAlpha() int

Get int format opacity attribute of the current XmlROI instance.

Returns

int

Roi opacity, between 0 and 255

getColor() list[int]

Get int format color attribute of the current XmlROI instance.

Returns

list[int]

Roi color, red, green, blue components between 0 and 255

getFOV() list[float]

Get field of view attribute of the current XmlROI instance.

Returns

list[float]

Roi FOV in x, y and z axes

getFloatAlpha() float

Get float format opacity attribute of the current XmlROI instance.

Returns

float

Roi opacity between 0.0 and 1.0

getFloatColor() list[float]

Get float format color attribute of the current XmlROI instance.

Returns

list[float]

Roi color, red, green, blue components between 0.0 and 1.0

getID() str

Get reference ID attribute of the current XmlROI instance.

Returns

str

Roi ID

getName() str

Get name attribute of the current XmlROI instance.

Returns

str

Roi name

getQColor() QColor

Get QColor attribute of the current XmlROI instance.

Returns

PyQt5.QtGui.QColor

Roi color

getSize() list[int]

Get image size attribute of the current XmlROI instance.

Returns

list[int]

Roi size in x, y and z axes

getSpacing() list[float]

Get image spacing (i.e. voxel size in each dimension) attribute of the current XmlROI instance.

Returns

list[float]

Roi spacing in x, y and z axes

class Sisyphe.core.sisypheXml.XmlStreamlines(filename: str)

Description

Class for accessing the xml fields of the PySisyphe Streamlines (.xtracts).

Inheritance

object -> AbstractXml -> XmlStreamlines

Creation: 29/08/2024

getAffineTransform() ndarray

Get affine transform attribute of the current XmlStreamlines instance.

Returns

numpy.ndarray

Affine transform

getAlpha() int

Get int format opacity attribute of the current XmlStreamlines instance.

Returns

int

Streamlines opacity, between 0 and 255

getColor() list[int]

Get int format color attribute of the current XmlStreamlines instance.

Returns

list[int]

Streamlines color, red, green, blue components between 0 and 255

getFOV() list[float]

Get field of view attribute of the current XmlStreamlines instance.

Returns

list[float]

Streamlines FOV in x, y and z axes

getFloatAlpha() float

Get float format opacity attribute of the current XmlStreamlines instance.

Returns

float

Streamlines opacity between 0.0 and 1.0

getFloatColor() list[float]

Get float format color attribute of the current XmlStreamlines instance.

Returns

list[float]

Streamlines color, red, green, blue components between 0.0 and 1.0

getID() str

Get reference ID attribute of the current XmlStreamlines instance.

Returns

str

Streamlines ID

getLineWidth() float

Get line width attribute of the current XmlStreamlines instance.

Returns

float

Streamlines line width in mm

getLut() str

Get lut name attribute of the current XmlStreamlines instance.

Returns

str

Streamlines lut name

getName() str

Get name attribute of the current XmlStreamlines instance.

Returns

str

Streamlines name

getQColor() QColor

Get QColor attribute of the current XmlStreamlines instance.

Returns

PyQt5.QtGui.QColor

Streamlines color

getSize() list[int]

Get image size attribute of the current XmlStreamlines instance.

Returns

list[int]

Streamlines size in x, y and z axes

getSpacing() list[float]

Get image spacing (i.e. voxel size in each dimension) attribute of the current XmlStreamlines instance.

Returns

list[float]

Streamlines spacing in x, y and z axes

isAtlas() bool

Check whether streamlines of the current SisypheStreamlines instance are atlas streamlines.

Returns

bool

True if atlas streamlines

isCentroid() bool

Check whether the current SisypheStreamlines instance is a centroid streamline.

Returns

bool

True if centroid streamline

isRegularStep() bool

Check whether the streamlines of the current SisypheStreamlines instance are compressed.

By default, streamlines are uncompressed, with a regular step between points. Compression can be applied to streamlines i.e. a reduction in the number of points with non-uniform steps between points. The compression consists in merging consecutive segments that are nearly collinear. The merging is achieved by removing the point the two segments have in common. The linearization process ensures that every point being removed are within a certain margin of the resulting streamline.

Returns

bool

True, if not compressed with regular step between points.

isWhole() bool

Check whether streamlines of the current SisypheStreamlines instance have been generated from whole brain seeds.

Returns

bool

True if whole brain streamlines

class Sisyphe.core.sisypheXml.XmlVolume(filename: str)

Description

Class for accessing the xml fields of the PySisyphe volume (.xvol).

Inheritance

object -> AbstractXml -> XmlVolume

Creation: 08/09/2022 Last revision: 16/12/2023

getComponents() int

Get number of components attribute of the current XmlVolume instance.

Returns

int

number of components (1 for 3D volume, > 1 for 4D multi-components volume)

getDatatype() str

Get datatype attribute of the current XmlVolume instance.

Returns

str

numpy datatype format

getDateOfBirthdayAsDate() date

Get patient’s date of birth attribute of the current XmlVolume instance.

Returns

datetime.date

patient’s birthdate

getDateOfBirthdayAsString() str

Get patient’s date of birth attribute of the current XmlVolume instance.

Returns

str

patient’s birthdate

getDateOfScanAsDate() date

Get date of scan attribute of the current XmlVolume instance.

Returns

datetime.date

date of scan

getDateOfScanAsString() str

Get date of scan attribute of the current XmlVolume instance.

Returns

str

date of scan

getDirections() list[float]

Get directions attribute of the current XmlVolume instance. Direction vectors of image axes in RAS+ coordinates system.

PySisyphe uses RAS+ world coordinates system convention (as MNI, Nibabel, Dipy…) with origin to corner of the voxel

  • x, direction [1.0, 0.0, 0.0]: left(-) to right(+)

  • y, direction [0.0, 1.0, 0.0]: posterior(-) to anterior(+)

  • z: direction [0.0, 0.0, 1.0]: inferior(-) to superior(+)

Directions is a list of 9 float, 3 vectors of 3 floats

  • First vector, x-axis image direction, [1.0, 0.0, 0.0]

  • Second vector, y-axis image direction, [0.0, 1.0, 0.0]

  • Third vector, z-axis image direction, [0.0, 0.0, 1.0]

Returns

list[float]

volume directions

getFOV() list[float]

Get field of view attribute of the current XmlVolume instance.

Returns

list[float]

volume FOV in x, y and z axes

getFirstname() str

Get patient firstname of the current XmlVolume instance.

Returns

str

patient firstname

getFrame() int

Get frame attribute of the current XmlVolume instance.

Returns

str

frame (‘UNKNOWN’, ‘NO FRAME’, ‘LEKSELL’)

getGender() str

Get patient gender attribute of the current XmlVolume instance.

Returns

str

patient gender (‘Male’, ‘Female’, ‘Unknown’)

getID() str

Get ID attribute of the current XmlVolume instance.

Returns

str

Volume ID (space ID)

getIntercept() float

Get intercept attribute of the current XmlVolume instance. Used for linear transformation of scalar values displayed in the PySisyphe interface. displayed value = slope x scalar value + intercept

Returns

float

intercept attribute

getLastname() str

Get patient lastname attribute of the current XmlVolume instance.

Returns

str

patient lastname

getModality() str

Get modality attribute of the current XmlVolume instance.

Returns

str

modality

getNumberOfComponentsPerPixel() int

Get number of components attribute of the current XmlVolume instance.

Returns

int

number of components (1 for 3D volume, > 1 for 4D multi-components volume)

getOrientation() str

Get orientation attribute of the current XmlVolume instance.

Returns

str

‘axial’, ‘coronal’, ‘sagittal’

getOrigin() list[float]

Get origin coordinates (world reference) attribute of the current XmlVolume instance.

Returns

list[float]

origin coordinates of the volume

getRange() tuple[float, float]

Get minimum and maximum scalar values in the image array of the current XmlVolume instance.

Returns

tuple[float, float]

minimum and maximum scalar values in the image array

getRangeMax() float

Get maximum scalar value in the image array of the current XmlVolume instance.

Returns

float

maximum scalar value in the image array

getRangeMin() float

Get minimum scalar value in the image array of the current XmlVolume instance.

Returns

float

minimum scalar value in the image array

getRawName() str

Get array field value of the current XmlVolume instance.

Returns

str

‘self’ if array image is saved in a binary part of the xvol file (single format) or file name with raw extension if image array is saved in a separate file

getSequence() str

Get sequence attribute of the current XmlVolume instance.

Returns

str

sequence

getSize() list[int]

Get image size attribute of the current XmlVolume instance.

Returns

list[int]

volume size in x, y and z axes

getSlope() float

Get slope attribute of the current XmlVolume instance. Used for linear transformation of scalar values displayed in the PySisyphe interface. displayed value = slope x scalar value + intercept

Returns

float

slope attribute

getSpacing() list[float]

Get image spacing (i.e. voxel size in each dimension) attribute of the current XmlVolume instance.

Returns

list[float]

volume spacing in x, y and z axes

getUnit() str

Get unit attribute of the current XmlVolume instance.

Returns

str

unit

getWindow() tuple[float, float]

Get minimum and maximum windowing values of the current XmlVolume instance.

Returns

tuple[float, float]

minimum and maximum windowing values

getWindowMax() float

Get maximum windowing value of the current XmlVolume instance.

Returns

float

maximum windowing value

getWindowMin() float

Get minimum windowing value of the current XmlVolume instance.

Returns

float

minimum windowing value