Sisyphe.core.sisypheLUT
External packages/modules
matplotlib, graph plot library, https://matplotlib.org/
Numpy, scientific computing, https://numpy.org/
PyQt5, Qt GUI, https://www.riverbankcomputing.com/software/pyqt/
vtk, visualization engine/3D rendering, https://vtk.org/
- class Sisyphe.core.sisypheLUT.SisypheColorTransfer
Description
Class to manage color transfer function used for 3D volume rendering.
This class has three transfer function attributes:
Color transfer function which associates image array values with colors
Alpha transfer function which associates image array values with alpha (opacity)
Gradient transfer function which associates gradient image array values with alpha (opacity) used to improve the
rendering of object edges. (i.e. high gradient values in edges are associated with high alpha)
Inheritance
object -> SisypheColorTransfer
Creation: 07/11/2022 Last revision: 13/12/2023
- addAlphaTransferElement(v: float | None = None, a: float | None = None, va: tuple[float, float] | list[float] | None = None) None
Add alpha value to the alpha transfer function of the current SisypheColorTransfer instance.
Parameters
- vfloat | None
scalar value of the image array
- afloat | None
alpha value
- vatuple[float, float] | list[float, float] | None
scalar value of the image array and alpha value
- addColorTransferElement(v: float | None = None, r: float | None = None, g: float | None = None, b: float | None = None, vrgb: tuple[float, float, float, float] | list[float] | None = None) None
Add a color to the color transfer function of the current SisypheColorTransfer instance.
Parameters
- vfloat | None
scalar value of the image array
- rfloat | None
red component of the color
- gfloat | None
green component of the color
- bfloat | None
blue component of the color
- vrgbtuple[float, float, float, float] | list[float] | None
scalar value of the image array then red, green blue components
- addGradientTransferElement(v: float | None = None, a: float | None = None, va: tuple[float, float] | list[float] | None = None) None
Add gradient value to the gradient transfer function of the current SisypheColorTransfer instance.
Parameters
- vfloat | None
scalar value of the gradient image array
- afloat | None
alpha value
- vatuple[float, float] | list[float, float] | None
scalar value of the gradient image array and alpha value
- clear() None
Remove all elements of the three transfer function and clear ID attribute of the current SisypheColorTransfer instance.
- clearAlphaTransfer() None
Remove all elements of the alpha transfer function of the current SisypheColorTransfer instance.
- clearColorTransfer() None
Remove all colors of the color transfer function of the current SisypheColorTransfer instance.
- clearGradientTransfer() None
Remove all elements of the gradient transfer function of the current SisypheColorTransfer instance.
- copy() SisypheColorTransfer
Copy of the current SisypheColorTransfer instance (deep copy).
Returns
- SisypheColorTransfer
color transfer function copy
- copyFrom(buff: SisypheColorTransfer) None
Copy SisypheColorTransfer attributes to the current SisypheColorTransfer instance (deep copy).
Parameters
- buffSisypheColorTransfer
color transfer functrion to copy
- copyFromDict(cdict: dict[str, list[list[float]]]) None
Set all three transfer functions of the current SisypheColorTransfer instance from a dict parameter.
Parameters
- cdictdict[str, list[list[float, …]]]
- Keys / Values, transfer functions as lists
‘color’, color transfer function (list[list[float, float, float, float]])
‘alpha’, alpha transfer function (list[list[float, float]])
‘gradient’, gradient transfer function (list[list[float, float]])
- copyFromList(clist: list | ndarray, code: str) None
Set one of the three transfer functions of the current SisypheColorTransfer instance from a list or a numpy.ndarray parameter.
Parameters
- codestr
code of the transfer function to copy (‘color’, ‘alpha’ or ‘gradient’)
- clistlist[float, …] | numpy.ndarray
if code is ‘color’, list[list[float, float, float, float]] scalar value, red, green and blue components
if code is ‘alpha’, list[list[float, float]] scalar value and alpha components
if code is ‘gradient’, list[list[float, float]] scalar value and alpha components
- copyFromNumpy(cnp: ndarray, code: str) None
Set one of the three transfer functions of the current SisypheColorTransfer instance from a list or a numpy.ndarray parameter.
Parameters
- codestr
code of the transfer function to copy (‘color’, ‘alpha’ or ‘gradient’)
- cnpnumpy.array(list[float, …])
if code is ‘color’, numpy.array(list[float, float, float, float]) scalar value, red, green and blue components
if code is ‘alpha’, numpy.array(list[list[float, float]]) scalar value and alpha components
if code is ‘gradient’, numpy.array(list[list[float, float]]) scalar value and alpha components
- copyToDict() dict[str, list[list[float]]]
Copy all three transfer functions of the current SisypheColorTransfer instance to a dict.
Returns
- dict[str, list[list[float, …]]]
- Keys / Values, transfer functions as lists
‘color’, color transfer function (list[list[float, float, float, float]])
‘alpha’, alpha transfer function (list[list[float, float]])
‘gradient’, gradient transfer function (list[list[float, float]])
- copyToList(code: str) list[list[float]]
Copy one of the three transfer functions of the current SisypheColorTransfer instance to a list.
Parameters
- codestr
code of the transfer function to copy (‘color’, ‘alpha’ or ‘gradient’)
Returns
- list[list[float, …]]
if code is ‘color’, list[list[float, float, float, float]] scalar value, red, green and blue components
if code is ‘alpha’, list[list[float, float]] scalar value and alpha components
if code is ‘gradient’, list[list[float, float]] scalar value and alpha components
- copyToNumpy(code: str) ndarray
Copy a transfer function of the current SisypheColorTransfer instance to a numpy.ndarray.
Parameters
- codestr
transfer function to copy (‘color’, ‘alpha’ or ‘gradient’)
Returns
- numpy.array(list[float, …])
if code is ‘color’, numpy.array(list[float, float, float, float]) scalar value, red, green and blue components
if code is ‘alpha’, numpy.array(list[list[float, float]]) scalar value and alpha components
if code is ‘gradient’, numpy.array(list[list[float, float]]) scalar value and alpha components
- getAlphaFromGradientValue(v: float, interpol: bool = True) float | None
Get alpha from gradient value in the gradient transfer function table of the current SisypheColorTransfer instance.
Parameters
- vfloat | None
scalar value in the gradient image array
- interpolbool
nearest scalar value in the color transfer function table
Returns
- float | None
alpha value in the gradient transfer function table, None if not in the table.
- getAlphaFromValue(v: float, interpol: bool = True) float | None
Get alpha from scalar value in the alpha transfer function table of the current SisypheColorTransfer instance.
Parameters
- vfloat
scalar value in the image array
- interpolbool
nearest scalar value in the color transfer function table
Returns
- float | None
alpha value in the alpha transfer function table, None if not in the table.
- getAlphaTransfer() vtkPiecewiseFunction
Get the alpha transfer function of the current SisypheColorTransfer instance.
Returns
- vtk.vtkPiecewiseFunction
alpha transfer function copy
- getAlphaTransferElement(index: int) list[float]
Get alpha from index of the alpha transfer function table of the current SisypheColorTransfer instance.
Parameters
- indexint
index of the alpha transfer function table
Returns
- list[float, float]
scalar value of the image array and alpha value
- getAlphaTransferSize() int
Get number of elements in the alpha transfer function of the current SisypheColorTransfer instance.
Returns
- int
number of elements in the alpha transfer function
- getColorFromValue(v: float, interpol: bool = True) list[float] | None
Get color from scalar value in the color transfer function table of the current SisypheColorTransfer instance.
Parameters
- vfloat | None
scalar value in the image array
- interpolbool
nearest scalar value in the color transfer function table
Returns
- list[float] | None
color (red, green and blue components) in the color transfer function table, None if not in the table.
- getColorTransfer() vtkColorTransferFunction
Get the color transfer function of the current SisypheColorTransfer instance.
Returns
- vtk.vtkColorTransferFunction
color transfer function copy
- getColorTransferElement(index: int) list[float]
Get color from index of the color transfer function table of the current SisypheColorTransfer instance.
Parameters
- indexint
index of the color transfer function table
Returns
- list[float, float, float, float]
scalar value of the image array then red, green and blue components
- getColorTransferSize() int
Get number of colors in the color transfer function of the current SisypheColorTransfer instance.
Returns
- int
number of colors in the color transfer function
- classmethod getFilterExt() str
Get SisypheColorTransfer filter used by QFileDialog.getOpenFileName() and QFileDialog.getSaveFileName().
Returns
- str
‘PySisyphe Color Transfer (.xtfer)’
- getGradientTransfer() vtkPiecewiseFunction
Get the gradient transfer function of the current SisypheColorTransfer instance.
Returns
- vtk.vtkPiecewiseFunction
gradient transfer function copy
- getGradientTransferElement(index: int) list[float]
Get alpha from index of the gradient transfer function table of the current SisypheColorTransfer instance.
Parameters
- indexint
index of the gradient transfer function table
Returns
- list[float, float]
scalar value of the gradient image array and alpha value
- getGradientTransferSize() int
Get number of elements in the gradient transfer function of the current SisypheColorTransfer instance.
Returns
- int
number of elements in the gradient transfer function
- getGradientValueFromAlpha(a: float) float | None
Get gradient value from alpha in the gradient transfer function table of the current SisypheColorTransfer instance.
Parameters
- afloat | None
alpha value
Returns
- float | None
gradient value in the alpha transfer function table, None if not in the table.
- getID() str
Get ID attribute of the current SisypheColorTransfer instance.
Returns
- str
ID attribute
- getRange() tuple[float, float]
Get scalar values range in the image array.
Returns
- tuple[float, float]
minimum and maximum scalar values in the image array
- getValueFromAlpha(a: float) float | None
Get scalar value from alpha in the alpha transfer function table of the current SisypheColorTransfer instance.
Parameters
- afloat
alpha value
Returns
- float | None
scalar value in the alpha transfer function table, None if not in the table.
- getValueFromColor(r: float | None = None, g: float | None = None, b: float | None = None, rgb: list[float] | tuple[float, float, float] | None = None) float | None
Get scalar value from color in the color transfer function table of the current SisypheColorTransfer instance.
Parameters
- rfloat | None
red component of the color
- gfloat | None
green component of the color
- bfloat | None
blue component of the color
- rgbtuple[float, float, float, float] | list[float, float, float, float] | None
scalar value of the image array then red, green and blue components
Returns
- float | None
scalar value in the color transfer function table, None if not in the table.
- hasAlphaElement(v: float | None = None, a: float | None = None, va: tuple[float, float] | list[float] | None = None) int | None
Check whether the value/alpha parameters are is the alpha transfer function of the current SisypheColorTransfer instance.
Parameters
- vfloat | None
scalar value of the image array
- afloat | None
alpha value
- vatuple[float, float] | list[float, float] | None
scalar value of the image array and alpha value
Returns
- int | None
index of the item in the alpha transfer function table, None if not in the table.
- hasAlphaTransferValue(v: float) int | None
Check whether the scalar value v is in the alpha transfer function of the current SisypheColorTransfer instance.
Parameters
- vfloat
scalar value in the image array
Returns
- int | None
index of the scalar value in the alpha transfer function table, None if not in the table.
- hasColorElement(v: float | None = None, r: float | None = None, g: float | None = None, b: float | None = None, vrgb: tuple[float, float, float, float] | list[float] | None = None) int | None
Check whether the value/color parameters are is the color transfer function of the current SisypheColorTransfer instance.
Parameters
- vfloat | None
scalar value of the image array
- rfloat | None
red component of the color
- gfloat | None
green component of the color
- bfloat | None
blue component of the color
- vrgbtuple[float, float, float, float] | list[float, float, float, float] | None
scalar value of the image array then red, green blue components
Returns
- int | None
index of the color item in the color transfer function table, None if not in the table
- hasColorTransferValue(v: float) int | None
Check whether the scalar value v is in the color transfer function of the current SisypheColorTransfer instance.
Parameters
- vfloat
scalar value in the image array
Returns
- int | None
index of the scalar value in the color transfer function table, None if not in the table.
- hasGradientElement(v: float | None = None, a: float | None = None, va: tuple[float, float] | list[float] | None = None) int | None
Check whether the gradient value/alpha parameters are is the gradient transfer function of the current SisypheColorTransfer instance.
Parameters
- vfloat | None
scalar value of the gradient image array
- afloat | None
alpha value
- vatuple[float, float] | list[float, float] | None
scalar value of the gradient image array and alpha value
Returns
- int | None
index of the item in the gradient transfer function table, None if not in the table.
- hasGradientTransferValue(v: float) int | None
Check whether the scalar value v is in the gradient transfer function of the current SisypheColorTransfer instance.
Parameters
- vfloat
scalar value in the gradient image array
Returns
- int | None
index of the scalar value in the gradient transfer function table, None if not in the table.
- hasID() bool
Check whether the ID attribute of the current SisypheColorTransfer is defined (not None).
Returns
- bool
True if ID is not None
- hasSameID(ID: str | SisypheVolume) bool
Check whether the ID parameter is identical to that of the current SisypheColorTransfer instance ID.
Parameters
- IDstr | Sisyphe.core.sisypheVolume.SisypheVolume
ID attribute
Returns
- bool
True if IDs are identical
- init() None
Initialize all three transfer functions of the current SisypheColorTransfer instance with default values.
Black color for the minimum value of the image array.
White color for the maximum value of the image array.
Default range between 0.0 and 1.0.
- isAlphaTransferEmpty() bool
Check whether the alpha transfer function of the current SisypheColorTransfer instance is empty.
Returns
- bool
True if alpha transfer function is empty
- isColorTransferEmpty() bool
Check whether the color transfer function of the current SisypheColorTransfer instance is empty.
Returns
- bool
True if color transfer function is empty
- isEmpty() bool
Check whether all three transfer function of the current SisypheColorTransfer instance are empty.
Returns
- bool
True if all three transfer functions are empty
- isEqual(buff: SisypheColorTransfer) bool
Check whether all three transfer functions of the parameter are identical to those of the current SisypheColorTransfer instance.
Parameters
- buffSisypheColorTransfer
color transfer function to compare
Returns
- bool
True if all three transfer functions are identical
- isGradientTransferEmpty() bool
Check whether the gradient transfer function of the current SisypheColorTransfer instance is empty.
Returns
- bool
True if gradient transfer function is empty
- isSameAlphaTransfer(buff: SisypheColorTransfer) bool
Check whether the alpha transfer function of the parameter is identical to that of the current SisypheColorTransfer instance.
Parameters
- buffSisypheColorTransfer
alpha transfer function to compare
Returns
- bool
True if alpha transfer functions are identical
- isSameColorTransfer(buff: SisypheColorTransfer) bool
Check whether the color transfer function of the parameter is identical to that of the current SisypheColorTransfer instance.
Parameters
- buffSisypheColorTransfer
color transfer function to compare
Returns
- bool
True if color transfer functions are identical
- isSameGradientTransfer(buff: SisypheColorTransfer) bool
Check whether the gradient transfer function of the parameter is identical to that of the current SisypheColorTransfer instance.
Parameters
- buffSisypheColorTransfer
gradient transfer function to compare
Returns
- bool
True if gradient transfer functions are identical
- loadFromXML(filename: str) None
Load current SisypheColorTransfer instance attributes from xml file (.xtfer).
Parameters
- filenamestr
xml file name (.xtfer)
- classmethod openColorTransfer(filename: str) SisypheColorTransfer
Create a SisypheColorTransfer instance from a color Transfer file (.xtfer).
Parameters
- filenamestr
color Transfer file name
Returns
- SisypheColorTransfer
loaded color Transfer
- removeAlphaTransferElement(index: int | None = None, v: float | None = None) None
Remove an item in the alpha transfer function of the current SisypheColorTransfer instance. Item is identified by an index in the alpha transfer function table or by a scalar value of the image array.
Parameters
- indexint | None
index in the alpha transfer function table
- vfloat | None
scalar value of the image array
- removeColorTransferElement(index: int | None = None, v: float | None = None) None
Remove a color in the color transfer function of the current SisypheColorTransfer instance. Color is identified by an index in the color transfer function table or by a scalar value of the image array.
Parameters
- indexint | None
index in the color transfer function table
- vfloat | None
scalar value of the image array
- removeGradientTransferElement(index: int | None = None, v: float | None = None) None
Remove an item in the gradient transfer function of the current SisypheColorTransfer instance. Item is identified by an index in the gradient transfer function table or by a scalar value of the image array.
Parameters
- indexint | None
index in the gradient transfer function table
- vfloat | None
scalar value of the gradient image array
- saveToXML(filename: str) None
Save current SisypheColorTransfer instance attributes to xml file (.xtfer).
Parameters
- filenamestr
xml file name (.xtfer)
- setAlphaTransfer(alphatransfer: vtkPiecewiseFunction) None
Set the alpha transfer function of the current SisypheColorTransfer instance.
Parameters
- alphatransfervtk.vtkPiecewiseFunction
alpha transfer function to copy
- setAlphaTransferElement(index: int | None = None, v: float | None = None, a: float | None = None, va: tuple[float, float] | list[float] | None = None) None
Set alpha value in the alpha transfer function of the current SisypheColorTransfer instance.
Parameters
- indexint
index in the alpha transfer function table
- vfloat | None
scalar value of the image array
- afloat | None
alpha value
- vatuple[float, float] | list[float, float] | None
scalar value of the image array and alpha value
- setColorTransfer(colortransfer: vtkColorTransferFunction) None
Set the color transfer function of the current SisypheColorTransfer instance.
Parameters
- colortransfervtk.vtkColorTransferFunction
color transfer function to copy
- setColorTransferElement(index: int | None = None, v: float | None = None, r: float | None = None, g: float | None = None, b: float | None = None, vrgb: tuple[float, float, float, float] | list[float] | None = None) None
Set color in the color transfer function of the current SisypheColorTransfer instance.
Parameters
- indexint
index in the color transfer function table
- vfloat | None
scalar value of the image array
- rfloat | None
red component of the color
- gfloat | None
green component of the color
- bfloat | None
blue component of the color
- vrgbtuple[float, float, float, float] | list[float, float, float, float] | None
scalar value of the image array then red, green and blue components
- setDefault(volume: SisypheVolume) None
Initialize all three transfer functions of the current SisypheColorTransfer instance with default values. Black color for the minimum value of the image array. White color for the maximum value of the image array.
- setDefaultAlpha(volume: SisypheVolume) None
Initialize the alpha transfer function of the current SisypheColorTransfer instance with default values.
Transparent color (alpha=0) for the minimum value of the image array.
Opaque color (alpha=1.0) for the maximum value of the image array.
- setDefaultColor(volume: SisypheVolume) None
Initialize the color transfer function of the current SisypheColorTransfer instance with default values.
Black color for the minimum value of the image array.
White color for the maximum value of the image array.
- setDefaultGradient(volume: SisypheVolume) None
Initialize the gradient transfer function of the current SisypheColorTransfer instance with default values.
Transparent color (alpha=0) for the minimum value of the gradient image array.
Opaque color (alpha=1.0) for the maximum value of the gradient image array.
- setGradientTransfer(gradienttransfer: vtkPiecewiseFunction) None
Set the gradient transfer function of the current SisypheColorTransfer instance.
Parameters
- gradienttransfervtk.vtkPiecewiseFunction
gradient trasnfer function to copy
- setGradientTransferElement(index: int | None = None, v: float | None = None, a: float | None = None, va: tuple[float, float] | list[float] | None = None) None
Set alpha value in the gradient transfer function of the current SisypheColorTransfer instance.
Parameters
- indexint
index in the gradient transfer function table
- vfloat | None
scalar value of the gradient image array
- afloat | None
alpha value
- vatuple[float, float] | list[float, float] | None
scalar value of the gradient image array and alpha value
- setID(ID: str | SisypheVolume) None
Set ID attribute of the current SisypheColorTransfer instance.
Parameters
- IDstr | Sisyphe.core.sisypheVolume.SisypheVolume
ID attribute
- class Sisyphe.core.sisypheLUT.SisypheLut(name: str | None = None)
SisypheLut class
Description
Class to manage look-up table colormaps.
Scope methods:
container-like methods (color elements)
copy from/to list, numpy.ndarray, matplotlib
bitmap preview
IO methods
Inheritance
object -> SisypheLut
Creation: 07/11/2022 Last revision: 25/10/2024
- copy() SisypheLut
Copy of the current SisypheLut instance (deep copy).
Returns
- SisypheLut
lut copy
- copyFrom(buff: SisypheLut) None
Copy SisypheLut attributes to the current SisypheLut instance (deep copy).
Parameters
- buffSisypheLut
lut to copy
- copyFromList(clist: list[list[float]]) None
Copy look-up table colormap sent as list parameter to the current SisypheLut instance.
Parameters
- clistlist[list[float, float, float, float]]
list of 255 colors (red, green, blue, alpha) to copy.
- copyFromMatplotlibColormap(cmap: ListedColormap | LinearSegmentedColormap) None
Copy matplotlib look-up table colormap sent as parameter to the current SisypheLut instance.
Parameters
- cmapmatplotlib.colors.ListedColormap, look-up table colormap | matplotlib.colors.LinearSegmentedColormap
lut to copy
- copyFromNumpy(cnp: ndarray) None
Copy look-up table colormap sent as numpy.ndarray parameter to the current SisypheLut instance.
Parameters
- cnpnumpy.ndarray
ndarray of 255 colors (red, green, blue, alpha) to copy.
- copyToList() list[list[float]]
Copy look-up table colormap of the current SisypheLut instance to a list.
Returns
- list[list[float, float, float, float]]
list of 255 colors (red, green, blue, alpha)
- copyToMatplotlibColormap() ListedColormap
Copy look-up table colormap of the current SisypheLut instance to a matplotlib.colors.ListedColormap.
Returns
- matplotlib.colors.ListedColormap
lut copy
- copyToNumpy() ndarray
Copy look-up table colormap of the current SisypheLut instance to a numpy array.
Returns
- numpy.ndarray
ndarray of 255 colors (red, green, blue, alpha) copy.
- getBitmapPreview(width: int, height: int) QImage
Get a look-up table colormap bitmap preview of the current SisypheLut instance.
Parameters
- widthint
bitmap preview width
- heightint
bitmap preview height
Returns
- PyQt5.QtGui.QImage
bitmap preview
- getColor(i: int) tuple[float, float, float, float]
Get the color (red, green, blue, alpha) at index i in the look-up table colormap of the current SisypheLut instance.
Parameters
- iint
colormap index
Returns
- tuple[float, float, float, float]
color (red, green, blue, alpha)
- classmethod getColormapFromName(name: str) str
Get public name of a Look-Up table colormap from its internal name.
Parameters
name : str, internal name
Returns
- str
public name
- classmethod getColormapList() list[str]
Get list of available Look-up table colormaps.
Returns
- list[str]
list of available Look-up table colormaps
- classmethod getDefaultLutDirectory() str
Get default lut directory (~/gui/lut)
Returns
- str
lut directory (~/gui/lut)
- getFilename() str | None
Get the look-up table colormap filename of the current SisypheLut instance.
Returns
- str | None
look-up table colormap filename if type is ‘file’, None otherwise
- classmethod getFilterExt() str
Get SisypheLut filter used by QFileDialog.getOpenFileName() and QFileDialog.getSaveFileName().
Returns
- str
‘PySisyphe Lut (.xlut)’
- getIntColor(i: int) tuple[int, int, int, int]
Get the color (red, green, blue, alpha) at index i in the look-up table colormap of the current SisypheLut instance.
Parameters
- iint
colormap index
Returns
- tuple[int, int, int, int]
color (red, green, blue, alpha)
- getLUTType(string: bool = True) str | int
Get the look-up table colormap type of the current SisypheLut instance.
Parameters
- stringbool
if true returns str code, otherwise int code (0 ‘default’, 1 ‘internal’, 2 ‘file’, 3 ‘custom’)
Returns
- str | int
look-up table colormap type
- getName() str
Get the name of the look-up table colormap of the current SisypheLut instance.
Returns
- str
lut name
- getQColor(i: int) QColor
Get the color (Qt color) at index i in the look-up table colormap of the current SisypheLut instance.
Parameters
- iint
colormap index
Returns
- PyQt5.QtGui.QColor
Qt color
- getReversedLut() SisypheLut
Copy of the current SisypheLut instance (deep copy) in reverse color order.
Returns
- SisypheLut
reversed LUT
- getWindowRange() tuple[float, float]
Get the windowing range of the look-up table colormap of the current SisypheLut instance.
Returns
- tuple[float, float]
minimum and maximum values of the window
- getvtkLookupTable() vtkLookupTable
Get the look-up table colormap attribute of the current SisypheLut instance.
Returns
- vtk.vtkLookupTable
VTK lut
- isCustomLut() bool
Check whether look-up table colormap type of the current SisypheLut instance is ‘custom’.
Returns
- bool
True if look-up table colormap type is ‘custom’
- isDefaultLut() bool
Check whether look-up table colormap type of the current SisypheLut instance is ‘default’ (grayscale).
Returns
- bool
True if look-up table colormap type is ‘default’
- isEqual(buff: ListedColormap | LinearSegmentedColormap | SisypheLut) bool
Check whether the look-up table colormap of the current SisypheLut instance is identical to the one sent as parameter.
Parameters
- buffListedColormap | LinearSegmentedColormap | SisypheLut
look-up table colormap
Returns
- bool
True if lut are identical
- isFileLut() bool
Check whether look-up table colormap type of the current SisypheLut instance is ‘file’.
Returns
- bool
True if look-up table colormap type is ‘file’
- isInternalLut() bool
Check whether look-up table colormap type of the current SisypheLut instance is ‘internal’.
Returns
- bool
True if look-up table colormap type is ‘internal’
- isSameColor(i: int, c: tuple[float, float, float, float] | list[float] | QColor) bool
Check whether color at the index i in the look-up table colormap of the current SisypheLut instance identical to a color c given in parameter.
Parameters
- iint
colormap index
- ctuple[float, float, float, float] | list[float, float, float, float] | QColor
color
Returns
- bool
True if colors are identical
- load(filename: str) None
Load current SisypheLut instance attributes from lut file (.lut).
Parameters
- filenamestr
lut file name (.lut)
- loadFromOlt(filename: str) None
Load current SisypheLut instance attributes from BrainVoyager lut file (.olt).
Parameters
- filenamestr
BrainVoyager lut file name (.olt)
- loadFromTxt(filename: str) None
Load current SisypheLut instance attributes from text file (.txt).
Parameters
- filenamestr
text file name (.txt)
- loadFromXML(filename: str) None
Load current SisypheLut instance attributes from xml file (.xlut).
Parameters
- filenamestr
xml file name (.xlut)
- classmethod openLut(filename: str) SisypheLut | None
Create a SisypheLut instance from a Look-Up table colormap file.
Parameters
- filenamestr
lut file name (supported formats ‘xlut’, ‘.lut’, ‘.olt’, ‘.txt’)
Returns
- SisypheLut
loaded lut.
- reverseLut() None
Reverse the color order in the look-up table colormap of the current SisypheLut instance.
- save(filename: str) None
Save current SisypheLut instance attributes to lut file (.lut).
Parameters
- filenamestr
lut file name (.lut)
- saveBitmapPreview(width: int, height: int, format: str = 'jpg') None
Save a look-up table colormap bitmap preview of the current SisypheLut instance.
Parameters
- widthint
bitmap preview width
- heightint
bitmap preview height
- formatstr
bitmap file format (‘bmp’, ‘jpg’ default, ‘png’)
- saveToTxt(filename: str) None
Save current SisypheLut instance attributes to text file (.txt).
Parameters
- filenamestr
text file name (.txt)
- saveToXML(filename: str) None
Save current SisypheLut instance attributes to xml file (.xlut).
Parameters
- filenamestr
xml file name (.xlut)
- setColor(i: int, r: float, g: float, b: float, a: float = 1.0) None
Set a color (red, green, blue, alpha) to index i in the look-up table colormap of the current SisypheLut instance.
Parameters
- iint
colormap index
- rfloat
red value (0.0 to 1.0)
- gfloat
green value (0.0 to 1.0)
- bfloat
blue value (0.0 to 1.0)
- afloat,
alpha value (0.0 to 1.0)
- setDefaultLut() None
Set look-up table colormap of the current SisypheLut instance to ‘gray’ (default).
- setDisplayBelowRangeColorOff() None
Set transparent color (alpha=0) to display values below the minimum window value of the current SisypheLut instance.
- setDisplayBelowRangeColorOn() None
Set opaque black color (alpha=1.0) to display values below the minimum window value of the current SisypheLut instance.
- setIntColor(i: int, r: int, g: int, b: int, a: int = 255)
Set a color (red, green, blue, alpha) to index i in the look-up table colormap of the current SisypheLut instance.
Parameters
- iint
colormap index
- rint
red value (0 to 255)
- gint
green value (0 to 255)
- bint
blue value (0 to 255)
- aint
alpha value (0 to 255)
- setInternalLut(name: str) None
Set look-up table colormap of the current SisypheLut instance.
Parameters
- namestr
lut name
- setLut(name: str) None
Set look-up table colormap of the current SisypheLut instance. If the name doesn’t appear in the internal lut list, try opening a file with the same name from the default lut directory.
Parameters
- namestr
lut name
- setLutSpring() None
Set look-up table colormap of the current SisypheLut instance to ‘spring’.
- setLutToAutumn() None
Set look-up table colormap of the current SisypheLut instance to ‘autumn’.
- setLutToCool() None
Set look-up table colormap of the current SisypheLut instance to ‘cool’.
- setLutToGNU() None
Set look-up table colormap of the current SisypheLut instance to ‘gnu’.
- setLutToGNU2() None
Set look-up table colormap of the current SisypheLut instance to ‘gnu2’.
- setLutToHeat() None
Set look-up table colormap of the current SisypheLut instance to ‘heat’.
- setLutToHot() None
Set look-up table colormap of the current SisypheLut instance to ‘hot’.
- setLutToJet() None
Set look-up table colormap of the current SisypheLut instance to ‘jet’.
- setLutToRainbow() None
Set look-up table colormap of the current SisypheLut instance to ‘rainbow’.
- setLutToSpectral() None
Set look-up table colormap of the current SisypheLut instance to ‘spectral’.
- setLutToSummer() None
Set look-up table colormap of the current SisypheLut instance to ‘summer’.
- setLutToWinter() None
Set look-up table colormap of the current SisypheLut instance to ‘winter’.
- setQColor(i: int, c: QColor) None
Set a color (Qt color) to index i in the look-up table colormap of the current SisypheLut instance.
Parameters
- iint
colormap index
- cPyQt5.QtGui.QColor
Qt color
- Sisyphe.core.sisypheLUT.lutConversion(filenames: str | list[str], out: str = 'xlut') None
Batch look-up table colormaps conversion. Supported formats are .lut, .xlut, .olt, .txt
Parameters
- filenamesstr | list[str]
list of look-up table colormaps file names
- outstr
conversion target format ‘.lut’, ‘.xlut’ (default), ‘.olt’, ‘.txt’
- Sisyphe.core.sisypheLUT.saveColormapBitmapPreview(filenames: str | list[str], format: str = 'jpg') None
Save a bitmap preview of look-up table colormap files.
Parameters
- filenamesstr | list[str]
list of look-up table colormaps file names
- formatstr
saved bitmap file format ‘bmp’, ‘jpg’ (default), ‘png’