Sisyphe.core.sisypheTracts
External packages/modules
DIPY, MR diffusion image processing, https://www.dipy.org/
Numpy, scientific computing, https://numpy.org/
pandas, data structures and data analysis tools, https://pandas.pydata.org/
PyQt5, Qt GUI, https://www.riverbankcomputing.com/software/pyqt/
scipy, scientific computing, https://scipy.org/
vtk, visualization engine/3D rendering, https://vtk.org/
- class Sisyphe.core.sisypheTracts.SisypheBundle(s: int | list[int] | tuple[int, int, int] | None = None)
Description
Container of tracts (streamlines) indices in an associated SisypheStreamlines instance belonging to a bundle. The SisypheBundle instance is an attribute of the associated SisypheStreamlines instance.
Scope of methods:
set operators between SisypheBundle instances (union, intersection, difference, symmetric difference)
logic operators between SisypheBundle instances (and, or, xor)
addBundle and sub arithmetic operators between SisypheBundle instances
Color representation
RGB mode, colors derived from unit vector directed to next point of the tract
CMAP mode, colors derived from scalar values associated with points using the look-up table colormap
attribute - COLOR mode, solid color given by the color attribute
Color, used in COLOR mode
Look-up table colormap, used in CMAP mode
Line width
Visibility
Opacity
Inheritance
object -> SisypheBundle
Creation: 26/10/2023 Last revision: 10/04/2025
- appendTracts(tracts: int | list[int] | tuple[int]) None
Append element(s) (i.e. index of a tract (streamline) in the associated SisypheStreamlines instance) to the current SisypheBundle instance.
Parameters
- tractsint | list[int] | tuple[int, ]
tract indices in the associated SisypheStreamlines instance
- clear() None
Remove all the tract indices from the current SisypheBundle instance.
- copy() SisypheBundle
Copy the current SisypheBundle instance.
Returns
- SisypheBundle
bundle copy
- copyToList() list[int]
Copy the current SisypheBundle instance to a list.
Returns
- list[int]
list copy of bundle
- count() int
Get the number of tracts (streamlines) in the current SisypheBundle instance.
Returns
- int
number of tracts (streamlines)
- difference(other: SisypheBundle) None
Difference between the current SisypheBundle instance and a SisypheBundle instance given as parameter. The result replaces the current SisypheBundle instance.
Parameters
- otherSisypheBundle
second operand bundle for subtraction
- getColorRepresentation() int
Get the color representation attribute of the current SisypheBundle instance.
Returns
- int
- representation code:
0, RGB mode, colors derived from unit vector directed to next point of the tract (x-axis component in
red, y-axis component in green and z-axis component in blue). - 1, CMAP mode, colors derived from scalar values associated with points using the look-up table colormap attribute of the current instance. - 2, COLOR mode, solid color given by the color attribute of the current instance.
- getColorRepresentationAsString() str
Get the color representation attribute of the current SisypheBundle instance from a str.
Returns
- str
- representation code:
‘rgb’, RGB mode, colors derived from unit vector directed to next point of the tract (x-axis
component in red, y-axis component in green and z-axis component in blue). - ‘scalars’, CMAP mode, colors derived from scalar values associated with points using the look-up table colormap attribute of the current instance. - ‘color’, COLOR mode, solid color given by the color attribute of the current instance.
- getFloatColor() list[float] | tuple[float, float, float]
Get the color attribute of the current SisypheBundle instance. The color attribute is only used in COLOR mode representation (see setColorRepresentation() method).
Returns
- tuple[float, float, float] | list[float, float, float]
bundle color red, green, blue (each component between 0.0 and 1.0)
- getIntColor() list[int] | tuple[int, int, int]
Get the color attribute of the current SisypheBundle instance. The color attribute is only used in COLOR mode representation (see setColorRepresentation() method).
Returns
- tuple[int, int, int] | list[int, int, int]
bundle color red, green, blue (each component between 0 and 255)
- getLineWidth() float
Get the line width attribute of the current SisypheBundle instance in mm.
Returns
- float
line width in mm
- getList() list[int]
Get the list attribute of the current SisypheBundle instance container.
Returns
- list[int]
list copy of bundle
- getLut() SisypheLut
Get the look-up table colormap attribute of the current SisypheBundle instance. The look-up table colormap attribute is only used in CMAP mode representation (see setColorRepresentation() method).
Returns
- Sisyphe.core.sisypheLUT.SisypheLut
bundle lut
- getName() str
Get the name attribute of the current SisypheBundle instance.
Returns
- str
bundle name
- getOpacity() float
Get the opacity attribute of the current SisypheBundle instance.
Returns
- float
bundle opacity, between 0.0 (transparent) and 1.0 (opaque)
- getQColor() QColor
Get the color attribute of the current SisypheBundle instance. The color attribute is only used in COLOR mode representation (see setColorRepresentation() method).
Returns
- PyQt5.QtGui.QColor
bundle color
- hasName() bool
Check whether the name attribute of the current SisypheBundle instance is defined (not empty).
Returns
- bool
True if name attribute is defined
- intersection(other: SisypheBundle) None
Intersection between the current SisypheBundle instance and a SisypheBundle instance given as parameter. The result replaces the current SisypheBundle instance.
Parameters
- otherSisypheBundle
bundle used for intersection
- isColorRepresentation() bool
Check whether the color representation of the current bundle is in COLOR mode. The tracts have a solid color given by the color attribute.
Returns
- bool
True if color representation
- isEmpty() bool
Check whether the current SisypheBundle instance is empty (no tract).
Returns
- bool
True if bundle is empty
- isRGBRepresentation() bool
Check whether the color representation of the current bundle is in RGB mode. Colors are derived from unit vector directed to next point of the tract (x-axis component in red, y-axis component in green and z-axis component in blue).
Returns
- bool
True if RGB representation
- isScalarsRepresentation() bool
Check whether the color representation of the current bundle is in SCALARS mode. Colors are derived from scalar values associated with points using the look-up table colormap attribute.
Returns
- bool
True if scalars representation
- removeTracts(tracts: int | list[int] | tuple[int]) None
Remove element(s) (i.e. index of a tract (streamline) in the associated SisypheStreamlines instance) to the current SisypheBundle instance.
Parameters
- tractsint | list[int] | tuple[int, ]
tract indices in the associated SisypheStreamlines instance
- sameName(name: str | SisypheBundle) bool
Check whether the current SisypheBundle instance has the same name as the parameter.
Parameters
name : str | SisypheBundle
Returns
- bool
True if same name
- setColorRepresentation(v: int) None
Set the color representation attribute of the current SisypheBundle instance.
Parameters
- vint
- representation code:
0, RGB mode, colors derived from unit vector directed to next point of the tract (x-axis component in
red, y-axis component in green and z-axis component in blue). - 1, CMAP mode, colors derived from scalar values associated with points using the look-up table colormap attribute of the current instance. - 2, COLOR mode, solid color given by the color attribute of the current instance.
- setColorRepresentationAsString(v: str) None
Set the color representation attribute of the current SisypheBundle instance from a str.
Parameters
- vstr
- representation code:
‘rgb’, RGB mode, colors derived from unit vector directed to next point of the tract (x-axis
component in red, y-axis component in green and z-axis component in blue). - ‘scalars’, CMAP mode, colors derived from scalar values associated with points using the look-up table colormap attribute of the current instance. - ‘color’, COLOR mode, solid color given by the color attribute of the current instance.
- setColorRepresentationToColor() None
Set the color representation attribute of the current SisypheBundle instance to COLOR mode. The tracts have a solid color given by the color attribute.
- setColorRepresentationToRGB() None
Set the color representation attribute of the current SisypheBundle instance to RGB mode. Colors are derived from unit vector directed to next point of the tract (x-axis component in red, y-axis component in green and z-axis component in blue).
- setColorRepresentationToScalars() None
Set the color representation attribute of the current SisypheBundle instance to SCALARS mode. Colors are derived from scalar values associated with points using the look-up table colormap attribute.
- setFloatColor(c: list[float] | tuple[float, float, float]) None
Set the color attribute of the current SisypheBundle instance. The color attribute is only used in COLOR mode representation (see setColorRepresentation() method).
Parameters
- ctuple[float, float, float] | list[float, float, float]
bundle color red, green, blue (each component between 0.0 and 1.0)
- setIntColor(c: list[int] | tuple[int, int, int]) None
Set the color attribute of the current SisypheBundle instance. The color attribute is only used in COLOR mode representation (see setColorRepresentation() method).
Parameters
- ctuple[int, int, int] | list[int, int, int]
bundle color red, green, blue (each component between 0 and 255)
- setLineWidth(v: float) None
Set the line width attribute of the current SisypheBundle instance in mm.
Parameters
- vfloat
line width in mm
- setLut(lut: str | SisypheLut) None
Set the look-up table colormap attribute the current SisypheBundle instance. The look-up table colormap attribute is only used in CMAP mode representation (see setColorRepresentation() method).
Parameters
- lutstr | Sisyphe.core.SisypheLUT.SisypheLut
bundle lut
- setName(name: str) None
Set the name attribute of the current SisypheBundle instance.
Parameters
- namestr
bundle name
- setOpacity(v: float) None
Set the opacity attribute of the current SisypheBundle instance.
Parameters
- vfloat
bundle opacity, between 0.0 (transparent) and 1.0 (opaque)
- setQColor(c: QColor) None
Set the color attribute of the current SisypheBundle instance. The color attribute is only used in COLOR mode representation (see setColorRepresentation() method).
Parameters
c : PyQt5.QtGui.QColor
- symDifference(other: SisypheBundle) None
Symmetric difference between the current SisypheBundle instance and a SisypheBundle instance given as parameter. The result replaces the current SisypheBundle instance.
Parameters
- otherSisypheBundle
second operand bundle for Symmetric difference
- union(other: SisypheBundle) None
Union between the current SisypheBundle instance and a SisypheBundle instance given as parameter. The result replaces the current SisypheBundle instance.
Parameters
- otherSisypheBundle
bundle used for union
- class Sisyphe.core.sisypheTracts.SisypheBundleCollection
Description
Named list container of SisypheBundle instances with int index or str name key for addressing container elements.
Scope of methods:
container methods
set operator methods between SisypheBundle elements of the container (union, intersection, difference,
symmetric difference)
Inheritance
object -> SisypheBundleCollection
Creation: 26/10/2023 Last revision: 06/12/2023
- append(value: SisypheBundle) None
Append a SisypheBundle element in the current SisypheBundleCollection instance container.
Parameters
- valueSisypheBundle
bundle to append in the container
- clear() None
Remove all the SisypheBundle elements from the current SisypheBundleCollection instance.
- copy() SisypheBundleCollection
Copy the current SisypheBundleCollection instance container (Shallow copy of elements).
Returns
- SisypheBundleCollection
shallow copy of bundle
- copyToList() list[SisypheBundle]
Copy the current SisypheBundleCollection instance container to a list (Shallow copy of elements).
Returns
- list[SisypheBundle]
shallow copy of bundle to list
- count() int
Get the number of SisypheBundle elements in the current SisypheBundleCollection instance.
Returns
- int
number of SisypheBundle elements
- difference(names: list[str], newname: str) None
Difference of SisypheBundle elements of the current SisypheBundleCollection. Bundles are selected by their name attributes. The resulting SisyphusBundle is appended to the container.
Parameters
- nameslist[str, ]
list of bundle names
- newname :
name of the new bundle (difference result)
- getList() list[SisypheBundle]
Get the list attribute of the current SisypheBundleCollection instance container (Shallow copy of the elements).
Returns
- list[SisypheBundle]
shallow copy of bundle to list
- index(value: str | SisypheBundle) int
Index of a SisypheBundle element in the current SisypheBundleCollection instance container.
Parameters
- valuestr | SisypheBundle
bundle name or SisypheBundle
Returns
- int
index of bundle in the container
- insert(key: int | str | SisypheBundle, value: SisypheBundle) None
Insert a SisypheBundle element at the position given by the key in the current SisypheBundleCollection instance container.
Parameters
- keyint | str | SisypheBundle | None
index or bundle name or SisypheBundle
- valueSisypheBundle
bundle to insert in the container
- intersection(names: list[str], newname: str) None
Intersection of SisypheBundle elements of the current SisypheBundleCollection. Bundles are selected by their name attributes. The resulting SisyphusBundle is appended to the container.
Parameters
- nameslist[str, ]
list of bundle names
- newname :
name of the new bundle (intersection result)
- isEmpty() bool
Check whether the current SisypheBundleCollection instance is empty (no bundle).
Returns
- bool
True if container is empty
- keys() list[str]
Get the list of keys in the current SisypheBundleCollection instance container.
Returns
- list[str]
list of keys in the container
- pop(key: int | str | SisypheBundle | None = None) SisypheBundle
Remove a SisypheBundle elements from the current SisypheBundleCollection instance and return it. If key is None, removes and returns the last element.
Parameters
- keyint | str | SisypheBundle | None
index or bundle name or SisypheBundle to remove
Returns
- SisypheBundle
bundle removed from the container
- remove(value: int | str | SisypheBundle) None
Remove a SisypheBundle element from the current SisypheBundleCollection instance.
Parameters
- valueint | str | SisypheBundle
index or bundle name or SisypheBundle instance to remove
- rename(old: str, new: str) None
Rename a bundle of the current SisypheBundleCollection instance container.
Parameters
- oldstr
Old bundle name
- newstr
New bundle name
- reverse() None
Reverses the order of the elements in the current SisypheBundleCollection instance container.
- symDifference(names: list[str], newname: str) None
Symmetric difference of SisypheBundle elements of the current SisypheBundleCollection. Bundles are selected by their name attributes. The resulting SisyphusBundle is appended to the container.
Parameters
- nameslist[str, ]
list of bundle names
- newname :
name of the new bundle (symmetric difference result)
- union(names: list[str], newname: str) None
Union of SisypheBundle elements of the current SisypheBundleCollection. Bundles are selected by their name attributes. The resulting SisypheBundle is appended to the container.
Parameters
- nameslist[str, ]
list of bundle names
- newname :
name of the new bundle (union result)
- class Sisyphe.core.sisypheTracts.SisypheDKIModel(algfit: str = 'WLS')
Description
Class to manage diffusion kurtosis model.
Methods to calculate diffusion derived maps (mean diffusivity, fractional anisotropy…).
Inheritance
object -> SisypheDiffusionModel -> SisypheDkIDModel
Creation: 29/10/2023 Last revision: 21/03/2024
- computeFitting(algfit: str = '', wait: DialogWait | None = None) None
Estimate the diffusion model of the current SisypheDKIModel instance.
Parameters
- algfitstr
- fitting algorithm:
‘WLS’ weighted least squares
‘OLS’ ordinary least squares
‘CLS’ constrained ordinary least squares
‘CWLS’ constrained weighted least squares
if is empty, uses fitting algorithm attribute
- wait: Sisyphe.gui.dialogWait.DialogWait | None
progress bar dialog (optional)
- createXML(doc: Document) None
Write the current SisypheDKIModel instance attributes to xml instance. This method is called by save() method, it is not recommended for use.
Parameters
- docminidom.Document
xml document
- getAxialDiffusivity() SisypheVolume
Calculate Axial Diffusivity (AD) map.
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
AD map
- getFA() SisypheVolume
Calculate Fractional Anisotropy (FA) map.
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
FA map
- getFitAlgorithm() str
Get the fitting algorithm attribute of the current SisypheDKIModel instance.
Returns
- str
- fitting algorithm:
‘WLS’ weighted least squares
‘OLS’ ordinary least squares
‘CLS’ constrained ordinary least squares
‘CWLS’ constrained weighted least squares
- getGA() SisypheVolume
Calculate Geodesic Anisotropy (GA) map.
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
GA map
- getMD() SisypheVolume
Calculate Mean Diffusivity (MD) map.
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
MD map
- getModel()
Get the model attribute of the current SisypheDiffusion instance.
Returns
- dipy.reconst.dki.DiffusionKurtosisModel
dipy DKI model
- getRadialDiffusivity() SisypheVolume
Calculate Radial Diffusivity (RD) map.
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
RD map
- getTrace() SisypheVolume
Calculate Tensor Trace map.
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
trace map
- classmethod openModel(filename: str, fit: bool = False, binary: bool = True, wait: DialogWait | None = None) SisypheDKIModel
Create a SisypheDKIModel instance from a PySisyphe Diffusion model (.xdmodel) file.
Parameters
- filenamestr
Diffusion model file name
- fitbool
compute model fitting (default False)
- binarybool
if True, binary part (DWI images, mask image, mean DWI image) is loaded (default True)
if False, only xml part is loaded
- wait: Sisyphe.gui.dialogWait.DialogWait | None
progress bar dialog (optional)
Returns
- SisypheDKIModel
loaded DKI model
- parseXML(doc: Document) dict
Read the current SisypheDKIModel instance attributes from xml instance. This method is called by load() method, it is not recommended for use.
Parameters
- docminidom.Document
xml document
Returns
- dict
- keys(str), values:
‘model’, str, ‘DKI’
‘dtype’, str, diffusion weighted images datatype
‘shape’, list[int, int, int], diffusion weighted images shape (image size in each dimension)
- setFitAlgorithm(algfit: str = 'WLS') None
Set the fitting algorithm attribute of the current SisypheDKIModel instance.
Parameters
- algfitstr
- fitting algorithm:
‘WLS’ weighted least squares
‘OLS’ ordinary least squares
‘CLS’ constrained ordinary least squares
‘CWLS’ constrained weighted least squares
- class Sisyphe.core.sisypheTracts.SisypheDSIDModel
Description
Class to manage diffusion spectrum imaging deconvolution model
Inheritance
object -> SisypheDiffusionModel -> SisypheDSIDModel
Creation: 29/10/2023 Last revision: 21/03/2024
- computeFitting(wait: DialogWait | None = None) None
Estimate the diffusion model of the current SisypheDSIDModel instance.
Parameters
- wait: Sisyphe.gui.dialogWait.DialogWait | None
progress bar dialog (optional)
- createXML(doc: Document) None
Write the current SisypheDSIDModel instance attributes to xml instance. This method is called by save() method, it is not recommended for use.
Parameters
- docminidom.Document
xml document
- getGFA() SisypheVolume
Calculate Generalized Fractional Anisotropy (GFA) map.
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
GFA map
- getModel()
Get the model attribute of the current SisypheDiffusion instance.
Returns
- dipy.reconst.dsi.DiffusionSpectrumDeconvModel
dipy DSID model
- classmethod openModel(filename: str, fit: bool = False, binary: bool = True, wait: DialogWait | None = None) SisypheDSIDModel
Create a SisypheDSIDModel instance from a PySisyphe Diffusion model (.xdmodel) file.
Parameters
- filenamestr
Diffusion model file name
- fitbool
compute model fitting (default False)
- binarybool
if True, binary part (DWI images, mask image, mean DWI image) is loaded (default True)
if False, only xml part is loaded
- wait: Sisyphe.gui.dialogWait.DialogWait | None
progress bar dialog (optional)
Returns
- SisypheDSIModel
loaded DSID model
- parseXML(doc: Document) dict
Read the current SisypheDSIDModel instance attributes from xml instance. This method is called by load() method, it is not recommended for use.
Parameters
- docminidom.Document
xml document
Returns
- dict
- keys(str), values:
‘model’, str, ‘DSID’
‘dtype’, str, diffusion weighted images datatype
‘shape’, list[int, int, int], diffusion weighted images shape (image size in each dimension)
- class Sisyphe.core.sisypheTracts.SisypheDSIModel
Description
Class to manage diffusion spectrum imaging model
Inheritance
object -> SisypheDiffusionModel -> SisypheDSIModel
Creation: 29/10/2023 Last revision: 21/03/2024
- computeFitting(wait: DialogWait | None = None) None
Estimate the diffusion model of the current SisypheDSIModel instance.
Parameters
- wait: Sisyphe.gui.dialogWait.DialogWait | None
progress bar dialog (optional)
- createXML(doc: Document) None
Write the current SisypheDSIModel instance attributes to xml instance. This method is called by save() method, it is not recommended for use.
Parameters
- docminidom.Document
xml document
- getGFA() SisypheVolume
Calculate Generalized Fractional Anisotropy (GFA) map.
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
GFA map
- getModel()
Get the model attribute of the current SisypheDiffusion instance.
Returns
- dipy.reconst.dsi.DiffusionSpectrumModel
dipy DSI model
- classmethod openModel(filename: str, fit: bool = False, binary: bool = True, wait: DialogWait | None = None) SisypheDSIModel
Create a SisypheDSIModel instance from a PySisyphe Diffusion model (.xdmodel) file.
Parameters
- filenamestr
Diffusion model file name
- fitbool
compute model fitting (default False)
- binarybool
if True, binary part (DWI images, mask image, mean DWI image) is loaded (default True)
if False, only xml part is loaded
- wait: Sisyphe.gui.dialogWait.DialogWait | None
progress bar dialog (optional)
Returns
- SisypheDSIModel
loaded DSI model
- parseXML(doc: Document) dict
Read the current SisypheDSIModel instance attributes from xml instance. This method is called by load() method, it is not recommended for use.
Parameters
- docminidom.Document
xml document
Returns
- dict
- keys(str), values:
‘model’, str, ‘DSI’
‘dtype’, str, diffusion weighted images datatype
‘shape’, list[int, int, int], diffusion weighted images shape (image size in each dimension)
- class Sisyphe.core.sisypheTracts.SisypheDTIModel(algfit: str = 'WLS')
Description
Class to manage diffusion tensor imaging model.
Methods to calculate diffusion derived maps (mean diffusivity, fractional anisotropy…).
Inheritance
object -> SisypheDiffusionModel -> SisypheDTIModel
Creation: 27/10/2023 Last revision: 21/03/2024
- computeFitting(algfit: str = '', wait: DialogWait | None = None) None
Estimate the diffusion model of the current SisypheDTIModel instance.
Parameters
- algfitstr
- fitting algorithm:
‘WLS’ weighted least squares
‘OLS’ ordinary least squares
‘NLLS’ non-linear least squares
‘RT’ restore robust tensor
if is empty, uses fitting algorithm attribute
- wait: Sisyphe.gui.dialogWait.DialogWait | None
progress bar dialog (optional)
- createXML(doc: Document) None
Write the current SisypheDTIModel instance attributes to xml instance. This method is called by save() method, it is not recommended for use.
Parameters
- docminidom.Document
xml document
- getAxialDiffusivity() SisypheVolume
Calculate Axial Diffusivity (AD) map.
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
AD map
- getDeviatropic() ndarray
Calculate Deviatropic Diffusivity.
Returns
- numpy.ndarray
deviatropic Diffusivity
- getFA() SisypheVolume
Calculate Fractional Anisotropy (FA) map.
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
FA map
- getFitAlgorithm() str
Get the fitting algorithm attribute of the current SisypheDTIModel instance.
Returns
- str
- fitting algorithm:
‘WLS’ weighted least squares
‘OLS’ ordinary least squares
‘NLLS’ non-linear least squares
‘RT’ restore robust tensor
- getGA() SisypheVolume
Calculate Geodesic Anisotropy (GA) map.
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
GA map
- getIsotropic() ndarray
Calculate Isotropic Diffusivity.
Returns
- numpy.ndarray
isotropic Diffusivity
- getMD() SisypheVolume
Calculate Mean Diffusivity (MD) map.
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
MD map
- getModel()
Get the model attribute of the current SisypheDiffusion instance.
Returns
- dipy.reconst.dti.TensorModel
dipy DTI model
- getRadialDiffusivity() SisypheVolume
Calculate Radial Diffusivity (RD) map.
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
RD map
- getTrace() SisypheVolume
Calculate Tensor Trace map.
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
Trace map
- classmethod openModel(filename: str, fit: bool = False, binary: bool = True, wait: DialogWait | None = None) SisypheDTIModel
Create a SisypheDTIModel instance from a PySisyphe Diffusion model (.xdmodel) file.
Parameters
- filenamestr
Diffusion model file name
- fitbool
compute model fitting (default False)
- binarybool
if True, binary part (DWI images, mask image, mean DWI image) is loaded (default True)
if False, only xml part is loaded
- wait: Sisyphe.gui.dialogWait.DialogWait | None
progress bar dialog (optional)
Returns
- SisypheDiffusionModel
loaded diffusion model
- parseXML(doc: Document) dict
Read the current SisypheDTIModel instance attributes from xml instance. This method is called by load() method, it is not recommended for use.
Parameters
- docminidom.Document
xml document
Returns
- dict
- keys(str), values:
‘model’, str, ‘DTI’
‘dtype’, str, diffusion weighted images datatype
‘shape’, list[int, int, int], diffusion weighted images shape (image size in each dimension)
- class Sisyphe.core.sisypheTracts.SisypheDiffusionModel
Description
Abstract class for diffusion models.
Scope of methods:
gradient values and vectors management
diffusion weighted images management
IO methods
Inheritance
object -> SisypheDiffusionModel
Creation: 27/10/2023 Last revisions: 08/04/2025
- calcMask(algo: str = 'huang', niter: int = 2, kernel: int = 1)
Calculate brain mask of the current SisypheDiffusionModel instance.
Parameters
- algostr
brain mask parameter, algorithm used to estimate background threshold (default huang): ‘mean’, ‘otsu’, ‘huang’, ‘renyi’, ‘yen’, ‘li’, ‘shanbhag’, ‘triangle’, ‘intermodes’, ‘maximumentropy’, ‘kittler’, ‘isodata’, ‘moments’
- niterint
brain mask parameter, number of binary morphology iterations (default 2). No brain mask if 0.
- kernelint
brain mask parameter, kernel size of binary morphology operator (default 1). No brain mask if 0.
- clear() None
Clear attributes of the current SisypheDiffusionModel instance.
- computeFitting(wait: DialogWait | None = None) None
Abstract method, must be implemented in the derived classes. Estimating the diffusion model.
- count() int
Number of diffusion weighted images (diffusion values/vectors) in the current SisypheDiffusionModel instance.
Returns
int
- createXML(doc: Document) None
Write the current SisypheDiffusionModel instance attributes to xml instance. This method is called by save() method, it is not recommended for use.
Parameters
- docminidom.Document
xml document
- getDWI() ndarray
Get diffusion weighted images from the current SisypheDiffusionModel instance.
Returns
- numpy.ndarray
diffusion weighted images
- getDWIMean()
Get diffusion-weighted mean image from the current SisypheDiffusionModel instance.
Returns
- numpy.ndarray
diffusion weighted mean image
- getFOV(decimals: int | None = None) tuple[float, float, float]
Get the field of view (FOV) of the current SisypheDiffusionModel instance.
Parameters
- decimalsint | None
number of decimals used to round values, if None no round
Returns
- tuple[float, float, float]
field of view of diffusion-weighted images (mm)
- classmethod getFilterExt() str
Get SisypheDiffusionModel filter used by QFileDialog.getOpenFileName() and QFileDialog.getSaveFileName().
Returns
- str
‘PySisyphe Diffusion model (.xdmodel)’
- getFittedModel()
Get the estimated model attribute of the current SisypheDiffusion instance.
Returns
dipy.reconst.dti.TensorFit | dipy.reconst.dki.DiffusionKurtosisFit | dipy.reconst.shm.SphHarmFit | dipy.reconst.dsiDiffusionSpectrumFit | dipy.reconst.dsiDiffusionSpectrumDeconvFit
dipy estimated diffusion model
- getGradientTable() GradientTable
Get the gradient table attribute of the current SisypheDiffusion instance.
Returns
- dipy.core.gradients.GradientTable
gradient table
- getGradients() tuple[ndarray, ndarray]
Get gradient values/vectors attributes of the current SisypheDiffusionModel instance.
Returns
- tuple[ndarray, ndarray]
gradients b values numpy.ndarray, shape(n, 1)
gradient direction vectors numpy.ndarray, shape(n, 3)
- getMask() ndarray
Get the brain mask attribute of the current SisypheDiffusionModel instance.
Returns
- numpy.ndarray
brain mask
- getModel()
Get the model attribute of the current SisypheDiffusion instance.
Returns
dipy.reconst.dti.TensorModel | dipy.reconst.dki.DiffusionKurtosisModel | dipy.reconst.shm.CsaOdfModel | dipy.reconst.csdeconv.ConstrainedSphericalDeconvModel | dipy.reconst.dsi.DiffusionSpectrumModel | dipy.reconst.dsi.DiffusionSpectrumDeconvModel
dipy diffusion model
- getReferenceID()
Get reference ID attribute of the current SisypheDiffusionModel instance. By default, this ID is the array ID of the mean B0, which is calculated when diffusion-weighted images are added to the model using the loadDWI() or setDWI() method.
Returns
- str
reference ID
- getShape() tuple[int, int, int]
Get the diffusion weighted image shape of the current SisypheDiffusionModel instance.
Returns
- tuple[int, int, int]
diffusion weighted image shape
- getSpacing() list[float] | tuple[float, float, float]
Get the diffusion weighted images spacing of the current SisypheDiffusionModel instance.
Returns
- tuple[float, float, float]
diffusion weighted images spacing i.e. voxel size (mm) in each dimension
- hasDWI() bool
Check whether diffusion-weighted images are defined in the current SisypheDiffusionModel instance.
Returns
- bool
True if diffusion-weighted images are defined
- hasGradients() bool
Check whether gradient attributes of the current SisypheDiffusionModel instance are defined (not None).
Returns
- bool
True if gradients are defined
- hasReferenceID()
Check whether reference ID attribute of the current SisypheDiffusionModel instance is defined (not ‘’).
Returns
- bool
True if reference ID is defined
- isFitted() bool
Check whether the diffusion of the current SisypheDiffusionModel instance is estimated (fitted)
Returns
- bool
True if diffusion model is estimated
- loadDWI(filenames: list[str]) None
Load diffusion weighted images (Sisyphe.core.sisypheVolume.SisypheVolume) to the current SisypheDiffusionModel instance.
Parameters
- filenameslist[str]
list of PySisyphe Volumes (.xvol) file names
- loadGradients(bvalsfile: str, bvecsfile: str, lpstoras: bool = False) None
Load gradient values/vectors attributes of the current SisypheDiffusionModel instance from text or xml files.
Parameters
- bvalsfilestr
gradients b values file name
- bvecsfilestr
gradient direction vectors file name
- lpstorasbool
gradient reorientation if True, LPS+ (DICOM) to RAS+ conversion (flip x and y)
- loadMask(filename: str) None
Load brain mask to the current SisypheDiffusionModel instance.
Parameters
- filenamestr
brain mask file name
- loadModel(filename: str, binary: bool = True, wait: DialogWait | None = None) None
Load the current SisypheDiffusionModel instance from a PySisyphe diffusion model (.xdmodel) file.
Parameters
- filenamestr
PySisyphe diffusion model file name
- binarybool
if True, binary part (DWI images, mask image, mean DWI image) is loaded (default True)
if False, only xml part is loaded
- wait: Sisyphe.gui.dialogWait.DialogWait | None
progress bar dialog (optional)
- classmethod openModel(filename: str, fit: bool = False, binary: bool = True, wait: DialogWait | None = None) SisypheDiffusionModel
Create a SisypheDiffusionModel instance from a PySisyphe Diffusion model (.xdmodel) file.
Parameters
- filenamestr
Diffusion model file name
- fitbool
compute model fitting (default False)
- binarybool
if True, binary part (DWI images, mask image, mean DWI image) is loaded (default True)
if False, only xml part is loaded
- wait: Sisyphe.gui.dialogWait.DialogWait | None
progress bar dialog (optional)
Returns
- SisypheDiffusionModel
loaded diffusion model
- parseXML(doc: Document) dict
Read the current SisypheDiffusionModel instance attributes from xml instance. This method is called by load() method, it is not recommended for use.
Parameters
- docminidom.Document
xml document
Returns
- dict
- keys(str), values:
‘dtype’, str, diffusion weighted images datatype
‘shape’, list[int, int, int], diffusion weighted images shape (image size in each dimension)
- reorientGradients(trf: SisypheTransform) None
Apply a geometric transformation to gradient attributes of the current SisypheDiffusionModel instance.
Parameters
- trfSisyphe.core.sisypheTransform.SisypheTransform
geometric transformation
- saveModel(filename: str, wait: DialogWait | None = None) None
Save the current SisypheDiffusionModel instance to a PySisyphe diffusion model (.xdmodel) file.
Parameters
- filenamestr
PySisyphe diffusion model file name
- wait: Sisyphe.gui.dialogWait.DialogWait | None
progress bar dialog (optional)
- setDWI(vols: SisypheVolumeCollection) None
Set diffusion-weighted images to the current SisypheDiffusionModel instance.
Parameters
- volsSisypheVolumeCollection
diffusion weighted images container
- setDWIFromNumpy(dwi: ndarray, spacing: list[float] | tuple[float, float, float] | None = None) None
Set diffusion weighted images to the current SisypheDiffusionModel instance.
Parameters
- dwinumpy.ndarray
diffusion weighted images container
- spacinglist[float, float, float] | tuple[float, float, float]
voxel size (mm) in each dimension
- setGradients(bvals: ndarray, bvecs: ndarray, lpstoras: bool = False) None
Set gradient values/vectors attributes of the current SisypheDiffusionModel instance from numpy.ndarray.
Parameters
- bvalsnumpy.ndarray
gradients b values numpy.ndarray, shape(n, 1)
- bvecsnumpy.ndarray
gradient direction vectors numpy.ndarray, shape(n, 3)
- lpstorasbool
gradient reorientation if True, LPS+ (DICOM) to RAS+ orientation convention (flip x and y)
- setMask(mask: ndarray | SisypheROI | SisypheVolume) None
Set the brain mask attribute of the current SisypheDiffusionModel instance.
Parameters
- numpy.ndarray | Sisyphe.core.SisypheROI | Sisyphe.core.SisypheVolume
brain mask
- class Sisyphe.core.sisypheTracts.SisypheSHCSAModel(order: int = 6)
Description
Class to manage spherical harmonic model with constant solid angle reconstruction
Inheritance
object -> SisypheDiffusionModel -> SisypheSHCSAModel
Creation: 29/10/2023 Last revision: 21/03/2024
- computeFitting(order: int = 6, wait: DialogWait | None = None) None
Estimate the diffusion model of the current SisypheSHCSAModel instance.
Parameters
- orderint
spherical harmonic order of the model (default 6)
- wait: Sisyphe.gui.dialogWait.DialogWait | None
progress bar dialog (optional)
- createXML(doc: Document) None
Write the current SisypheSHCSAModel instance attributes to xml instance. This method is called by save() method, it is not recommended for use.
Parameters
- docminidom.Document
xml document
- getGFA() SisypheVolume
Calculate Generalized Fractional Anisotropy (GFA) map.
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
GFA map
- getModel()
Get the model attribute of the current SisypheDiffusion instance.
Returns
- dipy.reconst.shm.CsaOdfModel
dipy SHCSA model
- getOrder() int
Set the spherical harmonic order attribute of the current SisypheSHCSAModel instance.
Returns
- int
spherical harmonic order of the model (default 6)
- classmethod openModel(filename: str, fit: bool = False, binary: bool = True, wait: DialogWait | None = None) SisypheSHCSAModel
Create a SisypheSHCSAModel instance from a PySisyphe Diffusion model (.xdmodel) file.
Parameters
- filenamestr
Diffusion model file name
- fitbool
compute model fitting (default False)
- binarybool
if True, binary part (DWI images, mask image, mean DWI image) is loaded (default True)
if False, only xml part is loaded
- wait: Sisyphe.gui.dialogWait.DialogWait | None
progress bar dialog (optional)
Returns
- SisypheSHCSAModel
loaded SHCSA model
- parseXML(doc: Document) dict
Read the current SisypheSHCSAModel instance attributes from xml instance. This method is called by load() method, it is not recommended for use.
Parameters
- docminidom.Document
xml document
Returns
- dict
- keys(str), values:
‘model’, str, ‘SHCSA’
‘dtype’, str, diffusion weighted images datatype
‘shape’, list[int, int, int], diffusion weighted images shape (image size in each dimension)
- class Sisyphe.core.sisypheTracts.SisypheSHCSDModel(order: int = 6)
Description
Class to manage constrained spherical harmonic deconvolution model
Inheritance
object -> SisypheDiffusionModel -> SisypheSHCSDModel
Creation: 29/10/2023 Last revision: 21/03/2024
- computeFitting(order: int = 0, wait: DialogWait | None = None) None
Estimate the diffusion model of the current SisypheSHCSDModel instance.
Parameters
- orderint
spherical harmonic order of the model (default 6)
- wait: Sisyphe.gui.dialogWait.DialogWait | None
progress bar dialog (default None)
- createXML(doc: Document) None
Write the current SisypheSHCSDModel instance attributes to xml instance. This method is called by save() method, it is not recommended for use.
Parameters
- docminidom.Document
xml document
- getFA() SisypheVolume
Calculate Generalized Fractional Anisotropy (GFA) map.
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
GFA map
- getGFA() SisypheVolume
Calculate Generalized Fractional Anisotropy (GFA) map.
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
GFA map
- getModel()
Get the model attribute of the current SisypheDiffusion instance.
Returns
- dipy.reconst.csdeconv.ConstrainedSphericalDeconvModel
dipy SHCSD model
- getOrder() int
Set the spherical harmonic order attribute of the current SisypheSHCSDModel instance.
Returns
- int
spherical harmonic order of the model (default 6)
- classmethod openModel(filename: str, fit: bool = False, binary: bool = True, wait: DialogWait | None = None) SisypheSHCSDModel
Create a SisypheSHCSDModel instance from a PySisyphe Diffusion model (.xdmodel) file.
Parameters
- filenamestr
Diffusion model file name
- fitbool
compute model fitting (default False)
- binarybool
if True, binary part (DWI images, mask image, mean DWI image) is loaded (default True)
if False, only xml part is loaded
- wait: Sisyphe.gui.dialogWait.DialogWait | None
progress bar dialog (optional)
Returns
- SisypheSHCSDModel
loaded SHCSD model
- parseXML(doc: Document) dict
Read the current SisypheSHCSDModel instance attributes from xml instance. This method is called by load() method, it is not recommended for use.
Parameters
- docminidom.Document
xml document
Returns
- dict
- keys(str), values:
‘model’, str, ‘SHCSD’
‘dtype’, str, diffusion weighted images datatype
‘shape’, list[int, int, int], diffusion weighted images shape (image size in each dimension)
- class Sisyphe.core.sisypheTracts.SisypheStreamlines(sl: ArraySequence | ndarray | None = None, compress=False)
Description
Class to manage a list of streamlines. A streamline is represented as a numpy ndarray of size (n×3) where each row of the array represent a 3D point of the streamline. A set of streamlines is represented with a list of numpy ndarray of size (Ni×3) for i=1:M where M is the number of streamlines in the set.
This class has a SisypheBundleCollection private attribute to classify the streamlines in bundles. It is used by all methods that process bundles.
Attributes:
reference ID, space ID of the diffusion weighted images used for the tracking process
shape and spacing of the diffusion-weighted images used for the tracking process
file name, file name used to save the current instance
display attributes (color representation mode, color, look-up table colormap, line width, opacity)
Scope of methods:
container-like methods
tract feature methods (length, curvature, center of mass, principal direction, distances…)
bundle feature methods
bundle selection and clustering methods (virtual dissection)
bundle conversion to ROI and Mesh
maps processing (density, path length, connectivity)
IO methods to and from Tck, Trk, Vtk, Vtp, Fib, Dpy and numpy formats
Inheritance
object -> SisypheStreamlines
Creation: 26/10/2023 Last Revision: 14/04/2025
- addBundleToSisypheTractCollection(tracts: SisypheTractCollection, bundle: str = 'all')
Add streamlines of a bundle in the current SisypheStreamlines instance to a SisypheTractCollection instance.
Parameters
- tractsSisypheTractCollection
tracts to add to bundle
- bundlestr
bundle name or ‘all’ for all streamlines
- append(sl: ndarray | ArraySequence, bundlename: str = '') None
Append streamlines to the current SisypheStreamlines instance.
Parameters
- slnumpy.ndarray | dipy.tracking.Streamlines
streamline(s) to append
- bundlenamestr
Create a new bundle with appended streamlines
- applyAtlasTransformToStreamlines(inplace: bool = False) SisypheStreamlines | None
Resampling of streamlines from the current SisypheStreamlines instance into atlas space.
Parameters
- inplacebool
if True, replace streamlines of the current SisypheStreamlines instance with resampled ones
Returns
- SisypheStreamlines | None
resampled streamlines
- applyTransformToStreamlines(trf: SisypheTransform, inplace: bool = False) SisypheStreamlines | None
Apply a geometric transformations to the streamlines of the current SisypheStreamlines instance.
Parameters
- trfSisyphe.core.sisypheTransform.SisypheTransform
geometric transformation
- inplacebool
if True, replace streamlines of the current SisypheStreamlines instance with resampled ones
Returns
- SisypheStreamlines | None
resampled streamlines
- atlasRegistration()
Calculate affine transformation between whole-brain atlas tractogram and tractogram of the current instance. This transformation is stored in affine attribute (affine transformation from HCP ICBM152 space to current space).
- bundleCentersOfMass(bundle: str = 'all') list[list[float] | tuple[float, float, float]]
Get the streamlines centers of mass in a bundle of the current SisypheStreamlines instance.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- list[list[float, float, float]
streamline centers of mass
- bundleCentroidDistanceSelection(centroid: ndarray, subsample: int = 12, dist: str = 'mam', threshold: float = 10.0, bundle: str = 'all') SisypheBundle
Create a new bundle with streamlines of a bundle selected by a distance to centroid threshold.
Parameters
- centroidndarray
centroid streamline used as reference to select streamlines
- subsampleint
number of points that are considered for each streamline in the calculation. To save on calculation time, each streamline is subsampled (default 12 points)
- diststr
‘mam’ mean average minimum distance
‘mdf’ average pointwise euclidean distance
- thresholdfloat
dist parameter threshold (default 10.0 mm)
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- SisypheBundle
bundle with indices of streamlines selected
- bundleClusterConfidence(mdf: int = 5, power: int = 1, subsample: int = 12, bundle: str = 'all') ndarray
Computes the cluster confidence index (cci), which is an estimation of the support a set of streamlines gives to a particular pathway. The cci provides a voting system where by each streamline (within a set tolerance) gets to vote on how much support it lends to. Outlier pathways score relatively low on cci, since they do not have many streamlines voting for them. These outliers can be removed by thresholding on the cci metric.
Parameters
- mdfint
maximum MDF distance (mm) that will be considered a ‘supporting’ streamline and included in cci calculation (default 5 mm)
- subsampleint
number of points that are considered for each streamline in the calculation. To save on calculation time, each streamline is subsampled (default 12 points)
- powerint
power to which the MDF distance for each streamline will be raised to determine how much it contributes to the cci. High values of power make the contribution value degrade much faster. e.g., a streamline with 5 mm MDF similarity contributes 1/5 to the cci if power is 1, but only contributes 1/5^2 = 1/25 if power is 2 (default 1).
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- numpy.ndarray
cci
- bundleClusterConfidenceFiltering(mdf: int = 5, subsample: int = 12, power: int = 1, ccithreshold: float = 1.0, bundle: str = 'all') tuple[SisypheBundle, ndarray]
Create a new bundle with streamlines of a bundle selected by a clustering confidence algorithm. Computes the cluster confidence index (cci), which is an estimation of the support a set of streamlines gives to a particular pathway. The cci provides a voting system where by each streamline (within a set tolerance) gets to vote on how much support it lends to. Outlier pathways score relatively low on cci, since they do not have many streamlines voting for them. These outliers can be removed by thresholding on the cci metric.
Parameters
- mdfint
maximum MDF distance (mm) that will be considered a ‘supporting’ streamline and included in cci calculation (default 5 mm)
- subsampleint
number of points that are considered for each streamline in the calculation. To save on calculation time, each streamline is subsampled (default 12 points)
- powerint
power to which the MDF distance for each streamline will be raised to determine how much it contributes to the cci. High values of power make the contribution value degrade much faster. e.g., a streamline with 5 mm MDF similarity contributes 1/5 to the cci if power is 1, but only contributes 1/5^2 = 1/25 if power is 2 (default 1).
- ccithresholdfloat
cci threshold used to select streamlines
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- tuple[SisypheBundle, ndarray]
SisypheBundle, indices of streamlines with cci >= ccithreshold
ndarray, cci values
- bundleClusterConfidenceStatistics(mdf: int = 5, power: int = 1, subsample: int = 12, bundle: str = 'all') dict[slice(<class 'str'>, <class 'float'>, None)]
Get the descriptive statistics of streamline cluster confidence index in a bundle of the current SisypheStreamlines instance.
Parameters
- mdfint
maximum MDF distance (mm) that will be considered a ‘supporting’ streamline and included in cci calculation (default 5 mm)
- powerint
power to which the MDF distance for each streamline will be raised to determine how much it contributes to the cci. High values of power make the contribution value degrade much faster. e.g., a streamline with 5 mm MDF similarity contributes 1/5 to the cci if power is 1, but only contributes 1/5^2 = 1/25 if power is 2 (default 1).
- subsampleint
number of points that are considered for each streamline in the calculation. To save on calculation time, each streamline is subsampled (default 12 points)
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- dict[str: float]
- descriptive statistics of streamline mean curvatures, keys(str), values (float) :
‘min’, minimum
‘perc5’, 5th percentile
‘perc25’, first quartile
‘median’, median
‘perc75’, third quartile
‘perc95’, 95th percentile
‘max’, maximum
‘std’, standard deviation
‘mean’, mean
‘skewness’, skewness
‘kurtosis’, kurtosis
- bundleClustering(threshold: float | None = None, nbp: int = 12, metric: str = 'apd', minclustersize: int = 10, bundle: str = 'all') tuple[SisypheBundleCollection, list[SisypheStreamlines]]
Create a new bundle with streamlines of a bundle selected by a clustering algorithm.
Parameters
- thresholdfloat
maximum distance from a bundle for a streamline to be still considered as part of it. (Default 10 mm)
- nbpint
streamlines are subsampled, number of points per streamline
- metricstr
‘apd’ average pointwise euclidean distance (default)
‘cmd’ center of mass euclidean distance
‘mpd’ midpoint euclidean distance
‘lgh’ length
‘ang’ vector between endpoints
- minclustersizeint
minimum cluster size (number of streamlines, default 10)
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- tuple[SisypheBundleCollection, list[SisypheStreamlines]]
SisypheBundleCollection, clusters
list[SisypheStreamlines], centroid streamlines of clusters
- bundleCosineDistanceBetweenEndVectors(bundle: str = 'all') ndarray
Get the cosine distance between endpoint vectors of streamlines in a bundle of the current SisypheStreamlines instance. The cosine distance between two vector A and B is (A.B) / (||A||.||B||)
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- numpy.ndarray
cosine distance between endpoint vectors of streamlines
- bundleEuclideanDistanceBetweenEndPoints(bundle: str = 'all') ndarray
Get the euclidean distance between endpoint of streamlines in a bundle of the current SisypheStreamlines instance.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- numpy.ndarray
euclidean distance between endpoint vectors of streamlines
- bundleFastClustering(threshold: float = 10.0, minclustersize: int = 10, bundle: str = 'all') tuple[SisypheBundleCollection, list[SisypheStreamlines]]
Create a new bundle with streamlines of a bundle selected by a clustering algorithm (fast version).
Parameters
- thresholdfloat
maximum distance from a bundle for a streamline to be still considered as part of it. (Default 10 mm)
- minclustersizeint
minimum cluster size (number of streamlines, default 10)
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- tuple[SisypheBundleCollection, dipy.tracking.Streamlines]
SisypheBundleCollection, clusters
list[SisypheStreamlines], centroid streamlines of clusters
- bundleFromBundleModel(model: ArraySequence, threshold: float = 15.0, reduction: float = 10.0, pruning: float = 5.0, reductiondist: str = 'mam', pruningdist: str = 'mam', refine: bool = False, minlength: int = 50, bundle: str = 'all') SisypheBundle
Create a new bundle with streamlines of a bundle selected by a model.
Parameters
- modeldipy.tracking.Streamlines
streamlines used as model
- thresholdfloat
distance threshold in mm for clustering streamlines (default 15.0)
- reductionfloat
distance threshold in mm for bundle reduction (default 10.0)
- pruningfloat
distance threshold in mm for bundle pruning (default 5.0)
- reductiondiststr
‘mdf’ average pointwise euclidean distance
‘mam’ mean average minimum distance
- pruningdiststr
‘mdf’ average pointwise euclidean distance
‘mam’ mean average minimum distance
- refinebool
if True, two stage algorithm (recognize and refine), otherwise only recognize
- minlengthint
minimum streamline size
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- SisypheBundle
bundle with indices of streamlines selected by model
- bundleIntersectPlane(p: list[float] | tuple[float, float, float], planes: tuple[bool, bool, bool] | list[bool], include: bool = False, inplace: bool = False, bundle: str = 'all') SisypheBundle
Create a new bundle with streamlines that cross (or not) a plane. A streamline is included/excluded if one of its points crosses the x-axis plane. A streamline is included/excluded if one of its points crosses the y-axis plane. A streamline is included/excluded if one of its points crosses the z-axis plane.
Parameters
- ptuple[float, float, float] | list[float, float, float]
coordinates of plane center
- planestuple[int, int, int] | list[int, int, int]
first bool, x-axis inclusion/exclusion
second bool, y-axis inclusion/exclusion
third bool, z-axis, inclusion/exclusion
- includebool
True, streamlines that cross plane are included
False, streamlines that cross plane are excluded
- inplacebool
if True, the initial bundle of the current SisypheStreamlines instance is replaced (default False)
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- SisypheBundle
bundle with indices of streamlines that cross the sphere
- bundleIntersectSphere(p: list[float] | tuple[float, float, float], radius: float, include: bool = False, inplace: bool = False, bundle: str = 'all') SisypheBundle
Create a new bundle from streamlines of a bundle in the current SisypheStreamlines instance that cross a sphere.
Parameters
- ptuple[float, float, float] | list[float, float, float]
coordinates of sphere center
- radiusfloat
sphere radius in mm
- includebool
True for inclusion in sphere, otherwise exclusion from sphere (default False)
- inplacebool
if True, the initial bundle of the current SisypheStreamlines instance is replaced (default False)
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- SisypheBundle
bundle with indices of streamlines that cross the sphere
- bundleLengthStatistics(bundle: str = 'all') dict[slice(<class 'str'>, <class 'float'>, None)]
Get the descriptive statistics of streamline lengths in a bundle of the current SisypheStreamlines instance.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- dict[str: float]
- descriptive statistics of streamline lengths, keys(str), values (float) :
‘min’, minimum
‘perc5’, 5th percentile
‘perc25’, first quartile
‘median’, median
‘perc75’, third quartile
‘perc95’, 95th percentile
‘max’, maximum
‘std’, standard deviation
‘mean’, mean
‘skewness’, skewness
‘kurtosis’, kurtosis
- bundleLengths(bundle: str = 'all') ndarray
Get the lengths of streamlines in a bundle of the current SisypheStreamlines instance.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- numpy.ndarray
streamline lengths
- bundleMajorClusterCentroid(threshold: float = 10.0, bundle: str = 'all') ArraySequence
Get the major cluster centroid streamline of a bundle.
Parameters
- thresholdfloat
maximum distance from a bundle for a streamline to be still considered as part of it (Default 10 mm).
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- dipy.tracking.Streamlines
centroid streamlines
- bundleMeanCurvatureStatistics(bundle: str = 'all') dict[slice(<class 'str'>, <class 'float'>, None)]
Get the descriptive statistics of streamline mean curvatures in a bundle of the current SisypheStreamlines instance.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- dict[str: float]
- descriptive statistics of streamline mean curvatures, keys(str), values (float) :
‘min’, minimum
‘perc5’, 5th percentile
‘perc25’, first quartile
‘median’, median
‘perc75’, third quartile
‘perc95’, 95th percentile
‘max’, maximum
‘std’, standard deviation
‘mean’, mean
‘skewness’, skewness
‘kurtosis’, kurtosis
- bundleMeanCurvatures(bundle: str = 'all') ndarray
Get the mean curvatures of streamlines in a bundle of the current SisypheStreamlines instance.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- numpy.ndarray
streamline mean curvatures
- bundleRoiSelection(rois: SisypheROICollection, include: list[bool] | None = None, mode: str = 'any', tol: float | None = None, bundle: str = 'all') SisypheBundle
Create a new bundle with streamlines of a bundle selected by ROI(s). These ROI(s) are used to perform virtual dissection. A streamline is included if any (or all) streamline point is within tol from inclusion ROI. A streamline is excluded if any (or all) streamline point is within tol from exclusion ROI.
Parameters
- roisSisyphe.core.sisypheROI.SisypheROICollection
Container with ROIs (Sisyphe.core.sisypheROI.SisypheROI instances) used to select streamlines
- includelist[bool] | None
This list has the same number of elements as the ROI container. if list element is True, the ROI with the
same index is used as inclusion, otherwise the ROI is used as exclusion - if None, all ROIs are used as inclusion
- modestr
‘any’ : any streamline point is within tol from ROI (Default)
‘all’ : all streamline points are within tol from ROI
‘end’ : either of the end-points is within tol from ROI
- tolfloat | None
If any coordinate in the streamline is within this distance, in mm, from the center of any voxel in the
ROI, the filtering criterion is set to True for this streamline, otherwise False. - if None (Default) tol is the distance between the center of each voxel and the corner of the voxel
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- SisypheBundle
bundle with indices of streamlines selected by ROI(s)
- bundleScalarHistogramFromVolume(vol: SisypheVolume, bins: int = 10, bundle: str = 'all') ndarray
Get scalar values histogram in a Sisyphe.core.sisypheVolume.SisypheVolume instance along the streamlines in a bundle of the current SisypheStreamline instance.
Parameters
- volSisyphe.core.sisypheVolume.SisypheVolume
volume used to get scalars
- binsint
histogram bins (default 10)
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- numpy.ndarray
histogram
- bundleScalarStatisticsFromVolume(vol: SisypheVolume, bundle: str = 'all') dict[slice(<class 'str'>, <class 'float'>, None)]
Get descriptive statistics of scalar values in a Sisyphe.core.sisypheVolume.SisypheVolume instance along the streamlines in a bundle of the current SisypheStreamline instance.
Parameters
- volSisyphe.core.sisypheVolume.SisypheVolume
volume used to get scalars
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- dict[str: float]
- descriptive statistics dict, keys(str), values (float) :
‘min’, minimum
‘perc5’, 5th percentile
‘perc25’, first quartile
‘median’, median
‘perc75’, third quartile
‘perc95’, 95th percentile
‘max’, maximum
‘std’, standard deviation
‘mean’, mean
‘skewness’, skewness
‘kurtosis’, kurtosis
- bundleScalarsFromVolume(vol: SisypheVolume, bundle: str = 'all') list[ndarray]
Get scalar values in a Sisyphe.core.sisypheVolume.SisypheVolume instance along the streamlines in a bundle of the current SisypheStreamline instance.
Parameters
vol : Sisyphe.core.sisypheVolume.SisypheVolume bundle : str
bundle name or ‘all’ for all streamlines
Returns
- list[numpy.ndarray]
scalar values
- bundleStreamlinesLongerThan(bundle: str = 'all', l: float = 10.0) SisypheBundle
Create a new bundle with streamlines whose lengths are longer than a threshold.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
- lfloat
streamline length threshold in mm
Returns
- SisypheBundle
bundle with indices of streamlines selected by a lengths threshold
- bundleStreamlinesShorterThan(bundle: str = 'all', l: float = 10.0) SisypheBundle
Create a new bundle with streamlines whose lengths are shorter than a threshold.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
- lfloat
streamline length threshold in mm
Returns
- SisypheBundle
bundle with indices of streamlines selected by a lengths threshold
- bundleToConnectivityMatrix(vol: SisypheVolume, bundle: str = 'all') DataFrame
Calculate the connectivity matrix of a bundle in the current SisypheStreamlines instance. The connectivity matrix is a square matrix with as many columns (rows) as there are labels in a label volume. Each element corresponds to the number of streamlines that start and end at each pair of labels in the label volume.
Parameters
- volSisyphe.core.sisypheVolume.SisypheVolume
label volume, Sisyphe.core.sisypheVolume.SisypheVolume must a label volume
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- pandas.DataFrame
connectivity matrix
- bundleToDensityMap(bundle: str = 'all') SisypheVolume
Calculate the density map of a bundle in the current SisypheStreamlines instance. The scalar values of this map are the number of unique streamlines that pass through each voxel.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
density map
- bundleToMesh(threshold: int, perc: bool = False, fill: float = 1000.0, decimate: float = 1.0, clean: bool = False, smooth: str = 'sinc', niter: int = 10, factor: float = 0.1, algo: str = 'flying', largest: bool = False, bundle: str = 'all') SisypheMesh
Convert a bundle of the current SisypheStreamlines instance to a mesh (Sisyphe.core.sisypheMesh.SisypheMesh instance).
Parameters
- thresholdint
absolute streamline count per voxel (if perc is False)
percentile of streamline count per voxel distribution (if perc is True)
- percbool
absolute (default False) or percentile (True) Threshold
- fillfloat
identify and fill holes in mesh (default 1000.0)
- decimatefloat
mesh points reduction percentage (between 0.0 and 1.0, default 1.0)
- cleanbool
merge duplicate points, remove unused points and remove degenerate cells
- smoothstr
smoothing algorithm, ‘sinc’ or ‘laplacian’
- niterint
number of iterations of smoothing algorithm (default 20)
- factorfloat
lower values produce more smoothing (between 0.0 and 1.0)
if smooth == ‘sinc’, passband factor
if smooth == ‘laplacian’, relaxation factor
- algostr
isosurface algorithm, ‘contour’, ‘marching’ or ‘flying’ (default)
- largestbool
keep only the largest blob (default False)
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- Sisyphe.core.sisypheMesh.SisypheMesh
bundle mesh
- bundleToPathLengthMap(roi: SisypheROI, bundle: str = 'all') SisypheVolume
Calculate the path length map of a bundle in the current SisypheStreamlines instance. The scalar values of this map are the shortest path, along any streamline, between a reference roi and each voxel.
Parameters
- roiSisyphe.core.sisypheROI.SisypheROI
reference roi
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
path length map
- bundleToRoi(threshold: int = 10, perc: bool = False, bundle: str = 'all') SisypheROI
Convert a bundle of the current SisypheStreamlines instance to a ROI (Sisyphe.core.sisypheROI.SisypheROI instance).
Parameters
- thresholdint
absolute streamline count per voxel (if perc is False)
percentile of streamline count per voxel distribution (if perc is True)
- percbool
absolute (default False) or percentile (True) Threshold
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- Sisyphe.core.sisypheROI.SisypheROI
bundle roi
- changeStreamlinesSampling(factor: float, inplace: bool = False) SisypheStreamlines | None
Subsample streamlines of the current SisypheStreamlines instance. This method apply a reduction in the number of points.
Parameters
- factorfloat
reduction factor for the number of points (between 0.0 and 2.0)
- inplacebool
if True, replace streamlines of the current SisypheStreamlines instance with compressed ones
Returns
- SisypheStreamlines | None
resampled streamlines
- changeStreamlinesStepSize(step: float, inplace: bool = False) SisypheStreamlines | None
Change streamlines sampling of the current SisypheStreamlines instance. This method change the step size, in mm, between points.
Parameters
- stepfloat
step size between points in mm
- inplacebool
if True, replace streamlines of the current SisypheStreamlines instance with resampled ones
Returns
- SisypheStreamlines | None
resampled streamlines
- clearAffineAtlasTransformation() None
Clear affine attribute of the current SisypheStreamlines instance. Affine attribute = affine transformation from ICBM152 HCP space to current space.
- compressStreamlines(inplace: bool = False) SisypheStreamlines | None
Compress streamlines of the current SisypheStreamlines instance.
Parameters
- inplacebool
if True, replace streamlines of the current SisypheStreamlines instance with compressed ones
Returns
- SisypheStreamlines | None
compressed streamlines
- copyAttributesFrom(sl: SisypheStreamlines) None
Copy attributes from SisypheStreamlines parameter to current SisypheStreamlines instance.
Parameters
- sl: SisypheStreamlines
copy streamline attributes from sl
- copyAttributesTo(sl: SisypheStreamlines) None
Copy current SisypheStreamlines instance attributes to SisypheStreamlines parameter.
Parameters
- sl: SisypheStreamlines
copy streamline attributes to sl
- count() int
Get the number of streamline elements in the current SisypheStreamlines instance.
Returns
- int
number of streamline elements
- createXML(doc: Document, bundle: str) None
Write a bundle of the current SisypheStreamlines instance attributes to xml instance. This method is called by save() and saveAs() methods, it is not recommended for use.
Parameters
- docminidom.Document
xml document
- bundlestr
bundle name or ‘all’ for all streamlines
- getAffineAtlasTransformation() ndarray | None
Get affine attribute of the current SisypheStreamlines instance. Affine attribute = affine transformation from ICBM152 HCP space to current space.
- classmethod getAtlasBundleDirectory() str
Get atlas bundles directory (~/templates/BUNDLES)
Returns
- str
bundle model directory (~/templates/BUNDLES)
- classmethod getAtlasBundleFilenameFromName(name: str) str | None
Get atlas bundle filename from its name.
Parameters
- namestr
atlas bundle long name
Returns
- str | None
bundle filename
- classmethod getAtlasBundleFilenameFromShortName(short: str) str | None
Get atlas bundle filename from its short name.
Parameters
- shortstr
atlas bundle short name
Returns
- str | None
bundle filename
- classmethod getAtlasBundleNames(whole: bool = True) list[str]
Get names of atlas bundles.
Parameters
- wholebool
if False, whole brain tractogram is removed from the list
Returns
- str
names of atlas bundles
- classmethod getAtlasBundleShortNames(whole: bool = True) list[str]
Get short names of atlas bundles.
Parameters
- wholebool
if False, whole brain tractogram is removed from the list
Returns
- str
short names of atlas bundles
- getAtlasTransformation() ndarray | None
Get affine SisypheTransform of atlas coregistration.
Returns
- numpy.ndarray | None
affine geometric transformation
- getBundle(key: int | str) SisypheBundle
Get a SisypheBundle of the current SisypheStreamlines instance.
Returns
- SisypheBundle
bundle
- getBundles() SisypheBundleCollection
Get the SisypheBundleCollection attribute of the current SisypheStreamlines instance.
Returns
- SisypheBundleCollection
bundles collection
- getColorRepresentation(bundle: str = 'all') int
Get the bundle color representation attribute of the current SisypheStreamlines instance.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- int
- representation code:
0, RGB mode, colors derived from unit vector directed to next point of the streamline (x-axis
component in red, y-axis component in green and z-axis component in blue). - 1, CMAP mode, colors derived from scalar values associated with points using the look-up table colormap attribute of the current instance. - 2, COLOR mode, solid color given by the color attribute of the current instance.
- getColorRepresentationAsString(bundle: str = 'all') str
Get the bundle color representation attribute of the current SisypheStreamlines instance from a str.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- str
- representation code:
‘rgb’, RGB mode, colors derived from unit vector directed to next point of the streamline (x-axis
component in red, y-axis component in green and z-axis component in blue). - ‘scalars’, CMAP mode, colors derived from scalar values associated with points using the look-up table colormap attribute of the current instance. - ‘color’, COLOR mode, solid color given by the color attribute of the current instance.
- getDWIFOV(decimals: int | None = None) tuple[float, float, float]
Get the field of view (FOV) attribute of the current SisypheStreamlines instance. This is the spacing of the diffusion-weighted images used for the tracking process.
Parameters
- decimalsint | None
number of decimals used to round values, if None no round
Returns
- tuple[float, float, float]
field of view of diffusion-weighted images used to calculate streamlines
- getDWIShape()
Get the shape attribute of the current SisypheStreamlines instance. This is the shape of the diffusion-weighted images used for the tracking process.
Returns
- tuple[int, int, int] | list[int, int, int]
shape of the diffusion-weighted images used to calculate streamlines
- getDWISpacing()
Get the spacing attribute of the current SisypheStreamlines instance. This is the spacing of the diffusion-weighted images used for the tracking process.
Returns
- tuple[float, float, float] | list[float, float, float]
spacing of the diffusion-weighted images used to calculate streamlines
- classmethod getDefaultName() str
Get the default name of a SisypheStreamlines instance (name after initialization).
Returns
- str
default name
- getDirname() str
Get the path part of the file name attribute of the current SisypheStreamlines instance. This file name is the default name used by IO methods.
Returns
- str
default path
- getFilename(bundle: str = 'all') str
Get the bundle file name attribute of the current SisypheStreamlines instance. This file name is the default name used by IO methods.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- str
default bundle file name
- classmethod getFilterExt() str
Get SisypheStreamlines filter used by QFileDialog.getOpenFileName() and QFileDialog.getSaveFileName().
Returns
- str
‘PySisyphe Streamlines (.xtracts)’
- getFloatColor(bundle: str = 'all') list[float] | tuple[float, float, float]
Get the bundle color attribute of the current SisypheStreamlines instance. The color attribute is only used in COLOR mode representation (see setColorRepresentation() method).
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- tuple[float, float, float] | list[float, float, float]
bundle color red, green, blue (each component between 0.0 and 1.0)
- getIntColor(bundle: str = 'all') list[int] | tuple[int, int, int]
Get the bundle color attribute of the current SisypheStreamlines instance. The color attribute is only used in COLOR mode representation (see setColorRepresentation() method).
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- ctuple[int, int, int] | list[int, int, int]
bundle color red, green, blue (each component between 0 and 255)
- getLineWidth(bundle: str = 'all') float
Get the bundle line width attribute of the current SisypheStreamlines instance in mm.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- float
bundle line width in mm
- getLongestStreamlineIndex(bundle: str = 'all') int
Get index of the longest streamline in a bundle of the current SisypheStreamline instance.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- int
index of the longest streamline
- getLut(bundle: str = 'all') SisypheLut
Get the bundle look-up table colormap attribute of the current SisypheStreamlines instance. The look-up table colormap attribute is only used in CMAP mode representation (see setColorRepresentation() method).
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- Sisyphe.core.sisypheLUT.SisypheLut
bundle lut
- getName() str
Get the name attribute of the current SisypheStreamlines instance.
Returns
- str
streamlines name
- getOpacity(bundle: str = 'all') float
Get the bundle opacity attribute of the current SisypheStreamlines instance.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- float
bundle opacity, between 0.0 (transparent) and 1.0 (opaque)
- getQColor(bundle: str = 'all') QColor
Get the bundle color attribute of the current SisypheStreamlines instance. The color attribute is only used in COLOR mode representation (see setColorRepresentation() method).
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- cPyQt5.QtGui.QColor
bundle color
- getReferenceID() str
Get the reference ID attribute of the current SisypheStreamlines instance. This is the space ID of the diffusion weighted images used for the tracking process.
Returns
- str
ID
- classmethod getReferenceIDfromFile(filename: str) str
Get the reference ID attribute from xtracts file. This is the space ID of the diffusion weighted images used for the tracking process.
Returns
- str
ID
- getShortestStreamlineIndex(bundle: str = 'all') int
Get index of the shortest streamline in a bundle of the current SisypheStreamline instance.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- int
index of the shortest streamline
- getSisypheStreamlinesFromBundle(bundle: str = 'all') SisypheStreamlines
Get a new SisypheStreamlines from a bundle of the current SisypheStreamlines instance.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- SisypheStreamlines
streamlines of the bundle
- getSisypheStreamlinesLongerThan(bundle: str = 'all', l: float = 10.0) SisypheStreamlines | None
Get a new SisypheStreamlines from the streamlines of a bundle of the current SisypheStreamlines instance whose lengths are longer than a threshold.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
- lfloat
streamline length threshold in mm
Returns
- SisypheStreamlines | None
streamlines of a bundle longer than the threshold
- getSisypheStreamlinesShorterThan(bundle: str = 'all', l: float = 10.0) SisypheStreamlines | None
Get a new SisypheStreamlines from the streamlines of a bundle of the current SisypheStreamlines instance whose lengths are shorter than a threshold.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
- lfloat
streamline length threshold in mm
Returns
- SisypheStreamlines | None
streamlines of a bundle shorter than the threshold
- classmethod getStepSize(sl: SisypheStreamlines | ArraySequence | ndarray) tuple[bool, float]
Get whether step size of a streamline is regular.
Parameters
- slSisypheStreamlines | dipy.tracking.Streamlines | numpy.ndarray
streamlines to test
Returns
- tuple[bool, float]
True if regular step size, step size in mm (0.0 if non-regular step size)
- getStreamlineIndexesSortedByLength(bundle: str = 'all') list[int]
Get indices of streamlines sorted by length in a bundle of the current SisypheStreamline instance.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- list[int]
list of indices of streamlines sorted by length
- getStreamlines() ArraySequence
Get dipy.tracking.Streamlines of the current SisypheStreamlines instance.
Returns
- dipy.tracking.Streamlines
streamlines
- getStreamlinesFromBundle(bundle: str = 'all') ArraySequence
Get dipy.tracking.Streamlines from a bundle of the current SisypheStreamlines instance.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- dipy.tracking.Streamlines
streamlines of the bundle
- hasICBM152ReferenceID() bool
Check whether the reference ID attribute of the current SisypheStreamlines instance is ICBM152.
Returns
- bool
True if ID is ICBM152
- hasReferenceID() bool
Check whether the reference ID attribute of the current SisypheStreamlines instance is defined. This is the space ID of the diffusion weighted images used for the tracking process.
Returns
- bool
True if ID is defined
- hasRegularStep()
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.
- hasSRI24ReferenceID() bool
Check whether the reference ID attribute of the current SisypheStreamlines instance is SRI24.
Returns
- bool
True if ID is SRI24
- isAtlas() bool
Check whether streamlines of the current SisypheStreamlines instance are atlas streamlines.
Returns
- bool
True if atlas streamlines
- classmethod isAtlasBundleName(name: str) bool
Check whether name parameter is a valid atlas bundle name.
Parameters
- namestr
atlas bundle name
Returns
- bool
True if valid atlas bundle name
- classmethod isAtlasBundleShortName(short: str) bool
Check whether short name parameter is a valid atlas bundle short name.
Parameters
- shortstr
atlas bundle short name
Returns
- bool
True if valid atlas bundle short name
- isAtlasRegistered() bool
Check whether streamlines of the current SisypheStreamlines instance are coregistered with atlas.
Returns
- bool
True if affine transformation to atlas is not empty
- isCentroid() bool
Check whether streamline(s) of the current SisypheStreamlines instance is (are) centroid streamline(s).
Returns
- bool
True if centroid streamline(s)
- isColorRepresentation(bundle: str = 'all') bool
Check whether the bundle color representation of the current SisypheStreamlines instance is in COLOR mode. The bundle streamlines have a solid color given by the color attribute.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- bool
True if color representation
- isDefaultName() bool
Check whether the name attribute of the current SisypheStreamlines instance has a default value.
Returns
- bool
True if ‘all’ or ‘tractogram’
- isEmpty() bool
Check whether the current SisypheStreamlines instance is empy (no streamline).
Returns
- bool
True if empty
- isRGBRepresentation(bundle: str = 'all') bool
Check whether the bundle color representation of the current SisypheStreamlines instance is in RGB mode. Colors are derived from unit vector directed to next point of the streamline (x-axis component in red, y-axis component in green and z-axis component in blue).
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- bool
True if RGB representation
- isScalarsRepresentation(bundle: str = 'all') bool
Check whether the bundle color representation of the current SisypheStreamlines instance is in SCALARS mode. Colors are derived from scalar values associated with points using the look-up table colormap attribute.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
Returns
- bool
True if scalars representation
- isStreamlineIntersectSphere(index: int, p: list[float] | tuple[float, float, float], radius: float) bool
Check whether a streamline of the current SisypheStreamlines instance crosses a sphere.
Parameters
- indexint
streamline index in the current SisypheStreamlines instance container
- ptuple[float, float, float] | list[float, float, float]
coordinates of sphere center
- radiusfloat
sphere radius in mm
Returns
- bool
True if the streamline crosses the sphere
- isWholeBrainTractogram() bool
Check whether streamlines of the current SisypheStreamlines instance have been generated from whole brain seeds. Whole brain state is assumed if more than 50% brain mask voxels are used as seeds.
Returns
- bool
True if whole brain seeds
- load(filename: str) None
Load the current SisypheStreamlines instance from a PySisyphe Streamlines (.xtracts) file.
Parameters
- filenamestr
PySisyphe Streamlines file name
- loadAtlasBundle(name: str = 'WHOLE')
Load an atlas bundle.
Parameters
- namestr
atlas bundle name or short name
- loadFromDpy(filename: str) None
Load the current SisypheStreamlines instance from a dipy (.dpy) file.
Parameters
- filenamestr
dipy file name
- loadFromFib(filename: str) None
Load the current SisypheStreamlines instance from a FIB (.fib) file.
Parameters
- filenamestr
FIB file name
- loadFromNumpy(filename: str) None
Load the current SisypheStreamlines instance from a numpy (.npz) file.
Parameters
- filenamestr
numpy file name
- loadFromTck(filename: str) None
Load the current SisypheStreamlines instance from a TCK (.tck) file.
Parameters
- filenamestr
TCK file name
- loadFromTrk(filename: str) None
Load the current SisypheStreamlines instance from a TRK (.trk) file.
Parameters
- filenamestr
TRK file name
- loadFromVtk(filename: str) None
Load the current SisypheStreamlines instance from a VTK (.vtk) file.
Parameters
- filenamestr
VTK file name
- loadFromVtp(filename: str) None
Load the current SisypheStreamlines instance from a VTP (.vtp) file.
Parameters
- filenamestr
VTP file name
- minimumClosestDistanceBetweenStreamlines(index1: int, index2: int) float
Get the minimum distance between two streamlines of the current SisypheStreamline instance.
Parameters
- index1int
first streamline index in the current SisypheStreamline instance
- index2int
second streamline index in the current SisypheStreamline instance
Returns
- float
minimum distance between the two streamlines in mm
- classmethod openStreamlines(filename: str) SisypheStreamlines
Create a SisypheStreamlines instance from a PySisyphe streamlines file (.xtracts).
Parameters
- filenamestr
Diffusion model file name
Returns
- SisypheStreamlines
loaded streamlines
- parseXML(doc: Document) dict
Read a bundle of the current SisypheStreamline instance attributes from xml instance. This method is called by load() method, it is not recommended for use.
Parameters
- docminidom.Document
xml document
Returns
- dict
- keys(str), values:
‘name’, str, bundle name
‘color’, list[float, float, float], red, green, blue color components
‘lut’, str, lut name
‘opacity’, float
‘width’, float, line width in mm
‘offsets’, tuple[float, float], streamlines data size
‘dtypes’, streamlines data type
- renameBundle(old: str, new: str) None
Rename a SisypheBundle of the current SisypheStreamlines instance.
Parameters
- oldstr
Old bundle name
- newstr
New bundle name
- resampleAtlasBundle(bundle: str) SisypheStreamlines | None
Resampling of atlas streamlines into the current SisypheStreamlines instance space.
Parameters
- bundlestr
Atlas bundle name or short name
Returns
- SisypheStreamlines | None
resampled streamlines
- save(filename: str = '', bundle: str = 'all') None
Save a bundle of the current SisypheStreamlines instance to a PySisyphe Streamlines (.xtracts) file. If the filename parameter is empty, uses the file name attribute of the current SisypheStreamlines instance.
Parameters
- filenamestr
PySisyphe Streamlines file name
- bundlestr
bundle name or ‘all’ for all streamlines (default)
- saveToDpy(bundle: str = 'all') None
Save a bundle of the current SisypheStreamlines instance to a dipy (.dpy) file. Uses the file name attribute of the current SisypheStreamlines instance.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines (default)
- saveToFib(bundle: str = 'all') None
Save a bundle of the current SisypheStreamlines instance to a FIB (.fib) file. Uses the file name attribute of the current SisypheStreamlines instance.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines (default)
- saveToNumpy(bundle: str = 'all') None
Save a bundle of the current SisypheStreamlines instance to a numpy (.npz) file. Uses the file name attribute of the current SisypheStreamlines instance.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines (default)
- saveToTck(bundle: str = 'all') None
Save a bundle of the current SisypheStreamlines instance to a TCK (.tck) file. Uses the file name attribute of the current SisypheStreamlines instance.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines (default)
- saveToTrk(bundle: str = 'all') None
Save a bundle of the current SisypheStreamlines instance to a TRK (.trk) file. Uses the file name attribute of the current SisypheStreamlines instance.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines (default)
- saveToVtk(bundle: str = 'all') None
Save a bundle of the current SisypheStreamlines instance to a VTK (.vtk) file. Uses the file name attribute of the current SisypheStreamlines instance.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines (default)
- saveToVtp(bundle: str = 'all') None
Save a bundle of the current SisypheStreamlines instance to a VTP (.vtp) file. Uses the file name attribute of the current SisypheStreamlines instance.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines (default)
- setAtlasStatus(v) None
Set the atlas attribute of the current SisypheStreamlines instance. True if streamlines are atlas streamlines.
Parameters
- v: bool
atlas status of streamlines
- setAtlasTransformation(affine: ndarray) None
Set affine SisypheTransform of atlas coregistration.
Parameters
- affine: ndarray | None
affine geometric transformation
- setCentroidStatus(v) None
Set the centroid attribute of the current SisypheStreamlines instance. True if streamline(s) is (are) centroid streamline(s).
Parameters
- v: bool
centroid status of streamline(s)
- setColorRepresentation(v: int, bundle: str = 'all') None
Set the bundle color representation attribute of the current SisypheStreamlines instance.
Parameters
- vint
- representation code:
0, RGB mode, colors derived from unit vector directed to next point of the streamline (x-axis
component in red, y-axis component in green and z-axis component in blue). - 1, CMAP mode, colors derived from scalar values associated with points using the look-up table colormap attribute of the current instance. - 2, COLOR mode, solid color given by the color attribute of the current instance.
- bundlestr
bundle name or ‘all’ for all streamlines
- setColorRepresentationAsString(v: str, bundle: str = 'all') None
Set the bundle color representation attribute of the current SisypheStreamlines instance from a str.
Parameters
- vstr
- representation code:
‘rgb’, RGB mode, colors derived from unit vector directed to next point of the streamlineb(x-axis
component in red, y-axis component in green and z-axis component in blue). - ‘scalars’, CMAP mode, colors derived from scalar values associated with points using the look-up table colormap attribute of the current instance. - ‘color’, COLOR mode, solid color given by the color attribute of the current instance.
- bundlestr
bundle name or ‘all’ for all streamlines
- setColorRepresentationToColor(bundle: str = 'all') None
Set the bundle color representation attribute of the current SisypheStreamlines instance to COLOR mode. The bundle streamlines have a solid color given by the color attribute.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
- setColorRepresentationToRGB(bundle: str = 'all') None
Set the bundle color representation attribute of the current SisypheStreamlines instance to RGB mode. Colors are derived from unit vector directed to next point of the streamline (x-axis component in red, y-axis component in green and z-axis component in blue).
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
- setColorRepresentationToScalars(bundle: str = 'all') None
Set the bundle color representation attribute of the current SisypheStreamlines instance to SCALARS mode. Colors are derived from scalar values associated with points using the look-up table colormap attribute.
Parameters
- bundlestr
bundle name or ‘all’ for all streamlines
- setDWIShape(v: list[int] | tuple[int, int, int])
Set the shape attribute of the current SisypheStreamlines instance. This is the shape of the diffusion-weighted images used for the tracking process.
Parameters
- vtuple[int, int, int] | list[int, int, int]
shape of the diffusion-weighted images used to calculate streamlines
- setDWISpacing(v: list[float] | tuple[float, float, float])
Set the spacing attribute of the current SisypheStreamlines instance. This is the spacing of the diffusion-weighted images used for the tracking process.
Parameters
- vtuple[float, float, float] | list[float, float, float]
spacing of the diffusion-weighted images used to calculate streamlines
- setFloatColor(c: list[float] | tuple[float, float, float], bundle: str = 'all') None
Set the bundle color attribute of the current SisypheStreamlines instance. The color attribute is only used in COLOR mode representation (see setColorRepresentation() method).
Parameters
- ctuple[float, float, float] | list[float, float, float]
bundle color red, green, blue (each component between 0.0 and 1.0)
- bundlestr
bundle name or ‘all’ for all streamlines
- setIntColor(c: list[int] | tuple[int, int, int], bundle: str = 'all') None
Set the bundle color attribute of the current SisypheStreamlines instance. The color attribute is only used in COLOR mode representation (see setColorRepresentation() method).
Parameters
- ctuple[int, int, int] | list[int, int, int]
bundle color red, green, blue (each component between 0 and 255)
- bundlestr
bundle name or ‘all’ for all streamlines
- setLineWidth(v: float, bundle: str = 'all') None
Set the bundle line width attribute of the current SisypheStreamlines instance in mm.
Parameters
- vfloat
bundle line width in mm
- bundlestr
bundle name or ‘all’ for all streamlines
- setLut(lut: str | SisypheLut, bundle: str = 'all') None
Set the bundle look-up table colormap attribute the current SisypheStreamlines instance. The look-up table colormap attribute is only used in CMAP mode representation (see setColorRepresentation() method).
Parameters
- lutstr | Sisyphe.core.SisypheLUT.SisypheLut
look-up table colormap
- bundlestr
bundle name or ‘all’ for all streamlines
- setName(name: str = 'tractogram') None
Set the name attribute of the current SisypheStreamlines instance.
Parameters
- namestr
streamlines name
- setOpacity(v: float, bundle: str = 'all') None
Set the bundle opacity attribute of the current SisypheStreamlines instance.
Parameters
- vfloat
bundle opacity, between 0.0 (transparent) and 1.0 (opaque)
- bundlestr
bundle name or ‘all’ for all streamlines
- setQColor(c: QColor, bundle: str = 'all') None
Set the bundle color attribute of the current SisypheStreamlines instance. The color attribute is only used in COLOR mode representation (see setColorRepresentation() method).
Parameters
- cPyQt5.QtGui.QColor
bundle color
- bundlestr
bundle name or ‘all’ for all streamlines
- setReferenceID(ID: str | SisypheVolume | SisypheDiffusionModel | SisypheStreamlines) None
Set the reference ID attribute of the current SisypheStreamlines instance. This is the space ID of the diffusion-weighted images used for the tracking process. If the parameter is a SisypheVolume or SisypheDiffusionModel instance, this method also copies shape and spacing attributes to the current SisypheStreamlines instance.
Parameters
- IDstr | Sisyphe.core.sisypheVolume.SisypheVolume | SisypheDiffusionModel | SisypheStreamlines
reference ID
- setWholeBrainStatus(s: bool)
Set the whole brain attribute of the current SisypheStreamlines instance are atlas streamlines. Whole brain state is assumed if more than 50% brain mask voxels are used as seeds.
Parameters
- s: bool
Whole brain state
- setWholeBrainStatusFromMasks(brainmask: ndarray, seedmask: ndarray) float
Set the whole brain status of the seeds used to generate streamlines of the current SisypheStreamlines instance. Whole brain state is assumed if more than 50% brain mask voxels are used as seeds.
Parameters
- brainmasknumpy.ndarray
whole brain mask
- seedmasknumpy.ndarray
seeding voxels mask
Returns
- float
Ratio of brain mask voxels used as seeds
- streamlineCenterOfMass(index: int) list[float] | tuple[float, float, float]
Get the center of mass of a streamline of the current SisypheStreamlines instance.
Parameters
- indexint
streamline index in the current SisypheStreamlines instance container
Returns
- tuple[float, float, float]
center of mass of the streamline
- streamlineDistanceToMidPoint(index: int, p: list[float] | tuple[float, float, float]) float
Get the distance between of a point and the mid-point of a streamline of the current SisypheStreamlines instance.
Parameters
- indexint
streamline index in the current SisypheStreamlines instance container
- ptuple[float, float, float] | list[float, float, float]
point coordinates
Returns
- tuple[float, float, float]
distance between of the given point and the mid-point of the streamline
- streamlineFirstPoint(index: int) list[float] | tuple[float, float, float]
Get the first point of a streamline of the current SisypheStreamlines instance.
Parameters
- indexint
streamline index in the current SisypheStreamlines instance container
Returns
- tuple[float, float, float]
first point of the streamline
- streamlineLastPoint(index: int) list[float] | tuple[float, float, float]
Get the last point of a streamline of the current SisypheStreamlines instance.
Parameters
- indexint
streamline index in the current SisypheStreamlines instance container
Returns
- tuple[float, float, float]
last point of the streamline
- streamlineLength(index: int) float
Get the length of a streamline of the current SisypheStreamlines instance.
Parameters
- indexint
streamline index in the current SisypheStreamlines instance container
Returns
- float
streamline length
- streamlineMeanCurvature(index: int) float
Get the mean curvature of a streamline of the current SisypheStreamlines instance.
Parameters
- indexint
streamline index in the current SisypheStreamlines instance container
Returns
- float
mean curvature of the streamline
- streamlineMidPoint(index: int) list[float] | tuple[float, float, float]
Get the mid-point of a streamline of the current SisypheStreamlines instance.
Parameters
- indexint
streamline index in the current SisypheStreamlines instance container
Returns
- tuple[float, float, float]
mid-point of the streamline
- streamlinePointFromDistance(index: int, d: float, percent: bool = False) list[float] | tuple[float, float, float]
Get a point at a given distance from the start along a streamline of the current SisypheStreamlines instance.
Parameters
- indexint
streamline index in the current SisypheStreamlines instance container
- dfloat
distance from the start, as ratio, or in mm
- percentbool
if True, d is expressed as a ratio value, between 0.0 and 1.0. Otherwise, d is expressed as absolute value in mm
Returns
- tuple[float, float, float]
point coordinates at distance d from the start along the streamline
- streamlinePointIndex(index: int, p: list[float] | tuple[float, float, float], tol: float = 0.1) int | None
Get the index a point in a streamline of the current SisypheStreamlines instance.
Parameters
- indexint
streamline index in the current SisypheStreamlines instance container
- ptuple[float, float, float] | list[float, float, float]
point coordinates
- tolfloat
tolerance (default 0.1)
Returns
- int | None
point index in the streamline of the current SisypheStreamlines instance. If point is not in the streamline, returns None
- streamlinePointIndexFromDistance(index: int, d: float, percent: bool = False) int
Get a point at a given distance from the start along a streamline of the current SisypheStreamlines instance.
Parameters
- indexint
streamline index in the current SisypheStreamlines instance container
- dfloat
distance from the start, as ratio, or in mm
- percentbool
if True, d is expressed as a ratio value, between 0.0 and 1.0. Otherwise, d is expressed as absolute value in mm
Returns
- int
point index at distance d from the start along the streamline
- streamlinePrincipalDirection(index: int) list[float] | tuple[float, float, float]
Get the principal direction of a streamline of the current SisypheStreamlines instance. PCA is used to calculate the 3 principal directions for a streamline.
Parameters
- indexint
streamline index in the current SisypheStreamlines instance container
Returns
- list[float, float, float]
unit vector of the principal direction
- streamlineScalarHistogramFromVolume(index: int, vol: SisypheVolume, bins: int = 10) ndarray
Get histogram of scalar values in a Sisyphe.core.sisypheVolume.SisypheVolume instance along a streamline of the current SisypheStreamline instance.
Parameters
- indexint
streamline index in the current SisypheStreamline instance
- volSisyphe.core.sisypheVolume.SisypheVolume
volume used to get scalars
- binsint
histogram bins (default 10)
Returns
- numpy.ndarray
histogram
- streamlineScalarStatisticsFromVolume(index: int, vol: SisypheVolume) dict[slice(<class 'str'>, <class 'float'>, None)]
Get descriptive statistics of scalar values in a Sisyphe.core.sisypheVolume.SisypheVolume instance along a streamline of the current SisypheStreamline instance.
Parameters
- indexint
streamline index in the current SisypheStreamline instance
- volSisyphe.core.sisypheVolume.SisypheVolume
volume used to get scalars
Returns
- dict[str: float]
- descriptive statistics dict, keys(str), values (float) :
‘min’, minimum
‘perc5’, 5th percentile
‘perc25’, first quartile
‘median’, median
‘perc75’, third quartile
‘perc95’, 95th percentile
‘max’, maximum
‘std’, standard deviation
‘mean’, mean
‘skewness’, skewness
‘kurtosis’, kurtosis
- streamlineScalarsFromVolume(index: int, vol: SisypheVolume) ndarray
Get scalar values in a Sisyphe.core.sisypheVolume.SisypheVolume instance along a streamline of the current SisypheStreamline instance.
Parameters
- indexint
streamline index in the current SisypheStreamline instance
- volSisyphe.core.sisypheVolume.SisypheVolume
volume used to get scalar values
Returns
- numpy.ndarray
numpy ndarray of scalar values (same size as the number of points in the streamline)
- streamlinesClusterConfidenceFiltering(mdf: int = 5, subsample: int = 12, power: int = 1, ccithreshold: float = 1.0) SisypheStreamlines | None
Create a new bundle with streamlines of a bundle selected by a clustering confidence algorithm. Computes the cluster confidence index (cci), which is an estimation of the support a set of streamlines gives to a particular pathway. The cci provides a voting system where by each streamline (within a set tolerance) gets to vote on how much support it lends to. Outlier pathways score relatively low on cci, since they do not have many streamlines voting for them. These outliers can be removed by thresholding on the cci metric.
Parameters
- mdfint
maximum MDF distance (mm) that will be considered a ‘supporting’ streamline and included in cci calculation (default 5 mm)
- subsampleint
number of points that are considered for each streamline in the calculation. To save on calculation time, each streamline is subsampled (default 12 points)
- powerint
power to which the MDF distance for each streamline will be raised to determine how much it contributes to the cci. High values of power make the contribution value degrade much faster. e.g., a streamline with 5 mm MDF similarity contributes 1/5 to the cci if power is 1, but only contributes 1/5^2 = 1/25 if power is 2 (default 1).
- ccithresholdfloat
cci threshold used to select streamlines
Returns
- SisypheStreamlines | None
selected streamlines
- streamlinesClustering(metric: str = 'apd', threshold: float | None = None, subsample: int = 12, minclustersize: int = 10) list[SisypheStreamlines]
Streamlines clustering with various metric : average pointwise euclidean distance, center of mass distance, midpoint distance, length, angle between vector endpoints.
Parameters
- metric: str
‘apd’: average pointwise euclidean distance (mm), default metric
‘cmd’: center of mass euclidean distance (mm)
‘mpd’: midpoint euclidean distance (mm)
‘lgh’: length (mm)
‘ang’: angle between vector endpoints (degrees)
- thresholdfloat | None
- metric value threshold :
average pointwise euclidean distance, default 10 mm
center of mass euclidean distance, default 5 mm
midpoint euclidean distance, default 5 mm
length, default 10 mm
angle between vector endpoints, default 80°
- subsampleint
number of points that are considered for each streamline in the calculation. To save on calculation time (default 12 points)
- minclustersizeint
minimum cluster size (number of streamlines, default 10)
Returns
- list[SisypheStreamlines]
Streamlines clusters
- streamlinesFromAtlas(atlas: SisypheStreamlines, threshold: float = 0.1, reduction: float = 25.0, pruning: float = 12.0, reductiondist: str = 'mdf', pruningdist: str = 'mdf', refine: bool = False, refinereduction: float = 12.0, refinepruning: float = 6.0, minlength: float = 50.0, wait: DialogWait | None = None) SisypheStreamlines
Select streamlines from an atlas bundle. This function requires a model bundle (HCP bundle, ICBM152 space) and tries to extract similar looking bundle from the tractogram of the current SisypheStreamlines instance.
Parameters
- atlasSisypheStreamlines
streamlines used as bundle model
- thresholdfloat
mdf distance threshold for model bundle clustering (default 15.0). Get the centroids of the model bundle and work with centroids instead of all streamlines. This helps speed up processing.The larger the value of the threshold, the fewer centroids will be, and smaller the threshold value, the more centroids will be. If you prefer to use all the streamlines of the model bundle, you can set this threshold to 0.1 mm.
- reductionfloat
distance threshold in mm for bundle reduction (default 25.0)
- pruningfloat
distance threshold in mm for bundle pruning (default 12.0)
- reductiondiststr
‘mdf’ average pointwise euclidean distance (default)
‘mam’ mean average minimum distance
- pruningdiststr
‘mdf’ average pointwise euclidean distance (default)
‘mam’ mean average minimum distance
- refinebool
if True, two stage algorithm (recognize and refine), otherwise only recognize
- refinereductionfloat
distance threshold in mm for bundle reduction at refine stage (default 12.0)
- refinepruningfloat
distance threshold in mm for bundle pruning at refine stage (default 6.0)
- minlengthint
minimum streamline size
- waitSisyphe.gui.dialogWait.DialogWait
progress dialog (optional)
Returns
- SisypheStreamlines
streamlines selected by model
- streamlinesMajorCentroid(threshold: float | None = None, subsample: int = 12) SisypheStreamlines | None
Get the major cluster centroid streamline.
Parameters
- thresholdfloat | None
maximum distance from a bundle for a streamline to be still considered as part of it (Default 10 mm).
- subsampleint
number of points that are considered for each streamline in the calculation. To save on calculation time (default 12 points)
Returns
- SisypheStreamlines | None
centroid streamline
- streamlinesPlaneSelection(p: list[float] | tuple[float, float, float], planes: list[bool], include: bool = False) SisypheStreamlines
Create a new bundle with streamlines that cross or do not cross a plane. A streamline is included/excluded if one of its points crosses the x-axis plane. A streamline is included/excluded if one of its points crosses the y-axis plane. A streamline is included/excluded if one of its points crosses the z-axis plane.
Parameters
- ptuple[float, float, float] | list[float, float, float]
coordinates of sphere center
- planestuple[int, int, int] | list[int, int, int]
first bool, x-axis inclusion/exclusion
second bool, y-axis inclusion/exclusion
third bool, z-axis, inclusion/exclusion
- includebool
True, streamlines that cross plane are included
False, streamlines that cross plane are excluded
Returns
- SisypheStreamlines
selected streamlines
- streamlinesRoiSelection(rois: SisypheROICollection, include: list[bool] | None = None, mode: str = 'any', tol: float | None = None, wait: DialogWait | None = None) SisypheStreamlines
ROI(s) selection of streamlines in the current SisypheStreamline instance. These ROI(s) are used to perform virtual dissection. A streamline is included if any (or all) streamline point(s) is(are) within tol from inclusion ROI. A streamline is excluded if any (or all) streamline point(s) is(are) within tol from exclusion ROI.
Parameters
- roisSisyphe.core.sisypheROI.SisypheROICollection
ROIs container used to select streamlines
- includelist[bool] | None
This list has the same number of elements as the ROI container. if list element is True, the ROI with the
same index is used as inclusion, otherwise the ROI is used as exclusion - if None, all ROIs are used as inclusion
- modestr
‘any’ : any streamline point is within tol from ROI (Default)
‘all’ : all streamline points are within tol from ROI
‘end’ : either of the end-points is within tol from ROI
- tolfloat | None
If any coordinate in the streamline is within this distance, in mm, from the center of any voxel in the
ROI, the filtering criterion is set to True for this streamline, otherwise False. - if None (Default) tol is the distance between the center of each voxel and the corner of the voxel
- waitSisyphe.gui.dialogWait.DialogWait | None
progress dialog (optional)
Returns
- SisypheStreamlines
selected streamlines
- streamlinesSphereSelection(p: list[float] | tuple[float, float, float], radius: float, include: bool = False) SisypheStreamlines
Sphere selection of streamlines in the current SisypheStreamline instance. A streamline is included if any streamline point(s) is(are) within sphere. A streamline is excluded if any streamline point(s) is(are) within sphere.
Parameters
- ptuple[float, float, float] | list[float, float, float]
coordinates of sphere center
- radiusfloat
sphere radius in mm
- includebool
True for inclusion in sphere, otherwise exclusion from sphere (default False)
Returns
- SisypheStreamlines
selected streamlines
- streamlinesToConnectivityMatrix(vol: SisypheVolume | None) DataFrame
Calculate the connectivity matrix of the current SisypheStreamlines instance (all streamlines). The connectivity matrix is a square matrix with as many columns (rows) as there are labels in a label volume. Each element corresponds to the number of streamlines that start and end at each pair of labels in the label volume.
Parameters
- volSisyphe.core.sisypheVolume.SisypheVolume
label volume, Sisyphe.core.sisypheVolume.SisypheVolume must be a label volume
Returns
- pandas.DataFrame
connectivity matrix
- streamlinesToDensityMap() SisypheVolume
Calculate the density map of the current SisypheStreamlines instance (all streamlines). The scalar values of this map are the number of unique streamlines that pass through each voxel.
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
density map
- streamlinesToPathLengthMap(roi: SisypheROI) SisypheVolume
Calculate the path length map of the current SisypheStreamlines instance (all streamlines). The scalar values of this map are the shortest path, along any streamline, between a reference roi and each voxel.
Parameters
- roiSisyphe.core.sisypheROI.SisypheROI
reference roi
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
path length map
- class Sisyphe.core.sisypheTracts.SisypheTracking(model: SisypheDiffusionModel)
Description
Class to compute streamlines from diffusion model.
Attributes:
name of the generated bundle (default ‘tractogram’)
tracking algorithm
deterministic EuDX Euler integration
deterministic fiber orientation distribution
deterministic parallel transpor
deterministic closest peak direction
probabilistic bootstrap direction
probabilistic fiber orientation distribution
seed voxels from
FA threshold
ROI
seed count per voxel
step size between streamline points
stopping criterion
FA threshold
ROI
GM/WM/CSF Maps
Inheritance
object -> SisypheTracking
Creation: 29/10/2023 Last revision: 07/04/2025
- computeTracking(wait: DialogWait | None = None) SisypheStreamlines
Compute the fiber tracking according to the current SisypheTracking instance attributes (bundle name, diffusion model, tracking algorithm, seed method, seed count per voxel, step size and stopping criterion).
Parameters
- wait: Sisyphe.gui.dialogWait.DialogWait | None
progress bar dialog (optional)
Returns
- SisypheStreamlines
streamlines
- getBundleName() str
Get the bundle name attribute of the current SisypheTracking instance.
Returns
- str
name of the generated bundle
- getMinLength() float
Get the minimum length attribute of the current SisypheTracking instance. Streamlines with a length below this threshold are removed.
Returns
- float
minimum length in mm
- getMinSeparationAngleOfPeaks() float
Get the minimum separation angle attribute of the current SisypheTracking instance. If two odf peaks are too close i.e. separation angle below this threshold, only the larger of the two is returned. This parameter is only ysed by the deterministic euler integration tracking algorithm.
Returns
- float
minimum separation angle between peaks in degrees
- getNumberOfPeaks() int
Get the number of peaks attribute of the current SisypheTracking instance. Maximum number of odf peaks used by deterministic euler integration tracking algorithm.
Returns
- int
maximum number of peaks
- getRelativeThresholdOfPeaks() float
Get the relative peak threshold attribute of the current SisypheTracking instance. Only return odf peaks greater than relative_peak_threshold * m where m is the largest peak. This parameter is only ysed by the deterministic euler integration tracking algorithm.
Returns
- float
relative peak threshold (ratio, 0.0 to 1.0)
- getSeedCountPerVoxel() int
Get the seed count per voxel attribute of the current SisypheTracking instance. Number of streamlines generated per seed voxel.
Returns
- int
number of streamlines generated per seed voxel
- getSeeds() ndarray
Get array of seeds from the current SisypheTracking instance.
Returns
- numpy.ndarray
array of seeds
- getStepSize() float
Get the step size attribute of the current SisypheTracking instance. Step size (mm) between streamline points.
Returns
- float
step size
- getTrackingAlgorithm() int
Get the tracking algorithm attribute of the current SisypheTracking instance as int code.
Returns
- int
0 Deterministic EuDX Euler integration
1 Deterministic Fiber orientation distribution
2 Deterministic Parallel transport
3 Deterministic Closest peak direction
4 Probabilistic Bootstrap direction
5 Probabilistic Fiber orientation distribution
- getTrackingAlgorithmAsString() str
Get the tracking algorithm attribute of the current SisypheTracking instance.
Returns
- str
Deterministic EuDX Euler integration
Deterministic Fiber orientation distribution
Deterministic Parallel transport
Deterministic Closest peak direction
Probabilistic Bootstrap direction
Probabilistic Fiber orientation distribution
- setBundleName(name: str)
Set the bundle name attribute of the current SisypheTracking instance.
Parameters
- namestr
name of the generated bundle
- setMinLength(l: float = 0.0)
Set the minimum length attribute of the current SisypheTracking instance. Streamlines with a length below this threshold are removed.
Parameters
- lfloat
minimum length in mm
- setMinSeparationAngleOfPeaks(v: float)
Set the minimum separation angle attribute of the current SisypheTracking instance. If two odf peaks are too close i.e. separation angle below this threshold, only the larger of the two is returned. This parameter is only ysed by the deterministic euler integration tracking algorithm.
Parameters
- vfloat
minimum separation angle between peaks in degrees
- setNumberOfPeaks(v: int = 5)
Set the number of peaks attribute of the current SisypheTracking instance. Maximum number of odf peaks used by deterministic euler integration tracking algorithm.
Returns
- int
maximum number of peaks (default 5)
- setRelativeThresholdOfPeaks(v: float)
Set the relative peak threshold attribute of the current SisypheTracking instance. Only return odf peaks greater than relative_peak_threshold * m where m is the largest peak. This parameter is only ysed by the deterministic euler integration tracking algorithm.
Parameters
- vfloat
relative peak threshold (ratio, 0.0 to 1.0)
- setSeedCountPerVoxel(n: int = 1) None
Set the seed count per voxel attribute of the current SisypheTracking instance. Number of streamlines generated per seed voxel.
Parameters
- nint
number of streamlines generated per seed voxel
- setSeedsFromFAThreshold(threshold: float) None
Set seed voxels of the current SisypheTracking instance from FA threshold. Streamlines are generated from voxels whose FA value is above a given threshold.
Parameters
- thresholdfloat
FA threshold
- setSeedsFromRoi(roi: SisypheROI) None
Set seed voxels of the current SisypheTracking instance from a ROI. Streamlines are generated from voxels belonging to the mask of a ROI.
Parameters
- roiSisyphe.core.sisypheROI.SisypheROI
seed roi
- setStepSize(stepsize: float = 0.5) None
Set the step size attribute of the current SisypheTracking instance. Step size (mm) between streamline points (default 0.5).
Parameters
- stepsizefloat
step size
- setStoppingCriterionToFAThreshold(threshold: float = 0.1) None
Set the stopping criterion attribute of the current SisypheTracking instance to FA threshold. Streamline reconstruction is stopped when the current point is in a voxel whose FA value is below a threshold.
Parameters
- thresholdfloat
FA threshold (between 0.0 and 1.0, default 0.1)
- setStoppingCriterionToMaps(gm: SisypheVolume(), wm: SisypheVolume(), csf: SisypheVolume()) None
Set the stopping criterion attribute of the current SisypheTracking instance to maps. This stopping criterion uses gray matter, white matter and cerebro-spinal fluid maps. Streamline reconstruction is stopped when the current point is in a voxel belonging to gray matter (> 0.5), cerebro-spinal fluid (> 0.5) or background.
Parameters
- gmSisyphe.core.sisypheVolume.SisypheVolume
gray matter probability map
- wmSisyphe.core.sisypheVolume.SisypheVolume
white matter probability map
- csfSisyphe.core.sisypheVolume.SisypheVolume
cerebro-spinal fluid probability map
- setStoppingCriterionToROI(roi: SisypheROI) None
Set the stopping criterion attribute of the current SisypheTracking instance to ROI. Streamline reconstruction is stopped when the current point is in a voxel belonging to the mask of a ROI.
Parameters
- roiSisyphe.core.sisypheROI.SisypheROI
stopping criterion roi
- setTrackingAlgorithm(alg: int = 0) None
Set the tracking algorithm attribute of the current SisypheTracking instance as int code.
Parameters
- algint
0 deterministic Euler integration
1 deterministic particle filtering
2 deterministic closest peak direction
3 deterministic fiber orientation distribution
4 probabilistic bootstrap direction
5 probabilistic fiber orientation distribution
- setTrackingAlgorithmToDeterministicClosestPeakDirection() None
Set the tracking algorithm attribute of the current SisypheTracking instance to deterministic closest peak direction.
- setTrackingAlgorithmToDeterministicEulerIntegration() None
Set the tracking algorithm attribute of the current SisypheTracking instance to deterministic Euler integration.
- setTrackingAlgorithmToDeterministicFiberOrientationDistribution() None
Set the tracking algorithm attribute of the current SisypheTracking instance to deterministic fiber orientation distribution.
- setTrackingAlgorithmToDeterministicParallelTransport() None
Set the tracking algorithm attribute of the current SisypheTracking instance to deterministic parallel transport.
- setTrackingAlgorithmToProbabilisticBootstrapDirection() None
Set the tracking algorithm attribute of the current SisypheTracking instance to probabilistic bootstrap direction.
- setTrackingAlgorithmToProbabilisticFiberOrientationDistribution() None
Set the tracking algorithm attribute of the current SisypheTracking instance to probabilistic fiber orientation distribution.
- class Sisyphe.core.sisypheTracts.SisypheTract
Description
Class to manage streamline display (tract).
This class manages display attributes of tracts:
Color representation
RGB mode, colors derived from unit vector directed to next point of the tract
CMAP mode, colors derived from scalar values associated with points using the look-up table colormap attribute
COLOR mode, solid color given by the color attribute
Color, used in COLOR mode
Look-up table colormap, used in CMAP mode
Line width
Visibility
Opacity
Inheritance
object -> SisypheTract
Creation: 26/10/2023 Last revision: 21/02/2025
- clear() None
Clear the current SisypheTract instance.
- deepCopy() SisypheTract
Deep copy of the current SisypheTract instance.
Returns
- SisypheTract
deep copy of tract
- getActiveScalars() str | None
Get the name of the active scalar value associated with points in the current SisypheTract instance.
Returns
- str | None
scalar value name
- getActor() vtkActor
Get the vtk.vtkActor attribute of the current SisypheTract instance.
Returns
- vtk.vtkActor
vtkActor tract
- getColorRepresentation() int
Get the tract representation attribute of the current SisypheTract instance.
Returns
- int
- representation code:
0, RGB mode, colors derived from unit vector directed to next point of the tract (x-axis component in
red, y-axis component in green and z-axis component in blue). - 1, CMAP mode, colors derived from scalar values associated with points using the look-up table colormap attribute of the current SisypheTract instance. - 2, COLOR mode, solid color given by the color attribute of the current SisypheTract instance.
- getColorRepresentationAsString() str
Get the tract representation attribute of the current SisypheTract instance from a str.
Returns
- str
- representation code
‘rgb’, RGB mode, colors derived from unit vector directed to next point of the tract (x-axis
component in red, y-axis component in green and z-axis component in blue). - ‘scalars’, CMAP mode, colors derived from scalar values associated with points using the look-up table colormap attribute of the current SisypheTract instance. - ‘color’, COLOR mode, solid color given by the color attribute of the current SisypheTract instance.
- getFloatColor() list[float] | tuple[float, float, float]
Get the color attribute of the current SisypheTract instance. The color attribute is only used in COLOR mode representation (see setColorRepresentation() method).
Returns
- tuple[float, float, float] | list[float, float, float]
color red, green, blue (each component between 0.0 and 1.0)
- getIntColor() list[int] | tuple[int, int, int]
Get the color attribute of the current SisypheTract instance. The color attribute is only used in COLOR mode representation (see setColorRepresentation() method).
Returns
- tuple[int, int, int] | list[int, int, int]
color red, green, blue (each component between 0 and 255)
- getLineWidth() float
Get the line width attribute of the current SisypheTract instance in mm.
Returns
- float
line width in mm
- getLut() SisypheLut
Get the look-up table colormap attribute of the current SisypheTract instance. The look-up table colormap attribute is only used in CMAP mode representation (see setColorRepresentation() method).
Returns
- Sisyphe.core.sisypheLUT.SisypheLut
tract lut
- getOpacity() float
Get the opacity attribute of the current SisypheTract instance.
Returns
- float
opacity, between 0.0 (transparent) and 1.0 (opaque)
- getPoints() ndarray
Get the tract points of the current SisypheTract instance.
Returns
- ndarray
shape(n, 3), n points.
- getPolyData() vtkPolyData
Get the vtk.vtkPolyData attribute of the current SisypheTract instance.
Returns
- vtk.vtkPolyData
vtkPolydata tract
- getQColor() QColor
Get the color attribute of the current SisypheTract instance. The color attribute is only used in COLOR mode representation (see setColorRepresentation() method).
Returns
- PyQt5.QtGui.QColor
tract color
- getScalarNames() list[str]
Get a list of scalar value names associated with points in the current SisypheTract instance.
Returns
- list[str]
scalar value names
- getVisibility() bool
Get the visibility attribute of the current SisypheTract instance.
Returns
- bool
True if visible
- hasScalarNames() bool
Check whether the current SisypheTract instance has associated scalar values.
Returns
- bool
True if scalar values are defined
- isColorRepresentation() bool
Check whether the tract representation of the current SisypheTract instance is in COLOR mode. The tract has a solid color given by the color attribute of the current SisypheTract instance.
Returns
- bool
True if color representation
- isEmpty() bool
Check whether the current SisypheTract instance is empty (no point)
Returns
- bool
True if empty
- isRGBRepresentation() bool
Check whether the tract representation of the current SisypheTract instance is in RGB mode. Colors are derived from unit vector directed to next point of the tract (x-axis component in red, y-axis component in green and z-axis component in blue).
Returns
- bool
True if RGB representation
- isScalarsRepresentation() bool
Check whether the tract representation of the current SisypheTract instance is in SCALARS mode. Colors are derived from scalar values associated with points using the look-up table colormap attribute of the current SisypheTract instance.
Returns
- bool
True if scalrs representation
- setActiveScalars(sc: str) None
Set the name of the active scalar value associated with points in the current SisypheTract instance.
Parameters
- scstr
scalar value name
- setColorRepresentation(r: int) None
Set the tract representation attribute of the current SisypheTract instance.
Parameters
- rint
- representation code:
0, RGB mode, colors derived from unit vector directed to next point of the tract (x-axis component in
red, y-axis component in green and z-axis component in blue). - 1, CMAP mode, colors derived from scalar values associated with points using the look-up table colormap attribute of the current SisypheTract instance. - 2, COLOR mode, solid color given by the color attribute of the current SisypheTract instance.
- setColorRepresentationAsString(r: str) None
Set the tract representation attribute of the current SisypheTract instance from a str.
Parameters
- rstr
- representation code:
‘rgb’, RGB mode, colors derived from unit vector directed to next point of the tract (x-axis
component in red, y-axis component in green and z-axis component in blue). - ‘scalars’, CMAP mode, colors derived from scalar values associated with points using the look-up table colormap attribute of the current SisypheTract instance. - ‘color’, COLOR mode, solid color given by the color attribute of the current SisypheTract instance.
- setColorRepresentationToColor() None
Set the tract representation attribute of the current SisypheTract instance to COLOR mode. The tract has a solid color given by the color attribute of the current SisypheTract instance.
- setColorRepresentationToRGB() None
Set the tract representation attribute of the current SisypheTract instance to RGB mode. Colors are derived from unit vector directed to next point of the tract (x-axis component in red, y-axis component in green and z-axis component in blue).
- setColorRepresentationToScalars() None
Set the tract representation attribute of the current SisypheTract instance to SCALARS mode. Colors are derived from scalar values associated with points using the look-up table colormap attribute of the current SisypheTract instance.
- setFloatColor(c: list[float] | tuple[float, float, float], update: bool = False) None
Set the color attribute of the current SisypheTract instance. The color attribute is only used in COLOR mode representation (see setColorRepresentation() method).
Parameters
- ctuple[float, float, float] | list[float, float, float]
color red, green, blue (each component between 0.0 and 1.0)
- updatebool
update color representation to solid color
- setIntColor(c: list[int] | tuple[int, int, int], update: bool = False) None
Set the color attribute of the current SisypheTract instance. The color attribute is only used in COLOR mode representation (see setColorRepresentation() method).
Parameters
- ctuple[int, int, int] | list[int, int, int]
color red, green, blue (each component between 0 and 255)
- updatebool
update color representation to solid color
- setLineWidth(v: float)
Set the line width attribute of the current SisypheTract instance in mm.
Parameters
- vfloat
line width in mm
- setLut(lut: str | SisypheVolume | SisypheLut | vtkLookupTable | None = None, update: bool = False) None
Set the look-up table colormap attribute of the current SisypheTract instance. The look-up table colormap attribute is only used in CMAP mode representation (see setColorRepresentation() method).
Parameters
- lutstr | Sisyphe.core.sisypheVolume.SisypheVolume | Sisyphe.core.SisypheLUT.SisypheLut | vtk.vtkLookupTable | None
if None, set a default look-up table colormap (hot)
- updatebool
update color representation to color map
- setOpacity(v: float)
Set the opacity attribute of the current SisypheTract instance.
Parameters
- vfloat
opacity, between 0.0 (transparent) and 1.0 (opaque)
- setPoints(sl: ndarray, reg: bool = True) None
Set the tract points of the current SisypheTract instance.
Parameters
- slndarray
streamline of n points, shape(n, 3)
- regbool
regular step between points of the streamline
- setQColor(c: QColor, update: bool = False) None
Set the color attribute of the current SisypheTract instance. The color attribute is only used in COLOR mode representation (see setColorRepresentation() method).
Parameters
- cPyQt5.QtGui.QColor
color
- updatebool
update color representation to solid color
- setScalarsFromVolume(vol: SisypheVolume) None
Set scalar values associated to each point of the current SisypheTract instance from a Sisyphe.core.sisypheVolume.SisypheVolume instance. The value associated with a point of the tract is the scalar value of the SisypheVolume voxel at the coordinates of that point.
Parameters
- volSisyphe.core.sisypheVolume.SisypheVolume
reference volume
- setVisibility(v: bool)
Set the visibility attribute of the current SisypheTract instance.
Parameters
- vbool
True if visible
- visibilityOff() None
Hide the current SisypheTract instance (set the visibility attribute to False).
- visibilityOn() None
Show the current SisypheTract instance (set the visibility attribute to True).
- class Sisyphe.core.sisypheTracts.SisypheTractCollection
Description
Named (bundel name) list container of SisypheTract instances. Container Key = tuple[str, int], str bundle name, int index of a SisypheTract in the bundle
This class manages display attributes of bundles:
Color representation
RGB mode, colors derived from unit vector directed to next point of the tract
CMAP mode, colors derived from scalar values associated with points using the look-up table colormap attribute
COLOR mode, solid color given by the color attribute
Color, used in COLOR mode
Look-up table colormap, used in CMAP mode
Line width
Visibility
Opacity
Inheritance
object -> SisypheTractCollection
Creation: 26/10/2023 Last revision: 20/02/2025
- appendBundle(sl: SisypheStreamlines, bundle: str, wait: DialogWait | None = None) None
Append streamlines to the current SisypheTractCollection instance container. These streamlines belong to a bundle identified by a bundle name given as parameter.
Parameters
sl : SisypheStreamlines bundle : str
Bundle name
- waitSisyphe.gui.dialogWait.DialogWait | None
Progress bar dialog
- bundleCount() int
Get the number of bundles in the current SisypheTractCollection instance container.
Returns
- int
Number of bundles
- clear() None
Remove all elements from the current SisypheTractCollection instance container (empty).
- count() int
Get the global number of SisypheTract elements in the current SisypheTractCollection instance container.
Returns
- int
Number of SisypheTract elements
- duplicateBundle(sl: SisypheStreamlines, select: SisypheBundle | None = None) SisypheStreamlines
Duplicate a selection of streamlines belonging to a bundle of the current SisypheTractCollection instance container. The new bundle is called with the name attribute of the select instance (SisypheBundle parameter)
Parameters
sl : SisypheStreamlines select : SisypheBundle | None
streamlines duplicated in the new bundle. If None (default), no streamline selection (all streamlines are duplicated)
Returns
- SisypheStreamlines
Streamlines of the new bundle
- getActiveScalars(bundle: str = '') str
Get the name of the active scalar value associated with tract points of a bundle in the current SisypheTractCollection instance.
Parameters
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected
Returns
- str
scalar value name
- getBundleNames() list[str]
Get the bundle names in the current SisypheTractCollection instance container.
Returns
- list[str]
list of bundle names
- getColorRepresentation(bundle: str = '') int
Get the color representation attribute of a bundle in the current SisypheTractCollection instance.
Parameters
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected.
Returns
- int
- representation code:
0, RGB mode, colors derived from unit vector directed to next point of the tract (x-axis component
in red, y-axis component in green and z-axis component in blue). - 1, CMAP mode, colors derived from scalar values associated with points using the look-up table colormap attribute of the current instance. - 2, COLOR mode, solid color given by the color attribute of the current instance.
- getColorRepresentationAsString(bundle: str = '') str
Get the color representation attribute of a bundle in the current SisypheTractCollection instance from a str.
Parameters
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected.
Returns
- str
- representation code:
‘rgb’, RGB mode, colors derived from unit vector directed to next point of the tract (x-axis
component in red, y-axis component in green and z-axis component in blue). - ‘scalars’, CMAP mode, colors derived from scalar values associated with points using the look-up table colormap attribute of the current instance. - ‘color’, COLOR mode, solid color given by the color attribute of the current instance.
- getDict() dict[slice(<class 'str'>, list[Sisyphe.core.sisypheTracts.SisypheTract], None)]
Get the current SisypheTractCollection instance container as dict (Shallow copy).
Returns
- dict[str: list[SisypheTract]]
str dict key, bundle name
list[SisypheTract] dict value
- getFloatColor(bundle: str = '') list[float] | tuple[float, float, float]
Get the color attribute of a bundle in the current SisypheTractCollection instance. The color attribute is only used in COLOR mode representation (see setColorRepresentation() method).
Parameters
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected.
Returns
- tuple[float, float, float] | list[float, float, float]
color red, green, blue (each component between 0.0 and 1.0)
- getIntColor(bundle: str = '') list[int] | tuple[int, int, int]
Get the color attribute of a bundle in the current SisypheTractCollection instance. The color attribute is only used in COLOR mode representation (see setColorRepresentation() method).
Parameters
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected.
Returns
- tuple[int, int, int] | list[int, int, int]
color red, green, blue (each component between 0 and 255)
- getLineWidth(bundle: str = '') float
Get the line width attribute of a bundle in the current SisypheTractCollection instance in mm.
Parameters
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected.
Returns
- float
line width in mm
- getLut(bundle: str = '') SisypheLut
Get the look-up table colormap attribute of a bundle in the current SisypheTractCollection instance. The look-up table colormap attribute is only used in CMAP mode representation (see setColorRepresentation() method).
Parameters
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected.
Returns
- Sisyphe.core.sisypheLUT.SisypheLut
lut
- getOpacity(bundle: str = '') float
Get the opacity attribute of a bundle in the current SisypheTractCollection instance.
Parameters
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected.
Returns
- float
opacity, between 0.0 (transparent) and 1.0 (opaque)
- getQColor(bundle: str = '') QColor
Get the color attribute of a bundle in the current SisypheTractCollection instance. The color attribute is only used in COLOR mode representation (see setColorRepresentation() method).
Parameters
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected.
Returns
PyQt5.QtGui.QColor
- getRenderer() vtkRenderer | None
Get the renderer in which the current SisypheTractCollection is displayed.
Returns
- vtkRenderer | None
renderer
- getScalarNames(bundle: str) list[str]
Get a list of scalar value names associated with tract points in the current SisypheTractCollection instance.
Parameters
- bundlestr
Bundle name, if bundle name is empty, the first bundle is selected
Returns
- list[str]
scalar value names
- getVisibility(bundle: str = '') bool
Get the visibility attribute of a bundle in the current SisypheTractCollection instance.
Parameters
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected.
Returns
- bool
True if visible
- hasRenderer() bool
Check whether a renderer has been defined to display the current SisypheTractCollection.
Returns
- bool
True if renderer is defined i.e. not None
- hasScalars(bundle: str = '') bool
Check whether the bundle in the current SisypheTractCollection instance has associated scalar values.
Parameters
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected
Returns
- bool
True if scalars are defined
- isColorRepresentation(bundle: str = '') bool
Check whether the color representation of a bundle is in COLOR mode. The tracts have a solid color given by the color attribute.
Parameters
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected.
Returns
- bool
True if color representation
- isEmpty() bool
Check if SisypheTractCollection instance container is empty.
Returns
- bool
True if empty
- isRGBRepresentation(bundle: str = '') bool
Check whether the color representation of a bundle is in RGB mode. Colors are derived from unit vector directed to next point of the tract (x-axis component in red, y-axis component in green and z-axis component in blue).
Parameters
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected.
Returns
- bool
True if RGB representation
- isScalarsRepresentation(bundle: str = '') bool
Check whether the color representation of a bundle is in SCALARS mode. Colors are derived from scalar values associated with points using the look-up table colormap attribute.
Parameters
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected.
Returns
- bool
True if scalars representation
- removeAllBundles() None
Remove all bundles from the current SisypheTractCollection instance container.
- removeBundle(bundle: str = '') None
Remove a bundle from the current SisypheTractCollection instance container. This bundle is identified by a bundle name given as parameter.
Parameters
- bundlestr
Bundle name. if bundle name is empty, removes the first bundle.
- renameBundle(old: str, new: str) None
Rename a bundle of the current SisypheTractCollection instance container.
Parameters
- oldstr
Old bundle name
- newstr
New bundle name
- setActiveScalars(sc: str, bundle: str = '') None
Set the name of the active scalar value associated with tract points of a bundle in the current SisypheTractCollection instance.
Parameters
- scstr
scalar value name
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected
- setColorRepresentation(v: int, bundle: str = '') None
Set the color representation attribute of a bundle in the current SisypheTractCollection instance.
Parameters
- vint
- representation code:
0, RGB mode, colors derived from unit vector directed to next point of the tract (x-axis component in
red, y-axis component in green and z-axis component in blue). - 1, CMAP mode, colors derived from scalar values associated with points using the look-up table colormap attribute of the current instance. - 2, COLOR mode, solid color given by the color attribute of the current instance.
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected.
- setColorRepresentationAsString(v: str, bundle: str = '') None
Set the color representation attribute of a bundle in the current SisypheTractCollection instance from a str.
Parameters
- vstr
- representation code:
‘rgb’, RGB mode, colors derived from unit vector directed to next point of the tract (x-axis
component in red, y-axis component in green and z-axis component in blue). - ‘scalars’, CMAP mode, colors derived from scalar values associated with points using the look-up table colormap attribute of the current instance. - ‘color’, COLOR mode, solid color given by the color attribute of the current instance.
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected.
- setColorRepresentationToColor(bundle: str = '') None
Set the color representation attribute of the current SisypheTractCollection instance to COLOR mode. The tracts have a solid color given by the color attribute.
Parameters
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected.
- setColorRepresentationToRGB(bundle: str = '') None
Set the color representation attribute of a bundle in the current SisypheTractCollection instance to RGB mode. Colors are derived from unit vector directed to next point of the tract (x-axis component in red, y-axis component in green and z-axis component in blue).
Parameters
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected.
- setColorRepresentationToScalars(bundle: str = '') None
Set the color representation attribute of a bundle in the current SisypheTractCollection instance to SCALARS mode. Colors are derived from scalar values associated with points using the look-up table colormap attribute.
Parameters
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected.
- setFloatColor(c: list[float] | tuple[float, float, float], bundle: str = '') None
Set the color attribute of a bundle in the current SisypheTractCollection instance. The color attribute is only used in COLOR mode representation (see setColorRepresentation() method).
Parameters
- ctuple[float, float, float] | list[float, float, float]
color red, green, blue (each component between 0.0 and 1.0)
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected.
- setIntColor(c: list[int] | tuple[int, int, int], bundle: str = '') None
Set the color attribute of a bundle in the current SisypheTractCollection instance. The color attribute is only used in COLOR mode representation (see setColorRepresentation() method).
Parameters
- ctuple[int, int, int] | list[int, int, int]
color red, green, blue (each component between 0 and 255)
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected.
- setLineWidth(v: float, bundle: str = '') None
Set the line width attribute of a bundle in the current SisypheTractCollection instance in mm.
Parameters
- vfloat
line width in mm
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected.
- setLut(lut: SisypheLut, bundle: str = '') None
Set the look-up table colormap attribute of a bundle in the current SisypheTractCollection instance. The look-up table colormap attribute is only used in CMAP mode representation (see setColorRepresentation() method).
Parameters
- lutSisyphe.core.sisypheVolume.SisypheVolume | Sisyphe.core.SisypheLUT.SisypheLut | vtk.vtkLookupTable
lut
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected.
- setOpacity(v: float, bundle: str = '') None
Set the opacity attribute of a bundle in the current SisypheTractCollection instance.
Parameters
- vfloat
opacity, between 0.0 (transparent) and 1.0 (opaque)
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected.
- setQColor(c: QColor, bundle: str = '') None
Set the color attribute of a bundle in the current SisypheTractCollection instance. The color attribute is only used in COLOR mode representation (see setColorRepresentation() method).
Parameters
c : PyQt5.QtGui.QColor bundle : str
bundle name, if bundle name is empty, the first bundle is selected.
- setRenderer(r: vtkRenderer | None)
Define the renderer in which the current SisypheTractCollection is displayed.
Parameters
- rvtkRenderer | None
renderer
- setScalarsFromVolume(vol: SisypheVolume, bundle: str, wait: DialogWait | None = None) None
Set scalar values associated to each point of the tract elements from a Sisyphe.core.sisypheVolume.SisypheVolume instance. The value associated with a point of the tract is the scalar value of the SisypheVolume voxel at the coordinates of that point.
Parameters
vol : Sisyphe.core.sisypheVolume.SisypheVolume bundle : str
Bundle name, if bundle name is empty, the first bundle is selected
- waitSisyphe.gui.dialogWait.DialogWait | None
Progress bar dialog (optional)
- setVisibility(v: bool, bundle: str = '')
Set the visibility attribute of a bundle in the current SisypheTractCollection instance.
Parameters
- vbool
visibility
- bundlestr
bundle name, if bundle name is empty, the first bundle is selected.
- tractCount(bundle: str = '') int
Get the number of SisypheTract elements in a bundle of the current SisypheTractCollection instance container.
Parameters
- bundlestr
Bundle name, if bundle = ‘’, returns the global number of tracts.
Returns
- int
Number of SisypheTract elements in the bundle
- unionBundle(bundle: str, lsl: list[SisypheStreamlines], wait: DialogWait | None = None) SisypheStreamlines
Union of bundles of the current SisypheTractCollection instance container. The bundle updated is the bundle name attribute of the sl1 instance (SisypheStreamlines parameter)
Parameters
- bundlestr
union bundle name
lsl : list[SisypheStreamlines] wait : Sisyphe.gui.dialogWait.DialogWait | None
Progress bar dialog (optional)
Returns
- SisypheStreamlines
Streamlines union
- updateBundle(sl: SisypheStreamlines, select: SisypheBundle) SisypheStreamlines
Update streamlines belonging to a bundle of the current SisypheTractCollection instance container. The bundle updated is the bundle name attribute of the sl instance (SisypheStreamlines parameter)
Parameters
- slSisypheStreamlines
Streamlines of the bundle to update
- selectSisypheBundle
Streamlines selection of the bundle
Returns
- SisypheStreamlines
Selected streamlines