Sisyphe.core.sisypheROI
External packages/modules
cython, static compiler, https://cython.org/
ANTs, image registration, http://stnava.github.io/ANTs/
Numpy, scientific computing, https://numpy.org/
pandas, data analysis and manipulation tool, https://pandas.pydata.org/
PyQt5, Qt GUI, https://www.riverbankcomputing.com/software/pyqt/
radiomics, radiomics features and texture analysis, https://pyradiomics.readthedocs.io/en/latest/
scipy, scientific computing, https://scipy.org/
SimpleITK, medical image processing, https://simpleitk.org/
scikit-image, image processing, https://scikit-image.org/
vtk, visualization engine/3D rendering, https://vtk.org/
- class Sisyphe.core.sisypheROI.SisypheROI(image: str | Image | ndarray | vtkImageData | ANTsImage | SisypheImage | None = None, copy: bool = True, **kargs)
Description
PySisyphe region-of-interest (ROI) binary image class.
Scope of methods:
display management (color, opacity, visibility),
flip/shift,
morphology operators (dilate, erode, closing, opening),
fill holes,
blob (connected component),
2D shape drawing (line, disk, ellipse, square, rectangle, polygon),
3D shape drawing (cube, Parallelepiped, sphere),
mesh conversion,
IO methods (native format and BrainVoyager VOI format),
methods inherited from the SisypheImage class.
Inheritance
object -> SisypheImage -> SisypheBinaryImage -> SisypheROI
Creation: 08/09/2022 Last revision: 21/09/2024
- classmethod addInstance() None
Increment the SisypheROI instance count. This class method is called by the constructor.
- clear() None
Clear the ROI image of the current SisypheROI instance (Filling roi with 0).
- clearBorderBlobs()
Clear blob(s) connected to the border of the current SisypheROI instance. The current SisypheROI instance is overwritten.
- copy() SisypheROI
SisypheROI copy of the current SisypheROI instance.
Returns
- SisypheROI
roi copy
- copyAttributesFrom(roi: SisypheROI) None
Copy the attributes (reference ID, name, file name, color, opacity) of the parameter SisypheROI instance to the current SisypheROI instance.
Parameters
- roiSisypheROI
roi from which attributes are copied
- copyAttributesTo(roi: SisypheROI) None
Copy the attributes (reference ID, name, file name, color, opacity) of the current SisypheROI instance to the parameter SisypheROI instance.
Parameters
- roiSisypheROI
roi where attributes are copied
- copyToSisypheVolume() SisypheVolume
Copy fo the SisypheROI instance to a SisypheVolume instance. Deep copy of the SimpleITK image attribute. Image buffer is not shared between SisypheROI and SisypheVolume instances.
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
deep copy of roi
- createXML(doc: Document, single: bool = True) None
Write the current SisypheROI 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
- singlebool
if True, saved in a single file (xml part + binary part)
if False, The xml part is saved in .xroi file and the binary part in .raw file
- createXMLOld(doc: Document) None
Deprecated, use createXML() method
- drawCube(p: list[int] | tuple[int, int, int], extent: int) None
Draw a cube in the ROI image of the current SisypheROI instance.
Parameters
- ptuple[int, int, int] | list[int, int, int]
x, y, z origin coordinates
- extentint
length of cube sides (in voxels)
- drawDisk(p: list[int] | tuple[int, int, int], radius: int, orient: int = 0) None
Draw a disk in the ROI image of the current SisypheROI instance.
Parameters
- ptuple[int, int, int] | list[int, int, int]
x, y, z center point coordinates
- radiusint
disk radius (in voxels)
- orientint
slice orientation (0 axial, 1 coronal, 2 sagittal)
- drawEllipse(p: list[int] | tuple[int, int, int], radius: list[int] | tuple[int, int], rot: float = 0.0, orient: int = 0) None
Draw an ellipse in the ROI image of the current SisypheROI instance.
Parameters
- ptuple[int, int, int] | list[int, int, int]
x, y, z center point coordinates
- radiustuple[int, int] | list[int, int]
radius in x and y axes (in voxels)
- rotfloat
set the ellipse rotation in radians (between -pi and pi, default 0.0)
- orientint
slice orientation (0 axial, 1 coronal, 2 sagittal)
- drawLine(p0: list[int] | tuple[int, int, int], p1: list[int] | tuple[int, int, int], orient: int = 0) None
Draw a line in the ROI image of the current SisypheROI instance. Line is drawn in a single slice (points p0 and p1 must be within the same slice)
Parameters
- p0tuple[int, int, int] | list[int, int, int]
x, y, z first point coordinates
- p1tuple[int, int, int] | list[int, int, int]
x, y, z second point coordinates
- orientint
slice orientation (0 axial, 1 coronal, 2 sagittal)
- drawParallelepiped(p: list[int] | tuple[int, int, int], extent: list[int] | tuple[int, int, int]) None
Draw a parallelepiped in the ROI image of the current SisypheROI instance.
Parameters
- ptuple[int, int, int] | list[int, int, int]
x, y, z origin coordinates
- extenttuple[int, int, int] | list[int, int, int]
width, height and depth (in voxels)
- drawPolygon(p: list[list[int]], orient: int = 0) None
Draw a polygon in the ROI image of the current SisypheROI instance. Polygon is drawn in a single slice (all points must be within the same slice).
Parameters
- plist[list[int]]
- list of 3 list[int]:
first list[int], x coordinates of points
second list[int], y coordinates of points
third list[int], z coordinates of points
- orientint
slice orientation (0 axial, 1 coronal, 2 sagittal)
- drawRectangle(p: list[int] | tuple[int, int, int], extent: list[int] | tuple[int, int], orient: int = 0) None
Draw a rectangle in the ROI image of the current SisypheROI instance.
Parameters
- ptuple[int, int, int] | list[int, int, int]
x, y, z origin coordinates
- extenttuple[int, int] | list[int, int]
width and height (in voxels)
- orientint
slice orientation (0 axial, 1 coronal, 2 sagittal)
- drawSphere(p: list[int] | tuple[int, int, int], radius: int) None
Draw a sphere in the ROI image of the current SisypheROI instance.
Parameters
- ptuple[int, int, int] | list[int, int, int]
x, y, z center coordinates
- radiusint
sphere radius (in voxels)
- drawSquare(p: list[int] | tuple[int, int, int], extent: int, orient: int = 0) None
Draw a square in the ROI image of the current SisypheROI instance.
Parameters
- ptuple[int, int, int] | list[int, int, int]
x, y, z origin coordinates
- extentint
length of square sides (in voxels)
- orientint
slice orientation (0 axial, 1 coronal, 2 sagittal)
- fillHoles() None
Fill holes in the ROI image of the current SisypheROI instance. The current SisypheROI instance is overwritten.
- flip(fx: bool = False, fy: bool = False, fz: bool = False) None
Flip ROI image axes of the current SisypheROI instance. The current SisypheROI instance is overwritten.
Parameters
- fxbool
flip x-axis if True (default False)
- fybool
flip y-axis if True (default False)
- fzbool
flip z-axis if True (default False)
- fromIndexes(idx: list | ndarray) None
Set voxels from a list of indexes (x, y, z).
Parameters
- idxlist | ndarray
list of voxels indexes
- getAlpha() float
Set the ROI opacity of the current SisypheROI instance.
Returns
- float
opacity, between 0.0 and 1.0
- getBlobCount() int
Get the number of blobs (connected components) in the ROI image of the current SisypheROI instance.
Returns
- int
number of blobs
- getBlobLargerThan(n: int) SisypheROI
Remove blobs (connected components) with less than n voxels from the ROI image of a copy of the current SisypheROI instance.
Returns
- SisypheROI
processed roi
- getClearBorderBlobs() SisypheROI
Clear blob(s) connected to the border of the current SisypheROI instance.
Returns
- SisypheROI
processed roi
- getColor() list[float] | tuple[float, float, float]
Get the roi color of the current SisypheROI instance.
Returns
- tuple[float, float, float]
roi color, red, green, blue (0.0 <= value <= 1.0)
- getCompression() bool
Get the gzip file compression attribute of the current SisypheROI instance. PySisyphe ROI format (.xroi) can be optionally gzipped.
Returns
- bool
True if compression is on
- getDirname() str
Get path part (dirname) of the file name attribute of the current SisypheROI instance.
Returns
- str
path part of the file name attribute
- getDistanceMap(blob: int = 0, output: str = 'xvol') Image | ndarray | SisypheVolume
Calculates the Euclidean distance transform of the current SisypheROI instance.
Parameters
- blobint
blob index or 0 (all image, default)
- outputstr
output image type: ‘sitk’, ‘numpy’, ‘xvol’
Returns
- SimpleITK.Image | numpy.ndarray | Sisyphe.core.sisypheVolume.SisypheVolume
distance map
- getEulerNumber(connectivity: int = 26) int
Calculate the Euler characteristic of the current SisypheROI instance. The Euler number is obtained as the number of blobs plus the number of holes, minus the number of tunnels, or loops.
Parameters
- connectivityint
6 or 26
Returns
- int
Euler number
- getFilename() str
Get the file name attribute of the current SisypheROI instance. This file name is used by save() method.
Returns
- str
file name
- getFilenamePrefix(sep: str = '_') str
Get prefix (if any) from the file name attribute of the current SisypheROI instance.
Parameters
- sepstr
char between prefix and base name (default ‘_’)
Returns
- str
prefix
- getFilenameSuffix(sep: str = '_') str
Get suffix (if any) from the file name attribute of the current SisypheROI instance.
Parameters
- sepstr
char between prefix and base name (default ‘_’)
Returns
- str
suffix
- getFillHoles() SisypheROI
Fill holes in the ROI image of a copy of the current SisypheROI instance.
Returns
- SisypheROI
roi without hole
- classmethod getFilterExt() str
Get SisypheROI filter used by QFileDialog.getOpenFileName() and QFileDialog.getSaveFileName().
Returns
- str
‘PySisyphe ROI (.xroi)’
- getFlip(fx: bool = False, fy: bool = False, fz: bool = False) SisypheROI
Flip ROI image axes of a copy of the current SisypheROI instance.
Parameters
- fxbool
flip x-axis if True (default False)
- fybool
flip y-axis if True (default False)
- fzbool
flip z-axis if True (default False)
Returns
- SisypheROI
flipped roi
- getLut() SisypheLut
Get the look-up table colormap attribute of the current SisypheROI instance. The Lut attribute exists only for compatibility with SisypheImage ancestor class and display widgets. All lut elements have the same color, i.e. the color attribute of the current SisypheROI instance.
Returns
- Sisyphe.core.sisypheLUT.SisypheLut
roi lut
- getMajorBlob() SisypheROI
Clear all blobs (connected components) except the major one (most voxels) in the ROI image of a copy of the current SisypheROI instance.
Returns
- SisypheROI
processed roi
- getMorphoClosing(radius: int = 1, struct: int = 1) SisypheROI
ROI image morphological closing of a copy of the current SisypheROI instance.
Parameters
- radiusint
structuring element radius (in voxels)
- structint
structuring element shape, SimpleITK code (0 sitkAnnulus, 1 sitkBall, 2 sitkBox, 3 sitkCross)
Returns
- SisypheROI
morphology closing roi
- getMorphoDilate(radius: int = 1, struct: int = 1) SisypheROI
ROI image morphological dilatation of a copy of the current SisypheROI instance.
Parameters
- radiusint
structuring element radius (in voxels)
- structint
structuring element shape, SimpleITK code (0 sitkAnnulus, 1 sitkBall, 2 sitkBox, 3 sitkCross)
Returns
- SisypheROI
dilated roi
- getMorphoErode(radius: int = 1, struct: int = 1) SisypheROI
ROI image morphological erosion of a copy of the current SisypheROI instance.
Parameters
- radiusint
structuring element radius (in voxels)
- structint
structuring element shape, SimpleITK code (0 sitkAnnulus, 1 sitkBall, 2 sitkBox, 3 sitkCross)
Returns
- SisypheROI
eroded roi
- getMorphoOpening(radius: int = 1, struct: int = 1) SisypheROI
ROI image morphological opening of a copy of the current SisypheROI instance.
Parameters
- radiusint
structuring element radius (in voxels)
- structint
structuring element shape, SimpleITK code (0 sitkAnnulus, 1 sitkBall, 2 sitkBox, 3 sitkCross)
Returns
- SisypheROI
morphology opening roi
- getPruning(blob: int = 0) SisypheROI
Remove “spurs” of less than a certain length in the current SisypheROI instance.
Parameters
- blobint
blob index or 0 (whole image, default)
Returns
- SisypheROI
processed roi
- getQColor() QColor
Get the mesh color (as QColor) of the current SisypheROI instance.
Returns
- PyQt5.QtGui.QColor
roi color
- getReferenceID() str
Get reference ID attribute of the current SisypheROI instance. A ROI is defined in the space of a reference SisypheVolume whose ID is the reference ID.
Returns
- str
reference ID
- classmethod getRegExp() str
Get the regular expression filter applied to roi name attribute.
Returns
- str
regular expression filter
- getRemoveBlobByDistance(d: float) SisypheROI
Remove blobs until the remaining ones are spaced more than a given distance from one another. By default, smaller objects are removed first.
Parameters
- dfloat
minimal distance between blobs in mm
Returns
- SisypheROI
processed roi
- getShift(sx: int = 0, sy: int = 0, sz: int = 0) SisypheROI
ROI image shift of a copy of the current SisypheROI instance.
Parameters
- sxint
shift of sx voxels in x-axis (default 0)
- syint
shift of sy voxels in y-axis (default 0)
- szint
shift of sz voxels in z-axis (default 0)
Returns
- SisypheROI
shifted roi
- getSisypheVolume() SisypheVolume
SisypheROI instance view to a SisypheVolume instance. Shallow copy of the SimpleITK image attribute. Image buffer is shared between SisypheROI and SisypheVolume instances.
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
shallow copy of roi
- getSkeletonize(blob: int = 0) SisypheROI
Calculate the skeleton of the current SisypheROI instance.
Parameters
- blobint
blob index or 0 (whole image, default)
Returns
- SisypheROI
skeleton roi
- getVisibility() bool
Get the ROI visibility of the current SisypheROI instance.
Returns
- bool
True if visible
- getVtkContourActor() vtkActor
Create a 3D contour of the ROI mask of the current SisypheROI instance (uses vtk.vtkContourFilter).
Returns
- vtk.vtkActor
vtkActor surface of roi
- getVtkContourPolyData() vtkPolyData
Create a 3D contour of the ROI mask of the current SisypheROI instance (uses vtk.vtkContourFilter).
Returns
- vtk.vtkPolyData
vtkPolydata surface of roi
- getVtkMarchingCubeContourActor() vtkActor
Create a 3D contour of the ROI mask of the current SisypheROI instance (uses vtk.vtkMarchingCubes).
Returns
- vtk.vtkActor
vtkActor surface of roi
- getVtkMarchingCubeContourPolyData() vtkPolyData
Create a 3D contour of the ROI mask of the current SisypheROI instance (uses vtk.vtkMarchingCubes).
Returns
- vtk.vtkPolyData
vtkPolydata surface of roi
- getvtkLookupTable() vtkLookupTable
Get the look-up table colormap attribute of the current SisypheROI instance. The Lut attribute exists only for compatibility with SisypheImage ancestor class and display widgets. All lut elements have the same color, i.e. the color attribute of the current SisypheROI instance.
Returns
- vtk.vtkLookupTable
roi lut
- hasFilename() bool
Check whether the current SisypheROI instance file name attribute is defined (!= ‘’)
Returns
- bool
True if file name attribute is defined
- hasReferenceID() bool
Check if the reference ID of the current SisypheROI instance is defined (not ‘’).
Returns
- bool
True if reference ID is defined
- load(filename: str) None
Load the current SisypheROI instance from a PySisyphe ROI (.xroi) file.
Parameters
- filenamestr
PySisyphe ROI file name
- loadFromBrainVoyagerVOI(vmr: str, voi: str, index: int = 0) None
Load the current SisypheROI instance from BrainVoyager files. BrainVoyager’s ROI format can include several ROIs, an index parameter is provided to select the ROI to be loaded.
Parameters
- vmrstr
BrainVoyager image file name (.vmr)
- voistr
BrainVoyager ROI file name (.voi)
- indexint
ROI index in the BrainVoyager ROI file
- loadFromSisyphe(filename: str, index: int = 0) None
Load the current SisypheROI instance from old Sisyphe ROI (.roi) file.
Parameters
- filenamestr
old Sisyphe ROI file name
- indexint
ROI index in the old Sisyphe ROI file (default 0, first ROI)
- loadOld(filename: str) None
Deprecated, use load() method
- morphoClosing(radius: int = 1, struct: int = 1) None
ROI image morphological closing of the current SisypheROI instance. The current SisypheROI instance is overwritten.
Parameters
- radiusint
structuring element radius (in voxels)
- structint
structuring element shape, SimpleITK code (0 sitkAnnulus, 1 sitkBall, 2 sitkBox, 3 sitkCross)
- morphoDilate(radius: int = 1, struct: int = 1) None
ROI image morphological dilatation of the current SisypheROI instance. The current SisypheROI instance is overwritten.
Parameters
- radiusint
structuring element radius (in voxels)
- structint
structuring element shape, SimpleITK code (0 sitkAnnulus, 1 sitkBall, 2 sitkBox, 3 sitkCross)
- morphoErode(radius: int = 1, struct: int = 1) None
ROI image morphological erosion of the current SisypheROI instance. The current SisypheROI instance is overwritten.
Parameters
- radiusint
structuring element radius (in voxels)
- structint
structuring element shape, SimpleITK code (0 sitkAnnulus, 1 sitkBall, 2 sitkBox, 3 sitkCross)
- morphoOpening(radius: int = 1, struct: int = 1) None
ROI image morphological opening of the current SisypheROI instance. The current SisypheROI instance is overwritten.
Parameters
- radiusint
structuring element radius (in voxels)
- structint
structuring element shape, SimpleITK code (0 sitkAnnulus, 1 sitkBall, 2 sitkBox, 3 sitkCross)
- classmethod openROI(filename: str) SisypheROI
Create a SisypheROI instance from a PySisyphe ROI (.xroi) file format.
Parameters
- filenamestr
PySisyphe ROI file name
Returns
- SisypheROI
loaded ROI
- parseXML(doc: Document) dict
Read the current SisypheROI 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[str] Keys: - ‘size’, list[int], image size in each axis - ‘spacing’, list[float], voxel size in each axis - ‘array’, bytes, array image
- parseXMLOld(doc: Document) None
Deprecated, use parseXML() method
- pruning(blob: int = 0)
Remove “spurs” of less than a certain length in the current SisypheROI instance. The current SisypheROI instance is overwritten.
Parameters
- blobint
blob index or 0 (whole image, default)
- removeBlobByDistance(d: float)
Remove blobs until the remaining ones are spaced more than a given distance from one another. By default, smaller objects are removed first. The current SisypheROI instance is overwritten.
Parameters
- dfloat
minimal distance between blobs in mm
- save(filename: str = '', single: bool = True) None
Save the current SisypheROI instance to a PySisyphe ROI (.xroi) file. This method uses the file name attribute of the current SisypheROI instance.
Parameters
- filenamestr
PySisyphe ROI file name (optional), if filename is empty (‘’, default), the file name attribute of the current SisypheROI instance is used
- singlebool
if True, saved in a single file (xml part + binary part)
if False, The xml part is saved in .xroi file and the binary part in .raw file
- saveAs(filename: str, single: bool = True) None
Save the current SisypheROI instance to PySisyphe ROI (.xroi) file.
Parameters
- filenamestr
PySisypheROI file name
- singlebool
if True, saved in a single file (xml part + binary part)
if False, The xml part is saved in .xroi file and the binary part in .raw file
- saveAsOld(filename: str) None
Deprecated, use saveAs() method
- setAlpha(a: int | float) None
Set the ROI opacity of the current SisypheROI instance.
Parameters
- afloat | int
float, opacity, between 0.0 and 1.0
int, opacity, between 0 and 255
- setColor(r: float | int | None = None, g: float | int | None = None, b: float | int | None = None, rgb: list[float] | tuple[float, float, float] | list[int] | tuple[int, int, int] | None = None)
Set the ROI color of the current SisypheROI instance.
Parameters
- rfloat | None
roi color, 0.0 <= red <= 1.0
- gfloat | None
roi color, 0.0 <= green <= 1.0
- bfloat | None
roi color, 0.0 <= blue <= 1.0
- rgbtuple[float, float, float] | None
roi color, red, green, blue (0.0 <= value <= 1.0)
- setCompression(v: bool) None
Set the compression attribute of the current SisypheROI instance. PySisyphe ROI format (.xroi) can be optionally gzipped.
Parameters
- vbool
compression is enabled if True
- setCompressionOff() None
Disables gzip file compression of the current SisypheROI instance. PySisyphe ROI format (.xroi) can be optionally gzipped.
- setCompressionOn() None
Enables gzip file compression of the current SisypheROI instance. PySisyphe ROI format (.xroi) can be optionally gzipped.
- setDefaultFilename() None
Set default file name attribute of the current SisypheROI instance. This file name is used by save() method. Default file name = name attribute + roi file extension (.xroi)
- setDefaultName() None
Set default name attribute of the current SisypheROI instance. default name = ‘ROI’ + instance count.
- setDirname(path: str) None
Set path part (dirname) of the file name attribute of the current SisypheROI instance.
Parameters
- pathstr
replacement dirname
- setFilename(filename: str) None
Set the file name attribute of the current SisypheROI instance. This file name is used by save() method.
Parameters
- filenamestr
file name
- setFilenamePrefix(prefix: str, sep: str = '_') None
Set a prefix to the file name attribute of the current SisypheROI instance.
Parameters
- prefixstr
prefix to add
- sepstr
char between prefix and base name (default ‘_’)
- setFilenameSuffix(suffix: str, sep: str = '_') None
Set a suffix to the file name attribute of the current SisypheROI instance.
Parameters
- suffixstr
suffix to add
- sepstr
char between base name and suffix (default ‘_’)
- setName(name: str) None
Set the name attribute of the current SisypheROI instance.
Parameters
- namestr
roi name
- setPathFromVolume(volume: SisypheVolume) None
Set path part (dirname) of the file name attribute of the current SisypheROI instance from the path part of the file name attribute of a SisypheVolume parameter.
Parameters
- volumeSisyphe.core.sisypheVolume.SisypheVolume
volume used to replace dirname
- setQColor(c: QColor) None
Set the ROI color of the current SisypheROI instance from a QColor.
Parameters
- cPyQt5.QtGui.QColor
roi color
- setReferenceID(ID: SisypheROI | SisypheVolume | str) None
Set the reference ID attribute of the current SisypheROI instance. A ROI is defined in the space of a reference SisypheVolume whose ID is the reference ID.
Parameters
- IDstr | Sisyphe.core.sisypheROI.SisypheROI | Sisyphe.core.sisypheVolume.SisypheVolume
str, ID
SisypheROI’s reference ID attribute
SisypheVolume’s ID attribute
- setVisibility(v: bool) None
Set the ROI visibility of the current SisypheROI instance.
Parameters
- vbool
visible if True
- setVisibilityOff() None
Hide the current SisypheROI instance.
- setVisibilityOn() None
Show the current SisypheROI instance.
- shift(sx: int = 0, sy: int = 0, sz: int = 0) None
ROI image shift of the current SisypheROI instance. The current SisypheROI instance is overwritten.
Parameters
- sxint
shift of sx voxels in x-axis (default 0)
- syint
shift of sy voxels in y-axis (default 0)
- szint
shift of sz voxels in z-axis (default 0)
- class Sisyphe.core.sisypheROI.SisypheROICollection
Description
Named list container of SisypheROI instances. Container key to address elements can be an int index, a roi name str or a SisypheROI instance (uses name attribute as str key).
Getter methods of the SisypheROI class are added to the SisypheROICollection class, returning a list of values returned by each SisypheROI element in the container.
Scope of methods:
resampling (apply geometric transformation),
converting to and from SisypheVolume label,
setter and getter methods of sisypheROI instances in the collection,
set operators (union, intersection, difference, symmetric difference),
flip/shift,
morphology operators (dilate, erode, closing, opening),
fill holes,
IO methods.
Inheritance
object -> SisypheROICollection
Creation: 08/09/2022 Last revision: 23/05/2024
- append(value: SisypheROI | SisypheROICollection) None
Append a SisypheROI element in the current SisypheROICollection instance container.
Parameters
- valueSisypheROI | SisypheROICollection
ROI(s) to append
- clear() None
Remove all elements from the current SisypheROICollection instance container (empty).
- clearBorderBlobs()
Clear blob(s) connected to the border of the current SisypheROI instance.
- copy() SisypheROICollection
Copy the current SisypheROICollection instance container (Shallow copy of elements).
Returns
- SisypheROICollection
shallow copy of the collection
- copyToList() list[SisypheROI]
Copy the current SisypheROICollection instance container to a list (Shallow copy of elements).
Returns
- list[SisypheROI]
shallow copy of the collection
- count() int
Get the number of SisypheROI elements in the current SisypheROICollection instance container.
Returns
- int
number of SisypheROI elements
- difference() SisypheROI
Apply difference operator between sisypheROI instances in the current SisypheROICollection instance container.
Returns
- SisypheROI
processed roi
- fillHoles() None
Fill holes of the SisypheROI instances in the current SisypheROICollection instance container.
- flip(fx: bool = False, fy: bool = False, fz: bool = False) None
Flip SisypheROI instances axes in the current SisypheROICollection instance container.
Parameters
- fxbool
flip x-axis if True (default False)
- fybool
flip y-axis if True (default False)
- fzbool
flip z-axis if True (default False)
- fromLabelVolume(v: SisypheVolume) None
Convert a SisypheVolume instance of labels to SisypheROI images added to the current SisypheROICollection instance. Each scalar value in the SisypheVolume instance is converted to a SisypheROI image, these scalar values are used as int index in the current SisypheROICollection instance.
Parameters
- vSisyphe.core.sisypheVolume.SisypheVolume
label volume
- getBlobCount() list[int]
Get the number of blobs (connected components) in the SisypheROI instances in a copy of the current SisypheROICollection instance.
Returns
- list[int]
number of blobs in each SisypheROI instance
- getBlobLargerThan(n: int) SisypheROICollection
Remove blobs (connected components) with less than n voxels from the SisypheROI instances in a copy of the current SisypheROICollection instance.
Returns
- SisypheROICollection
collection of processed roi(s)
- getClearBorderBlobs() SisypheROICollection
Clear blob(s) connected to the border of the current SisypheROI instance.
Returns
- SisypheROICollection
collection of processed roi(s)
- getEulerNumber(connectivity: int = 26) list[int]
Calculate the Euler characteristic of the current SisypheROI instance. The Euler number is obtained as the number of blobs plus the number of holes, minus the number of tunnels, or loops.
Parameters
- connectivityint
6 or 26
Returns
- list[int]
Euler number(s)
- getFillHoles() SisypheROICollection
Fill holes of the SisypheROI instances in a copy of the current SisypheROICollection instance.
Returns
- SisypheROICollection
collection of processed roi(s)
- getFlip(fx: bool = False, fy: bool = False, fz: bool = False) SisypheROICollection
Flip SisypheROI instances axes in a copy of the current SisypheROICollection instance.
Parameters
- fxbool
flip x-axis if True (default False)
- fybool
flip y-axis if True (default False)
- fzbool
flip z-axis if True (default False)
Returns
- SisypheROICollection
collection of flipped roi(s)
- getList() list[SisypheROI]
Get the list attribute of the current SisypheROICollection instance container (Shallow copy of the elements).
Returns
- list[SisypheROI]
shallow copy of the collection
- getMajorBlob() SisypheROICollection
Clear all blobs (connected components) except the major one (most voxels) of the SisypheROI instances in a copy of the current SisypheROICollection instance.
Returns
- SisypheROICollection
collection of processed roi(s)
- getMorphoClosing(radius: int = 1, struct: int = 1) SisypheROICollection
SisypheROI instances morphological closing in a copy of the current SisypheROICollection instance.
Parameters
- radiusint
structuring element radius (in voxels)
- structint
structuring element shape, SimpleITK code (0 sitkAnnulus, 1 sitkBall, 2 sitkBox, 3 sitkCross)
Returns
- SisypheROICollection
collection of morphology closing roi(s)
- getMorphoDilate(radius: int = 1, struct: int = 1) SisypheROICollection
SisypheROI instances morphological dilatation in a copy of the current SisypheROICollection instance.
Parameters
- radiusint
structuring element radius (in voxels)
- structint
structuring element shape, SimpleITK code (0 sitkAnnulus, 1 sitkBall, 2 sitkBox, 3 sitkCross)
Returns
- SisypheROICollection
collection of dilated roi(s)
- getMorphoErode(radius: int = 1, struct: int = 1) SisypheROICollection
SisypheROI instances morphological erosion in a copy of the current SisypheROICollection instance.
Parameters
- radiusint
structuring element radius (in voxels)
- structint
structuring element shape, SimpleITK code (0 sitkAnnulus, 1 sitkBall, 2 sitkBox, 3 sitkCross)
Returns
- SisypheROICollection
collection of eroded roi(s)
- getMorphoOpening(radius: int = 1, struct: int = 1) SisypheROICollection
SisypheROI instances morphological opening in a copy of the current SisypheROICollection instance.
Parameters
- radiusint
structuring element radius (in voxels)
- structint
structuring element shape, SimpleITK code (0 sitkAnnulus, 1 sitkBall, 2 sitkBox, 3 sitkCross)
Returns
- SisypheROICollection
collection of morphology opening roi(s)
- getReferenceID() str
Get reference ID attribute of the current SisypheROICollection instance. All ROIs in the container are defined in the space of a reference SisypheVolume whose ID is the reference ID.
Returns
- str
reference ID
- getShift(sx: int = 0, sy: int = 0, sz: int = 0) SisypheROICollection
SisypheROI instances shift in a copy of the current SisypheROICollection instance.
Parameters
- sxint
shift of sx voxels in x-axis (default 0)
- syint
shift of sy voxels in y-axis (default 0)
- szint
shift of sz voxels in z-axis (default 0)
Returns
- SisypheROICollection
collection of shifted roi(s)
- getSkeletonize(blob: int = 0) SisypheROICollection
Calculate the skeleton of the current SisypheROI instance.
Parameters
- blobint
blob index or 0 (whole image, default)
Returns
- SisypheROI
collection of skeleton roi(s)
- hasReferenceID() bool
Check if the reference ID of the current SisypheROICollection instance is defined (not ‘’).
Returns
- bool
True if reference ID is defined
- index(value: str | SisypheROI) int
Index of a SisypheROI element in the current SisypheROICollection instance container.
Parameters
- valuestr | SisypheROI
ROI name or ROI element
Returns
- int
index
- insert(key: int | str | SisypheROI, value: SisypheROI)
Insert a SisypheROI element at the position given by the key in the current SisypheROICollection instance container.
Parameters
- keyint | str | SisypheROI
int, index
str, ROI name index
SisypheROI, ROI index
- valueSisypheROI
ROI to insert
- intersection() SisypheROI
Apply intersection operator between sisypheROI instances in the current SisypheROICollection instance container.
Returns
- SisypheROI
processed roi
- isEmpty() bool
Checks if SisypheROICollection instance container is empty.
Returns
- bool
True if container is empty
- keys() list[str]
Get the list of keys in the current SisypheROICollection instance container.
Returns
- list[str]
list of keys in the container
- load(filenames: str | list[str]) None
Load SisypheROI elements in the current SisypheROICollection instance container from a list of PySisyphe ROI (.xroi) file names.
Parameters
- filenamesstr | list[str]
list of PySisyphe ROI (.xroi) file names
- loadFromBrainVoyagerVOI(vmr: str, filenames: str | list[str]) None
Load SisypheROI elements in the current SisypheROICollection instance container from a list of old Sisyphe ROI (.roi) file names.
Parameters
- vmrstr
BrainVoyager reference volume (.vmr) file name
- filenamesstr | list[str]
list of BrainVoyager ROI (.voi) file names
- loadFromSisyphe(filenames: str | list[str]) None
Load SisypheROI elements in the current SisypheROICollection instance container from a list of old Sisyphe ROI (.roi) file names.
Parameters
- filenamesstr | list[str]
list of old Sisyphe ROI (.roi) file names
- morphoClosing(radius: int = 1, struct: int = 1) None
Morphological closing of the SisypheROI instances in the current SisypheROICollection instance container.
Parameters
- radiusint
structuring element radius (in voxels)
- structint
structuring element shape, SimpleITK code (0 sitkAnnulus, 1 sitkBall, 2 sitkBox, 3 sitkCross)
- morphoDilate(radius: int = 1, struct: int = 1) None
Morphological dilatation of the SisypheROI instances in the current SisypheROICollection instance container.
Parameters
- radiusint
structuring element radius (in voxels)
- structint
structuring element shape, SimpleITK code (0 sitkAnnulus, 1 sitkBall, 2 sitkBox, 3 sitkCross)
- morphoErode(radius: int = 1, struct: int = 1) None
Morphological erosion of the SisypheROI instances in the current SisypheROICollection instance container.
Parameters
- radiusint
structuring element radius (in voxels)
- structint
structuring element shape, SimpleITK code (0 sitkAnnulus, 1 sitkBall, 2 sitkBox, 3 sitkCross)
- morphoOpening(radius: int = 1, struct: int = 1) None
Morphological opening of the SisypheROI instances in the current SisypheROICollection instance container.
Parameters
- radiusint
structuring element radius (in voxels)
- structint
structuring element shape, SimpleITK code (0 sitkAnnulus, 1 sitkBall, 2 sitkBox, 3 sitkCross)
- pop(key: int | str | SisypheROI | None = None) SisypheROI
Remove a SisypheROI element from the current SisypheROICollection instance container and return it. If key is None, removes and returns the last element.
Parameters
- keyint | str | SisypheROI | None
int, index of the SisypheROI to remove
str, ROI name of the SisypheROI to remove
SisypheROI to remove
None, remove the last element
Returns
- SisypheROI
element removed from the container
- pruning(blob: int = 0)
Remove “spurs” of less than a certain length in the current SisypheROI instance.
Parameters
- blobint
blob index or 0 (whole image, default)
- remove(value: int | str | SisypheROI) None
Remove a SisypheROI element from the current SisypheROICollection instance container.
Parameters
- valueint | str | SisypheROI
int, index of the SisypheROI to remove
str, ROI name of the SisypheROI to remove
SisypheROI to remove
- removeBlobByDistance(d: float)
Remove blobs until the remaining ones are spaced more than a given distance from one another. By default, smaller objects are removed first.
Parameters
- dfloat
minimal distance between blobs in mm
- resample(trf: SisypheTransform, save: bool = True, dialog: bool = False, prefix: str | None = None, suffix: str | None = None, wait: DialogWait | None = None)
Apply an affine geometric transformation to all the SisypheROI elements of the current SisypheROICollection instance container.
Parameters
- trfSisypheTransform
affine geometric transformation
- savebool
save resampled SisypheROI elements (default True)
- dialogbool
dialog box to choice file name of each resampled SisypheROI element (default False)
- prefixstr | None
prefix added to file name of the resampled SisypheROI elements (optional)
- suffixstr | None
suffix added to file name of the resampled SisypheROI elements (optional)
- waitDialogWait | None
progress bar dialog (optional)
- reverse() None
Reverses the order of the elements in the current SisypheROICollection instance container.
- roiSTAPLECombination() SisypheROI
Performs a pixelwise combination of ROIs, where each of them represents a segmentation of the same image. The labelings are weighted relative to each other based on their “performance” as estimated by an expectation-maximization algorithm. In the process, a ground truth segmentation is estimated, and the estimated performances of the individual segmentations are relative to this estimated ground truth.
The algorithm is based on the binary STAPLE algorithm by Warfield et al. : S. Warfield, K. Zou, W. Wells, “Validation of image segmentation and expert quality with an expectation-maximization algorithm” in MICCAI 2002: Fifth International Conference on Medical Image Computing and Computer-Assisted Intervention, Springer-Verlag, Heidelberg, Germany, 2002, pp. 298-306
Returns
- SisypheROI
processed roi
- roiVotingCombination() SisypheROI
Performs a pixelwise combination of ROIs, where each of them represents a segmentation of the same image. Label voting is a simple method of classifier combination applied to image segmentation. Typically, the accuracy of the combined segmentation exceeds the accuracy of the input segmentations. Voting is therefore commonly used as a way of boosting segmentation performance.
The use of label voting for combination of multiple segmentations is described in T. Rohlfing and C. R. Maurer, Jr., “Multi-classifier framework for atlas-based image segmentation,” Pattern Recognition Letters, 2005.
Returns
- SisypheROI
processed roi
- save() None
Iteratively save SisypheROI elements in the current SisypheMeshCollection instance container.
- setReferenceID(ID: SisypheROI | SisypheVolume | str) None
Set reference ID attribute of the current SisypheROICollection instance. All ROIs in the container are defined in the space of a reference SisypheVolume whose ID is the reference ID.
Parameters
- IDstr | Sisyphe.core.sisypheROI.SisypheROI | Sisyphe.core.sisypheVolume.SisypheVolume
str, ID
SisypheROI’s ID attribute
SisypheVolume’s ID attribute
- shift(sx: int = 0, sy: int = 0, sz: int = 0) None
SisypheROI instances shift in the current SisypheROICollection instance container.
Parameters
- sxint
shift of sx voxels in x-axis (default 0)
- syint
shift of sy voxels in y-axis (default 0)
- szint
shift of sz voxels in z-axis (default 0)
- sort(reverse: bool = False)
Sort elements of the current SisypheROICollection instance container. Sorting is based on the name attribute of the SisypheROI elements, in the ascending order.
Parameters
- reversebool
sorting in reverse order
- symmetricDifference() SisypheROI
Apply symmetric difference operator between sisypheROI instances in the current SisypheROICollection instance container.
Returns
- SisypheROI
processed roi
- toLabelVolume() SisypheVolume
Convert the current SisypheROICollection instance into a SisypheVolume instance of labels. The label value of each ROI in the SisypheVolume instance is its int index in the SisypheROICollection container.
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
label volume
- union() SisypheROI
Apply union operator between sisypheROI instances in the current SisypheROICollection instance container.
Returns
- SisypheROI
processed roi
- class Sisyphe.core.sisypheROI.SisypheROIDraw
Description
Processing class for SisypheROI instances with undo/redo management. Set input ROI with setROI method. Set input reference valume with SetVolume method.
Scope of methods:
drawing,
flip/shift,
copy/cut/paste (global or blob),
blob selection,
morphology operators (global or blob),
fill holes,
thresholding (global or blob),
region growing (global or blob),
active contour,
slice interpolation,
shape statistics,
descriptive statistics.
Most of these methods are available in 2D (slice) and 3D.
Inheritance
object -> SisypheROIDraw
Creation: 08/09/2022 Last revision: 24/03/2025
- activeContour(x: int, y: int, z: int, seedradius: float = 2.0, sigma: float = 1.0, rms: float = 0.01, advec: float = 1.0, curv: float = 1.0, propag: float = 1.0, niter: int = 1000, algo: str = 'default', replace: bool = False) None
Active contour, level set method of segmentation, in the SisypheROI image attribute. Iterative algorithm starting from a seed sphere.
See SimpleITK GeodesicActiveContourLevelSetImageFilter doc: https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1GeodesicActiveContourLevelSetImageFilter.html
Parameters
- xint
x-axis seed sphere coordinate
- yint
y-axis seed sphere coordinate
- zint
z-axis seed sphere coordinate
- seedradiusfloat
radius in mm of the seed sphere centered on x, y, z (default 2.0). If roi[x, y, z] is not background (i.e. > 0), use blob as seed rather than sphere, seedradius parameter is then ignored.
- sigmafloat
gaussian kernel parameter used to compute the magnitude of the gradient. The edge potential map of the level set algorithm is computed from the image gradient. Edge potential map is that it has values close to zero in regions near the edges and values close to one inside the shape itself. This map is the image from which the speed function will be calculated.
- rmsfloat
convergence threshold (0.0 < rms < 1.0, default 0.01). rms is used to determine when the solution has converged. A lower value will result in a tighter-fitting solution, but will require more computations. Too low a value could put the solver into an infinite loop unless a reasonable number of iterations parameter is set.
- curvfloat
curvature, larger -> smoother resulting contour (default 1.0). Controls the magnitude of the curvature values which are calculated on the evolving isophote. This is important in controlling the relative effect of curvature in the calculation. Default value is 1.0. Higher values relative to the other level set equation terms (propagation and advection) will give a smoother result.
- advecfloat
advection, default 1.0. Controls the scaling of the vector advection field term relative to other terms in the level set equation
- propagfloat
propagation speed (default 1.0). > 0 propagation outwards, < 0 propagating inwards controls the scaling of the scalar propagation (speed) term relative to other terms in the level set equation
- niterint
maximum number of iterations (default 1000). Can be used to halt the solution after a specified number of iterations, overriding the rms halting criteria
- algostr
algorithm ‘default’ SimpleITK GeodesicActiveContourLevelSetImageFilter or ‘shape’ SimpleITK ShapeDetectionLevelSetImageFilter
- replacebool
if True, segmented mask replaces previous voxels
if False (default), | (or) logic between mask and previous voxels
- activeContourSegmentation(x: int, y: int, z: int) None
Active contour, level set method of segmentation, in the SisypheROI image attribute. Iterative algorithm starting from a seed sphere. This method used active contour attributes of the current SisypheDraw instance as parameters (seed radius, sigma, rms, advection weight, curvature weight, propagation weight, number of iterations, algorithm).
Parameters
- xint
x-axis seed sphere coordinate
- yint
y-axis seed sphere coordinate
- zint
z-axis seed sphere coordinate
- activeThresholdContour(x: int, y: int, z: int, seedradius: float = 2.0, factor: float = 3.0, rms: float = 0.01, curv: float = 1.0, propag: float = 1.0, thresholds: tuple[float, float] | None = None, niter: int = 1000, replace: bool = False) None
Active contour, level set method of segmentation, in the SisypheROI image attribute. Iterative algorithm starting from a seed sphere.
See SimpleITK ThresholdSegmentationLevelSetImageFilter doc: https://simpleitk.org/doxygen/v1_0/html/classitk_1_1simple_1_1ThresholdSegmentationLevelSetImageFilter.html
Parameters
- xint
x-axis seed sphere coordinate
- yint
y-axis seed sphere coordinate
- zint
z-axis seed sphere coordinate
- seedradiusfloat
radius in mm of the seed sphere centered on x, y, z (default 2.0). If roi[x, y, z] is not background (i.e. > 0), use blob as seed rather than sphere, seedradius parameter is then ignored.
- factorfloat
factor x standard deviation of signal in seed sphere to estimate lower and upper thresholds used by level set algorithm (default 3.0)
- rmsfloat
convergence threshold (0.0 < rms < 1.0, default 0.01). rms is used to determine when the solution has converged. A lower value will result in a tighter-fitting solution, but will require more computations. Too low a value could put the solver into an infinite loop unless a reasonabl number of iterations parameter is set.
- curvfloat
curvature, larger -> smoother resulting contour (default 1.0). Controls the magnitude of the curvature values which are calculated on the evolving isophote. This is important in controlling the relative effect of curvature in the calculation. Default value is 1.0. Higher values relative to the other level set equation terms (propagation and advection) will give a smoother result.
- propagfloat
propagation speed (default 1.0). > 0 propagation outwards, < 0 propagating inwards controls the scaling of the scalar propagation (speed) term relative to other terms in the level set equation.
- thresholdstuple[float, float] | None
Lower and upper thresholds used by level set algorithm. If None, threshold are computed from seed region (mean +/- factor * sigma)
- niterint
maximum number of iterations (default 1000). Can be used to halt the solution after a specified number of iterations, overriding the rms halting criteria
- replacebool
if True, segmented mask replaces previous voxels
if False (default), | (or) logic between mask and previous voxels
- appendSliceToLIFO(i: int, dim: int, pile: int = 0) None
Add a slice of the SisypheROI attribute in the LIFO undo/redo stack. This method is called by 2D processing methods if undo/redo abilities are enabled.
Parameters
- iint
index of the slice
- dimint
slice axis code, 0 z-axis, 1 y-axis, 2 x-axis
- pileint
0 addBundle to LIFO undo stack, 1 addBundle to LIFO redo stack
- appendVolumeToLIFO(pile: int = 0) None
Add the whole volume of the SisypheROI attribute in the LIFO undo/redo stack. This method is called by 3D processing methods if undo/redo abilities are enabled.
Parameters
- pileint
0 addBundle to LIFO undo stack, 1 addBundle to LIFO redo stack
- appendXSliceToLIFO(i: int, pile: int = 0) None
Add a sagittal slice of the SisypheROI attribute in the LIFO undo/redo stack. This method is called by 2D processing methods if undo/redo abilities are enabled.
Parameters
- iint
x-axis index of the slice
- pileint
0 addBundle to LIFO undo stack, 1 addBundle to LIFO redo stack
- appendYSliceToLIFO(i: int, pile: int = 0) None
Add a coronal slice of the SisypheROI attribute in the LIFO undo/redo stack. This method is called by 2D processing methods if undo/redo abilities are enabled.
Parameters
- iint
y-axis index of the slice
- pileint
0 addBundle to LIFO undo stack, 1 addBundle to LIFO redo stack
- appendZSliceToLIFO(i: int, pile: int = 0) None
Add an axial slice of the SisypheROI attribute in the LIFO undo/redo stack. This method is called by 2D processing methods if undo/redo abilities are enabled.
Parameters
- iint
z-axis index of the slice
- pileint
0 addBundle to LIFO undo stack, 1 addBundle to LIFO redo stack
- backgroundSegment(algo: str = 'huang') None
Automatic background segmentation of the SisypheROI image attribute.
Parameters
- algostr
algorithm used to find the best threshold for separating a mask from the background. Available algorithm names : ‘mean’, ‘otsu’, ‘huang’, ‘renyi’, ‘yen’, ‘li’, ‘shanbhag’, ‘triangle’, ‘intermodes’, ‘maximumentropy’, ‘kittler’, ‘isodata’, ‘moments’
- backgroundSegmentSlice(sindex: int, dim: int, algo: str = 'huang') None
Automatic background segmentation in a SisypheROI attribute slice.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- algostr
algorithm used to find the best separation threshold between a mask and the background. Available algorithm names : ‘mean’, ‘otsu’, ‘huang’, ‘renyi’, ‘yen’, ‘li’, ‘shanbhag’, ‘triangle’, ‘intermodes’, ‘maximumentropy’, ‘kittler’, ‘isodata’, ‘moments’ (default ‘huang’)
- binaryAND(rois: list[SisypheROI] | SisypheROICollection) None
Binary “logic and” between the SisypheROI image attribute and a list of SisypheROI images (or SisypheROICollection).
Parameters
- roislist[SisypheROI] | SisypheROICollection
rois to be processed
- binaryINTERSECTION(rois: list[SisypheROI] | SisypheROICollection) None
Binary “logic and” between the SisypheROI image attribute and a list of SisypheROI images (or SisypheROICollection).
Parameters
- roislist[SisypheROI] | SisypheROICollection
rois to be processed
- binaryNAND(rois: list[SisypheROI] | SisypheROICollection) None
Binary “logic nand (not and)” between the SisypheROI image attribute and a list of SisypheROI images (or SisypheROICollection).
Parameters
- roislist[SisypheROI] | SisypheROICollection
rois to be processed
- binaryNOT() None
Binary “not” of the SisypheROI image attribute.
- binaryNotSlice(sindex: int, dim: int) None
Apply the binary not operator in a SisypheROI attribute slice.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- binaryOR(rois: list[SisypheROI] | SisypheROICollection) None
Binary “logic or” between the SisypheROI image attribute and a list of SisypheROI images (or SisypheROICollection).
Parameters
- roislist[SisypheROI] | SisypheROICollection
rois to be processed
- binaryUNION(rois: list[SisypheROI] | SisypheROICollection) None
Binary “logic or” between the SisypheROI image attribute and a list of SisypheROI images (or SisypheROICollection).
Parameters
- roislist[SisypheROI] | SisypheROICollection
rois to be processed
- binaryXOR(rois: list[SisypheROI] | SisypheROICollection) None
Binary “logic xor” between the SisypheROI image attribute and a list of SisypheROI images (or SisypheROICollection).
Parameters
- roislist[SisypheROI] | SisypheROICollection
rois to be processed
- blobFilterExtent(n: int) None
Remove blobs (connected components) from the SisypheROI image attribute, according to their extent (number of voxels).
Parameters
- nint
number of voxels threshold
- blobFilterExtentSlice(sindex: int, dim: int, n: int) None
Remove blobs (connected components) from a SisypheROI attribute slice, according to their extent (number of voxels).
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- nint
number of voxels threshold
- blobRemove(x: int, y: int, z: int) None
Remove the blob containing the voxel whose coordinates are transmitted, from the SisypheROI image attribute.
Parameters
- xint
x-axis blob selection coordinate
- yint
y-axis blob selection coordinate
- zint
z-axis blob selection coordinate
- blobRemoveSlice(sindex: int, dim: int, x: int, y: int, z: int) None
Remove the blob containing the voxel whose coordinates are transmitted, from a SisypheROI attribute slice.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- xint
x-axis blob selection coordinate
- yint
y-axis blob selection coordinate
- zint
z-axis blob selection coordinate
- blobSelect(x: int, y: int, z: int) None
Remove all blobs except the one containing the voxel whose coordinates are transmitted, from the SisypheROI image attribute.
Parameters
- xint
x-axis blob selection coordinate
- yint
y-axis blob selection coordinate
- zint
z-axis blob selection coordinate
- blobSelectSlice(sindex: int, dim: int, x: int, y: int, z: int) None
Remove all blobs except the one containing the voxel whose coordinates are transmitted, from a SisypheROI attribute slice.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- xint
x-axis blob selection coordinate
- yint
y-axis blob selection coordinate
- zint
z-axis blob selection coordinate
- brush(x: int, y: int, z: int, dim: int) None
Draw a brush-shape at the x, y, z coordinates of the SisypheROI image attribute. Brush-shape is defined with setBrushType() method, and size with setBrushRadius() method.
Parameters
- xint
x-axis coordinate
- yint
y-axis coordinate
- zint
z-axis coordinate
- dimint
- slice orientation code
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- clear() None
Clear the SisypheROI image attribute (i.e. all voxels to 0).
- clearBorderBlob() None
Remove all blobs (connected components) connected to image border.
- clearBorderBlobSlice(sindex: int, dim: int) None
Remove all blobs (connected components) connected to image border, from a SisypheROI attribute slice.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- clearClipboard() None
Clear the clipboard attribute of the current SisypheROIDraw instance. The clipboard attribute is used as temporary buffer by copy/cut/paste methods.
- clearLIFO() None
Clear the LIFO undo/redo stacks.
- clearSlice(sindex: int, dim: int) None
Clear a SisypheROI attribute slice (i.e. all voxels to 0).
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- copyBlob(x: int, y: int, z: int) None
Copy to clipboard the blob containing the voxel whose coordinates are transmitted, from the SisypheROI image attribute.
Parameters
- xint
x-axis blob selection coordinate
- yint
y-axis blob selection coordinate
- zint
z-axis blob selection coordinate
- copyBlobSlice(sindex: int, dim: int, x: int, y: int, z: int) None
Copy the blob containing the voxel whose coordinates are transmitted to clipboard, from a SisypheROI attribute slice.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- xint
x-axis blob selection coordinate
- yint
y-axis blob selection coordinate
- zint
z-axis blob selection coordinate
- copySlice(sindex: int, dim: int) None
Copy of a SisypheROI attribute slice to the clipboard.
Parameters
- sindex :int
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- cutBlob(x: int, y: int, z: int) None
Cut to clipboard the blob containing the voxel whose coordinates are transmitted, from the SisypheROI image attribute.
Parameters
- xint
x-axis blob selection coordinate
- yint
y-axis blob selection coordinate
- zint
z-axis blob selection coordinate
- cutBlobSlice(sindex: int, dim: int, x: int, y: int, z: int) None
Cut the blob containing the voxel whose coordinates are transmitted to clipboard, from a SisypheROI attribute slice.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- xint
x-axis blob selection coordinate
- yint
y-axis blob selection coordinate
- zint
z-axis blob selection coordinate
- cutSlice(sindex: int, dim: int) None
Cut of a SisypheROI attribute slice to the clipboard.
Parameters
- sindex :int
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- drawCube(p: list[int] | tuple[int, int, int], extent: int) None
Draw a cube in the current SisypheROI image attribute.
Parameters
- ptuple[int, int, int] | list[int, int, int]
x, y, z origin coordinates
- extentint
length of cube sides (in voxels)
- drawDisk(p: list[int] | tuple[int, int, int], radius: int, orient: int = 0) None
Draw a disk in the current SisypheROI image attribute.
Parameters
- ptuple[int, int, int] | list[int, int, int]
x, y, z center point coordinates
- radiusint
disk radius (in voxels)
- orientint
slice orientation (0 axial, 1 coronal, 2 sagittal)
- drawEllipse(p: list[int] | tuple[int, int, int], radius: list[int] | tuple[int, int], rot: float = 0.0, orient: int = 0) None
Draw an ellipse in the current SisypheROI image attribute.
Parameters
- ptuple[int, int, int] | list[int, int, int]
x, y, z center point coordinates
- radiustuple[int, int] | list[int, int]
radius in x and y axes (in voxels)
- rotfloat
set the ellipse rotation in radians (between -pi and pi, default 0.0)
- orientint
slice orientation (0 axial, 1 coronal, 2 sagittal)
- drawLine(p0: list[int] | tuple[int, int, int], p1: list[int] | tuple[int, int, int], orient: int = 0) None
Draw a line in the current SisypheROI image attribute. Line is drawn in a single slice (p0 and p1 must be within the same slice)
Parameters
- p0tuple[int, int, int] | list[int, int, int]
x, y, z first point coordinates
- p1tuple[int, int, int] | list[int, int, int]
x, y, z second point coordinates
- orientint
slice orientation (0 axial, 1 coronal, 2 sagittal)
- drawParallelepiped(p: list[int] | tuple[int, int, int], extent: list[int] | tuple[int, int, int]) None
Draw a parallelepiped in the current SisypheROI image attribute.
Parameters
- ptuple[int, int, int] | list[int, int, int]
x, y, z origin coordinates
- extenttuple[int, int, int] | list[int, int, int]
width, height and depth (in voxels)
- drawPolygon(p: list[list[int]], orient: int = 0) None
Draw a polygon in the current SisypheROI image attribute. Polygon is drawn in a single slice (all points must be within the same slice).
Parameters
- plist[list[int]]
list of 3 list[int]: - first list[int], x coordinates of points - second list[int], y coordinates of points - third list[int], z coordinates of points
- orientint
slice orientation (0 axial, 1 coronal, 2 sagittal)
- drawRectangle(p: list[int] | tuple[int, int, int], extent: list[int] | tuple[int, int], orient: int = 0) None
Draw a rectangle in the current SisypheROI image attribute.
Parameters
- ptuple[int, int, int] | list[int, int, int]
x, y, z origin coordinates
- extenttuple[int, int] | list[int, int]
width and height (in voxels)
- orientint
slice orientation (0 axial, 1 coronal, 2 sagittal)
- drawSphere(p: list[int] | tuple[int, int, int], radius: int) None
Draw a sphere in the current SisypheROI image attribute.
Parameters
- ptuple[int, int, int] | list[int, int, int]
x, y, z center coordinates
- radiusint
sphere radius (in voxels)
- drawSquare(p: list[int] | tuple[int, int, int], extent: int, orient: int = 0) None
Draw a square in the current SisypheROI image attribute.
Parameters
- ptuple[int, int, int] | list[int, int, int]
x, y, z origin coordinates
- extentint
length of square sides (in voxels)
- orientint
slice orientation (0 axial, 1 coronal, 2 sagittal)
- erase(x: int, y: int, z: int, dim: int) None
Erase a brush-shape at the x, y, z coordinates of the SisypheROI image attribute. Brush-shape is defined with setBrushType() method, and size with setBrushRadius() method.
Parameters
- xint
x-axis coordinate
- yint
y-axis coordinate
- zint
z-axis coordinate
- dimint
- slice orientation code
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- euclideanBlobDilate(x: int, y: int, z: int, mm: float = 0.0) None
Expand a selected blob in the SisypheROI image attribute with a constant margin (in mm).
Parameters
- xint
x-axis blob selection coordinate
- yint
y-axis blob selection coordinate
- zint
z-axis blob selection coordinate
- mmfloat
margin thickness in mm
- euclideanBlobErode(x: int, y: int, z: int, mm: float = 0.0) None
Shrink a selected blob in the SisypheROI image attribute with a constant margin (in mm).
Parameters
- xint
x-axis blob selection coordinate
- yint
y-axis blob selection coordinate
- zint
z-axis blob selection coordinate
- mmfloat
margin thickness in mm
- euclideanDilate(mm: float = 0.0) None
Expand the SisypheROI image attribute with a constant margin (in mm)
Parameters
- mmfloat
margin thickness in mm
- euclideanErode(mm: float = 0.0) None
Shrink the SisypheROI image attribute with a constant margin (in mm)
Parameters
- mmfloat
margin thickness in mm
- extractingValue(value: float, mask: bool = False, replace: bool = False) None
Calculate a mask of the SisypheROI image attribute of voxels with a given scalar value in the reference SisypheVolume image attribute.
Parameters
- valuefloat
scalar value in reference SisypheVolume attribute
- maskbool
if True, & (and) logic between mask and previous voxels (default False)
- replacebool
if True, mask replaces previous voxels
if False (default), | (or) logic between mask and previous voxels
- extractingValueBlob(value: float, x: int, y: int, z: int) None
Calculate a mask limited to a blob of the SisypheROI image attribute from voxels with a given scalar value in the reference SisypheVolume image attribute.
Parameters
- valuefloat
scalar value in reference SisypheVolume attribute
- xint
x-axis blob selection coordinate
- yint
y-axis blob selection coordinate
- zint
z-axis blob selection coordinate
- extractingValueBlobSlice(sindex: int, dim: int, value: float, x: int, y: int, z: int) None
Calculate a mask limited to the surface of a blob in a slice of the SisypheROI attribute from voxels with a given scalar value in the SisypheVolume reference attribute.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- valuefloat
scalar value in reference SisypheVolume attribute
- xint
x-axis blob selection coordinate
- yint
y-axis blob selection coordinate
- zint
z-axis blob selection coordinate
- extractingValueSlice(sindex: int, dim: int, value: float, mask: bool = False, replace: bool = False) None
Calculate a mask in a slice of the SisypheROI attribute of voxels with a given scalar value in the reference SisypheVolume attribute.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- valuefloat
scalar value in reference SisypheVolume attribute
- maskbool
if True, & (and) logic between mask and previous voxels of the slice (default False)
- replacebool
if True, mask replaces previous voxels of the slice
if False (default), | (or) logic between mask and previous voxels of the slice
- fillHoles() None
Fill holes in the SisypheROI image attribute.
- fillHolesAllSlices(dim: int) None
Fill holes of the SisypheROI attribute. This method executes iteratively in 2D on all slices of the SisypheROI attribute.
Parameters
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- fillHolesSlice(sindex: int, dim: int, undo: bool | None = None)
Fill holes in a SisypheROI attribute slice.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- undobool | None
if True, adds slice in the LIFO undo/redo stack
if None, takes state of the undo attribute of the current SisypheROIDraw instance (see setUndo() method)
- flip(flipx: bool, flipy: bool, flipz: bool) None
Flip axes of the SisypheROI image attribute.
Parameters
- flipxbool
flip x-slice-axis if True
- flipybool
flip y-slice-axis if True
- flipzbool
flip z-slice-axis if True
- flipSlice(sindex: int, dim: int, flipx: bool, flipy: bool) None
Flip axes of a SisypheROI attribute slice.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- flipxbool
flip x-slice-axis if True
- flipybool
flip y-slice-axis if True
- getActiveContourAdvectionWeight() float
Get the active contour advection weight attribute of the current SisypheDraw instance. This attribute is useb by the activeContourSegmentation() method. Active contour is an iterative level set method of segmentation, starting from a seed sphere.
The advection attribute (default 1.0) controls the scaling of the vector advection field term relative to other terms in the level set equation.
Returns
- float
active contour advection weight attribute
- getActiveContourAlgorithm() str
Get the active contour algorithm attribute of the current SisypheDraw instance. This attribute is useb by the activeContourSegmentation() method. Active contour is an iterative level set method of segmentation, starting from a seed sphere.
Returns
- str
active contour algorithm attribute (‘geodesic’, ‘shape’ or ‘threshold’)
- getActiveContourConvergence() float
Get the active contour convergence attribute of the current SisypheDraw instance. This attribute is useb by the activeContourSegmentation() method. Active contour is an iterative level set method of segmentation, starting from a seed sphere.
The rms convergence attribute (0.0 < rms < 1.0, default 0.01) is used to determine when the solution has converged. A lower value will result in a tighter-fitting solution, but will require more computations. Too low a value could put the solver into an infinite loop unless a reasonable number of iterations parameter is set.
Returns
- float
active contour convergence attribute
- getActiveContourCurvatureWeight() float
Get the active contour curvature weight attribute of the current SisypheDraw instance. This attribute is useb by the activeContourSegmentation() method. Active contour is an iterative level set method of segmentation, starting from a seed sphere.
The curvature attribute (default 1.0) controls the magnitude of the curvature values which are calculated on the evolving isophote. This is important in controlling the relative effect of curvature in the calculation. Default value is 1.0. Higher values relative to the other level set equation terms (propagation and advection) will give a smoother result.
Returns
- float
active contour curvature weight attribute
- getActiveContourFactor() float
Get the active contour factorfactor attribute of the current SisypheDraw instance. This attribute is useb by the activeContourSegmentation() method. Active contour is an iterative level set method of segmentation, starting from a seed sphere.
The factor attribute is only used by the threshold version of the active contour algorithms, if threshold attributes are not defined. The formula factor x standard deviation of the signal within the seed sphere is used to estimate the lower and upper threshold parameters (default 3.0).
Returns
- float
active contour factor attribute
- getActiveContourNumberOfIterations() int
Get the active contour number of iterations attribute of the current SisypheDraw instance. This attribute is useb by the activeContourSegmentation() method. Active contour is an iterative level set method of segmentation, starting from a seed sphere.
Returns
- int
active contour number of iterations attribute
- getActiveContourPropagationWeight() float
Get the active contour propagation weight attribute of the current SisypheDraw instance. This attribute is useb by the activeContourSegmentation() method. Active contour is an iterative level set method of segmentation, starting from a seed sphere.
The propagation speed attribute (default 1.0) controls the scaling of the scalar propagation (speed) term relative to other terms in the level set equation. > 0 propagation outwards, < 0 propagating inwards.
Returns
- float
active contour propagation weight attribute
- getActiveContourSeedRadius() float
Get the active contour seed radius attribute of the current SisypheDraw instance. This attribute is useb by the activeContourSegmentation() method. Active contour is an iterative level set method of segmentation, starting from a seed sphere.
Returns
- float
active contour seed radius attribute, seed sphere radius in mm
- getActiveContourSigma() float
Get the active contour sigma attribute of the current SisypheDraw instance. This attribute is useb by the activeContourSegmentation() method. Active contour is an iterative level set method of segmentation, starting from a seed sphere.
The sigma attribute is a gaussian kernel parameter used to compute the magnitude of the gradient. The edge potential map of the level set algorithm is computed from the image gradient. Edge potential map is that it has values close to zero in regions near the edges and values close to one inside the shape itself. This map is the image from which the speed function will be calculated.
Returns
- float
active contour sigma attribute
- getActiveContourThresholds() tuple[float, float] | None
Get the active contour curvature weight attribute of the current SisypheDraw instance. These attributes are useb by the activeContourSegmentation() method. Active contour is an iterative level set method of segmentation, starting from a seed sphere.
Lower and upper threshold attributes are only used by the threshold version of the active contour algorithms.
Returns
- tuple[float, float]
active contour threshold attributes
- getBrushRadius() int
Get the radius (in voxels) of the brush used to hand-draw in the SisypheROI image.
Returns
- int
brush radius in voxels
- getBrushType() str
Get the brush type, as str name, used to hand-draw in the SisypheROI image.
Brush types:
‘solid’ disc-shaped 2D brush
‘threshold’ voxels of the disc-shaped 2D brush surface with a scalar value over a threshold in the SisypheVolume reference
‘solid3’ sphere-shaped 3D brush
‘threshold3’ voxels in sphere-shaped 3D brush volume with a scalar value over a threshold in the SisypheVolume reference
Returns
- str
brush type
- getConfidenceConnectedIter() int
Get the confidence connected number of iterations attribute of the current SisypheDraw instance.
Returns
- int
confidence connected number of iterations attribute
- getConfidenceConnectedSigma() float
Get the confidence connected sigma attribute of the current SisypheDraw instance.
Returns
- float
confidence connected sigma attribute
- getIntensityStatistics() dict[str, float]
Get the descriptive statistics of scalar values in the reference SisypheVolume image attribute masked by the SisypheROI image attribute.
Returns
- dict[str, float]
- key (str) / value (float)
‘count’ number of voxels
‘mean’ mean
‘median’ median
‘min’ minimum
‘max’ maximum
‘range’ maximum - minimum
‘perc25’ first quartile
‘perc75’ third quartile
‘var’ variance
‘std’ standard deviation
‘skewness’ skewness
‘kurtosis’ kurtosis
- getMorphologyRadius() float
Get the radius (in voxels) of the structuring element used in morphological methods (erosion, dilatation, opening, closing).
Returns
- int
structuring element radius in voxels
- getROI() SisypheROI
Get the SisypheROI image attribute from the current SisypheROIDraw instance. This is the ROI image processed in the current SisypheROIDraw instance. Same space as reference SisypheVolume attribute (same size and spacing).
Returns
- Sisyphe.core.sisypheROI.SisypheROI
roi to be processed
- getShapeStatistics() list[dict[str, float]]
Get the shape statistics of the SisypheROI image attribute.
Returns
- dict[str, float]
- key (str)
‘count’
‘boundingbox’
‘centroid’
‘elongation’
‘flatness’
‘principalaxes’
‘principalmoments’
‘perimeter’
‘physicalsize’
‘feretdiameter’
‘ellipsoiddiameter’
‘sphericalperimeter’
‘sphericalradius’
- getSliceIntensityStatistics(sindex: int, dim: int) dict[str, float]
Get the descriptive statistics of scalar values in a slice of the reference SisypheVolume image attribute masked by the SisypheROI image attribute.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
Returns
- dict[str, float]
- key (str) / value (float)
‘count’ number of voxels
‘mean’ mean
‘median’ median
‘min’ minimum
‘max’ maximum
‘range’ maximum - minimum
‘perc25’ first quartile
‘perc75’ third quartile
‘var’ variance
‘std’ standard deviation
‘skewness’ skewness
‘kurtosis’ kurtosis
- getStructElement() str
Get the structuring element shape, as str name, used in morphological methods (erosion, dilatation, opening, closing).
Returns
- str
structuring element: ‘ball’, ‘box’, ‘cross’ or ‘annulus’
- getThickness() float
Get the margin (in mm) used in euclidean expanding/shrinking methods (euclideanDilate, euclideanErode, 2D and 3D, whole and blob versions).
Returns
- float
margin in mm
- getThresholdMax() float
Get the maximum value threshold used in some methods.
Returns
- float
maximum value threshold
- getThresholdMin() float
Get the minimum value threshold used in some methods.
Returns
- float
minimum value threshold
- getThresholds() tuple[float, float]
Get the minimum and maximum value thresholds used in some methods.
Returns
- tuple[float, float]
minimum and maximum value thresholds
- getUndo() bool
Check whether undo/redo abilities of the current SisypheROIDraw instance are enabled. All ROI processing is stored in a LIFO stack if this option is enabled.
Returns
- boolean
undo enabled if True
- getVolume() SisypheVolume
Get the reference SisypheVolume image attribute from the current SisypheROIDraw instance. Same space as SisypheROI attribute (same size and spacing). Many methods require a reference SisypheVolume (including segmentation methods).
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
reference volume
- hasROI() bool
Check whether the SisypheROI attribute of the current SisypheROIDraw instance is defined (not None). This is the ROI image processed in the current SisypheROIDraw instance.
Returns
- bool
True if SisypheROI attribute is defined
- hasThresholds() bool
Check whether threshold attributes of the current SisypheROIDraw instance are defined.
Returns
- bool
True if thresholds are defined
- hasVolume() bool
Check whether the reference SisypheVolume attribute of the current SisypheROIDraw instance is defined (not None).
Returns
- bool
True if reference SisypheVolume attribute is defined
- interpolateBetweenSlices(sindex1: int, sindex2: int, dim: int, replace=False) None
Cavalieri’s interpolation method is used to fill in the slices of the SisypheROI attribute between two slices sent as parameters (sindex1 and sindex2).
Parameters
- sindex1int
first slice index
- sindex2int
last slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- replacebool
if True, the interpolated slices replace the previous ones
if False (default), interpolated slices are combined (or logical) with previous ones
- interpolateEmptySlices(sindex: int, dim: int) None
Empty slices are interpolated between two non-empty slices above and below. Non-empty slices are searched for above and below a starting slice given as parameter. Cavalieri’s interpolation method is used to fill in the empty slices of the SisypheROI attribute.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- majorBlobSelect() None
Remove all blobs (connected components) except the largest one, from the SisypheROI image attribute.
- majorBlobSelectSlice(sindex: int, dim: int)
Remove all blobs (connected components) except for the largest one, from a SisypheROI attribute slice.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- maskSegment(algo: str = 'huang', morpho: str = '', niter: int = 1, kernel: int = 0, fill: str = '')
Automatic head/brain mask segmentation of the SisypheROI image attribute.
Parameters
- algostr
algorithm used to find the best threshold for separating a mask from the background. Available algorithm names : ‘mean’, ‘otsu’, ‘huang’, ‘renyi’, ‘yen’, ‘li’, ‘shanbhag’, ‘triangle’, ‘intermodes’, ‘maximumentropy’, ‘kittler’, ‘isodata’, ‘moments’
- morphostr
binary morphology operator: ‘dilate’, ‘erode’, ‘open’, ‘close’, ‘’ (default, no morphology)
- niterint
number of binary morphology iterations
- kernelint
structuring element size
- fillstr
‘2d’, fill holes slice by slice
‘3d’, fill holes in 3D
‘’, no filling
- maskSegment2(algo: str = 'huang', morphoiter: int = 2, kernel: int = 0)
Automatic head/brain mask segmentation of the SisypheROI image attribute.
Parameters
- algostr
algorithm used to find the best threshold for separating a mask from the background. Available algorithm names : ‘mean’, ‘otsu’, ‘huang’, ‘renyi’, ‘yen’, ‘li’, ‘shanbhag’, ‘triangle’, ‘intermodes’, ‘maximumentropy’, ‘kittler’, ‘isodata’, ‘moments’
- morphoiterint
number of binary morphology iterations
- kernelint
structuring element size, 0 automatic value (kernel=2 if spacing < 1.5 mm, kernel=1 otherwise)
- morphoBlobClosing(x: int, y: int, z: int, radius: int | None = None, struct: int | None = None) None
Morphological closing of the SisypheROI image attribute. Processing only applies to a blob selected by the coordinates of one of its voxels.
Parameters
- xint
x-axis coordinate of the voxel used for blob selection
- yint
y-axis coordinate of the voxel used for blob selection
- zint
z-axis coordinate of the voxel used for blob selection
- radiusint | None
structuring element radius in voxels (Default is None). If None, get radius from the morphological radius attribute of the current SisypheROIDraw instance (see setMorphologyRadius() method)
- structint | None
- structuring element shape as SimpleITK int code (Default is None)
0 Annulus
1 disk
2 box
3 cross
if None, get structuring element shape from the structuring element attribute of the current SisypheROIDraw instance (see setStructElement() method)
- morphoBlobDilate(x: int, y: int, z: int, radius: int | None = None, struct: int | None = None) None
Morphological dilatation of the SisypheROI image attribute. Processing only applies to a blob selected by the coordinates of one of its voxels.
Parameters
- xint
x-axis coordinate of the voxel used for blob selection
- yint
y-axis coordinate of the voxel used for blob selection
- zint
z-axis coordinate of the voxel used for blob selection
- radiusint | None
structuring element radius in voxels (Default is None). If None, get radius from the morphological radius attribute of the current SisypheROIDraw instance (see setMorphologyRadius() method)
- structint | None
- structuring element shape as SimpleITK int code (Default is None)
0 Annulus
1 disk
2 box
3 cross
if None, get structuring element shape from the structuring element attribute of the current SisypheROIDraw instance (see setStructElement() method)
- morphoBlobErode(x: int, y: int, z: int, radius: int | None = None, struct: int | None = None) None
Morphological erosion of the SisypheROI image attribute. Processing only applies to a blob selected by the coordinates of one of its voxels.
Parameters
- xint
x-axis coordinate of the voxel used for blob selection
- yint
y-axis coordinate of the voxel used for blob selection
- zint
z-axis coordinate of the voxel used for blob selection
- radiusint | None
structuring element radius in voxels (Default is None). If None, get radius from the morphological radius attribute of the current SisypheROIDraw instance (see setMorphologyRadius() method)
- structint | None
- structuring element shape as SimpleITK int code (Default is None)
0 Annulus
1 disk
2 box
3 cross
if None, get structuring element shape from the structuring element attribute of the current SisypheROIDraw instance (see setStructElement() method)
- morphoBlobOpening(x: int, y: int, z: int, radius: int | None = None, struct: int | None = None) None
Morphological opening of the SisypheROI image attribute. Processing only applies to a blob selected by the coordinates of one of its voxels.
Parameters
- xint
x-axis coordinate of the voxel used for blob selection
- yint
y-axis coordinate of the voxel used for blob selection
- zint
z-axis coordinate of the voxel used for blob selection
- radiusint | None
structuring element radius in voxels (Default is None). If None, get radius from the morphological radius attribute of the current SisypheROIDraw instance (see setMorphologyRadius() method)
- structint | None
- structuring element shape as SimpleITK int code (Default is None)
0 Annulus
1 disk
2 box
3 cross
if None, get structuring element shape from the structuring element attribute of the current SisypheROIDraw instance (see setStructElement() method)
- morphoClosing(radius: int | None = None, struct: int | None = None) None
Morphological closing of the SisypheROI image attribute.
Parameters
- radiusint | None
structuring element radius in voxels (Default is None). If None, get radius from the morphological radius attribute of the current SisypheROIDraw instance (see setMorphologyRadius() method)
- structint | None
- structuring element shape as SimpleITK int code (Default is None)
0 Annulus
1 disk
2 box
3 cross
if None, get structuring element shape from the structuring element attribute of the current SisypheROIDraw instance (see setStructElement() method)
- morphoDilate(radius: int | None = None, struct: int | None = None) None
Morphological dilatation of the SisypheROI image attribute.
Parameters
- radiusint | None
structuring element radius in voxels (Default is None). If None, get radius from the morphological radius attribute of the current SisypheROIDraw instance (see setMorphologyRadius() method)
- structint | None
- structuring element shape as SimpleITK int code (Default is None)
0 Annulus
1 disk
2 box
3 cross
if None, get structuring element shape from the structuring element attribute of the current SisypheROIDraw instance (see setStructElement() method)
- morphoErode(radius: int | None = None, struct: int | None = None) None
Morphological erosion of the SisypheROI image attribute.
Parameters
- radiusint | None
structuring element radius in voxels (Default is None). If None, get radius from the morphological radius attribute of the current SisypheROIDraw instance (see setMorphologyRadius() method)
- structint | None
- structuring element shape as SimpleITK int code (Default is None)
0 Annulus
1 disk
2 box
3 cross
if None, get structuring element shape from the structuring element attribute of the current SisypheROIDraw instance (see setStructElement() method)
- morphoOpening(radius: int | None = None, struct: int | None = None) None
Morphological opening of the SisypheROI image attribute.
Parameters
- radiusint | None
structuring element radius in voxels (Default is None). If None, get radius from the morphological radius attribute of the current SisypheROIDraw instance (see setMorphologyRadius() method)
- structint | None
- structuring element shape as SimpleITK int code (Default is None)
0 Annulus
1 disk
2 box
3 cross
if None, get structuring element shape from the structuring element attribute of the current SisypheROIDraw instance (see setStructElement() method)
- morphoSliceBlobClosing(sindex: int, dim: int, x: int, y: int, z: int, radius: int | None = None, struct: int | None = None) None
Morphological closing of a SisypheROI attribute slice. Processing only applies to a blob selected by the coordinates of one of its voxels.
Parameters
- sindexint
slice index
- dimint
slice orientation code, - 0 z-axis slice (axial), - 1 y-axis slice (coronal), - 2 x-axis slice (sagittal)
- xint
x-axis coordinate of the voxel used for blob selection
- yint
y-axis coordinate of the voxel used for blob selection
- zint
z-axis coordinate of the voxel used for blob selection
- radiusint | None
structuring element radius in voxels (Default is None). If None, get radius from the morphological radius attribute of the current SisypheROIDraw instance (see setMorphologyRadius() method)
- structint | None
- structuring element shape as SimpleITK int code (Default is None)
0 Annulus
1 disk
2 box
3 cross
if None, get structuring element shape from the structuring element attribute of the current SisypheROIDraw instance (see setStructElement() method)
- morphoSliceBlobDilate(sindex: int, dim: int, x: int, y: int, z: int, radius: int | None = None, struct: int | None = None) None
Morphological dilatation of a SisypheROI attribute slice. Processing only applies to a blob selected by the coordinates of one of its voxels.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- xint
x-axis coordinate of the voxel used for blob selection
- yint
y-axis coordinate of the voxel used for blob selection
- zint
z-axis coordinate of the voxel used for blob selection
- radiusint | None
structuring element radius in voxels (Default is None). If None, get radius from the morphological radius attribute of the current SisypheROIDraw instance (see setMorphologyRadius() method)
- structint | None
- structuring element shape as SimpleITK int code (Default is None)
0 Annulus
1 disk
2 box
3 cross
if None, get structuring element shape from the structuring element attribute of the current SisypheROIDraw instance (see setStructElement() method)
- morphoSliceBlobErode(sindex: int, dim: int, x: int, y: int, z: int, radius: int | None = None, struct: int | None = None) None
Morphological erosion of a SisypheROI attribute slice. Processing only applies to a blob selected by the coordinates of one of its voxels.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- xint
x-axis coordinate of the voxel used for blob selection
- yint
y-axis coordinate of the voxel used for blob selection
- zint
z-axis coordinate of the voxel used for blob selection
- radiusint | None
structuring element radius in voxels (Default is None). If None, get radius from the morphological radius attribute of the current SisypheROIDraw instance (see setMorphologyRadius() method)
- structint | None
- structuring element shape as SimpleITK int code (Default is None)
0 Annulus
1 disk
2 box
3 cross
if None, get structuring element shape from the structuring element attribute of the current SisypheROIDraw instance (see setStructElement() method)
- morphoSliceBlobOpening(sindex: int, dim: int, x: int, y: int, z: int, radius: int | None = None, struct: int | None = None) None
Morphological opening of a SisypheROI attribute slice. Processing only applies to a blob selected by the coordinates of one of its voxels.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- xint
x-axis coordinate of the voxel used for blob selection
- yint
y-axis coordinate of the voxel used for blob selection
- zint
z-axis coordinate of the voxel used for blob selection
- radiusint | None
structuring element radius in voxels (Default is None). If None, get radius from the morphological radius attribute of the current SisypheROIDraw instance (see setMorphologyRadius() method)
- structint | None
- structuring element shape as SimpleITK int code (Default is None)
0 Annulus
1 disk
2 box
3 cross
if None, get structuring element shape from the structuring element attribute of the current SisypheROIDraw instance (see setStructElement() method)
- morphoSliceClosing(sindex: int, dim: int, radius: int | None = None, struct: int | None = None) None
Morphological closing of a SisypheROI attribute slice.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- radiusint | None
structuring element radius in voxels (Default is None). If None, get radius from the morphological radius attribute of the current SisypheROIDraw instance (see setMorphologyRadius() method)
- structint | None
- structuring element shape as SimpleITK int code (Default is None)
0 Annulus
1 disk
2 box
3 cross
if None, get structuring element shape from the structuring element attribute of the current SisypheROIDraw instance (see setStructElement() method)
- morphoSliceDilate(sindex: int, dim: int, radius: int | None = None, struct: int | None = None) None
Morphological dilatation of a SisypheROI attribute slice.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- radiusint | None
structuring element radius in voxels (Default is None). If None, get radius from the morphological radius attribute of the current SisypheROIDraw instance (see setMorphologyRadius() method)
- structint | None
- structuring element shape as SimpleITK int code (Default is None)
0 Annulus
1 disk
2 box
3 cross
if None, get structuring element shape from the structuring element attribute of the current SisypheROIDraw instance (see setStructElement() method)
- morphoSliceErode(sindex: int, dim: int, radius: int | None = None, struct: int | None = None) None
Morphological erosion of a SisypheROI attribute slice.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- radiusint | None
structuring element radius in voxels (Default is None). If None, get radius from the morphological radius attribute of the current SisypheROIDraw instance (see setMorphologyRadius() method)
- structint | None
- structuring element shape as SimpleITK int code (Default is None)
0 Annulus
1 disk
2 box
3 cross
if None, get structuring element shape from the structuring element attribute of the current SisypheROIDraw instance (see setStructElement() method)
- morphoSliceOpening(sindex: int, dim: int, radius: int | None = None, struct: int | None = None) None
Morphological opening of a SisypheROI attribute slice.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- radiusint | None
structuring element radius in voxels (Default is None). If None, get radius from the morphological radius attribute of the current SisypheROIDraw instance (see setMorphologyRadius() method)
- structint | None
- structuring element shape as SimpleITK int code (Default is None)
0 Annulus
1 disk
2 box
3 cross
if None, get structuring element shape from the structuring element attribute of the current SisypheROIDraw instance (see setStructElement() method)
- notMaskSegment2(algo: str = 'huang', morphoiter: int = 2, kernel: int = 0)
Automatic background mask segmentation of the SisypheROI image attribute.
Parameters
- algostr
algorithm used to find the best threshold for separating a mask from the background. Available algorithm names : ‘mean’, ‘otsu’, ‘huang’, ‘renyi’, ‘yen’, ‘li’, ‘shanbhag’, ‘triangle’, ‘intermodes’, ‘maximumentropy’, ‘kittler’, ‘isodata’, ‘moments’
- morphoiterint
number of binary morphology iterations
- kernelint
structuring element size, 0 automatic value (kernel=2 if spacing < 1.5 mm, kernel=1 otherwise)
- objectSegment(algo: str = 'huang') None
Automatic mask segmentation of the SisypheROI image attribute.
Parameters
- algostr
algorithm used to find the best threshold for separating a mask from the background. Available algorithm names : ‘mean’, ‘otsu’, ‘huang’, ‘renyi’, ‘yen’, ‘li’, ‘shanbhag’, ‘triangle’, ‘intermodes’, ‘maximumentropy’, ‘kittler’, ‘isodata’, ‘moments’
- objectSegmentSlice(sindex: int, dim: int, algo: str = 'huang') None
Automatic mask segmentation in a SisypheROI attribute slice.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- algostr
algorithm used to find the best separation threshold between a mask and the background. Available algorithm names : ‘mean’, ‘otsu’, ‘huang’, ‘renyi’, ‘yen’, ‘li’, ‘shanbhag’, ‘triangle’, ‘intermodes’, ‘maximumentropy’, ‘kittler’, ‘isodata’, ‘moments’ (default ‘huang’)
- pasteBlob(x: int, y: int, z: int) None
Paste the blob from clipboard at the position of the voxel whose coordinates are transmitted, into the SisypheROI image attribute.
Parameters
- xint
x-axis blob selection coordinate
- yint
y-axis blob selection coordinate
- zint
z-axis blob selection coordinate
- pasteBlobSlice(sindex: int, dim: int, x: int, y: int, z: int) None
Paste the blob from clipboard at the position of the voxel whose coordinates are transmitted, into a SisypheROI attribute slice.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- xint
x-axis blob selection coordinate
- yint
y-axis blob selection coordinate
- zint
z-axis blob selection coordinate
- pasteSlice(sindex: int, dim: int) None
Paste a SisypheROI attribute slice from the clipboard.
Parameters
- sindex :int
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- popRedoLIFO() None
Copy the last element (slice or whole ROI) of the LIFO redo stack to the SisypheROI attribute. Redo the last processing of the SisypheROI attribute.
- popUndoLIFO() None
Copy the last element (slice or whole ROI) of the LIFO undo stack to the SisypheROI attribute. Undo the last processing of the SisypheROI attribute.
- regionGrowing(x: int, y: int, z: int, mask: bool = False, replace: bool = False) None
Region growing from a seed voxel in the SisypheROI image attribute.
Parameters
- xint
x-axis seed voxel coordinate
- yint
y-axis seed voxel coordinate
- zint
z-axis seed voxel coordinate
- maskbool
if True, & (and) logic between mask and previous voxels (default False)
- replacebool
if True, mask replaces previous voxels
if False (default), | (or) logic between mask and previous voxels
- regionGrowingBlob(x: int, y: int, z: int) None
Region growing from a seed voxel limited to a blob in the SisypheROI image attribute.
Parameters
- xint
x-axis seed voxel coordinate
- yint
y-axis seed voxel coordinate
- zint
z-axis seed voxel coordinate
- regionGrowingBlobSlice(sindex: int, dim: int, x: int, y: int, z: int) None
Region growing from a seed voxel limited to the surface of a blob in a slice of the SisypheROI attribute.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- xint
x-axis seed voxel coordinate
- yint
y-axis seed voxel coordinate
- zint
z-axis seed voxel coordinate
- regionGrowingConfidence(x: int, y: int, z: int, niter: int | None = None, multi: float | None = None, radius: int | None = None, mask: bool = False, replace: bool = False) None
Region growing confidence from a seed voxel in the SisypheROI image attribute.
SimpleITK ConfidenceConnectedImageFilter doc: https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1ConfidenceConnectedImageFilter.html
This filter extracts a connected set of voxels whose voxel intensities are consistent with the voxel statistics of a seed point. The mean and variance across a neighborhood (8-connected, 26-connected, …) are calculated for a seed point. Then voxels connected to this seed point whose values are within the confidence interval for the seed point are grouped. The width of the confidence interval is controlled by the “multi” parameter (the confidence interval is the mean plus or minus the “multi” times the standard deviation). If the intensity variations across a segment were gaussian, a “multi” setting of 2.5 would define a confidence interval wide enough to capture 99% of samples in the segment.
After this initial segmentation is calculated, the mean and variance are re-calculated. All the voxels in the previous segmentation are used to calculate the mean the standard deviation (as opposed to using the voxels in the neighborhood of the seed point). The segmentation is then recalculated using these refined estimates for the mean and variance of the voxel values. This process is repeated for the specified number of iterations. Setting the number of iterations to zero stops the algorithm after the initial segmentation from the seed point.
Parameters
- xint
x-axis seed voxel coordinate
- yint
y-axis seed voxel coordinate
- zint
z-axis seed voxel coordinate
- niterint | None
number of iteration (default None) if niter is None, niter = confidence connected iterations attribute of the current instance
- multifloat | None
confidence interval = multi * standard deviation (default None) if multi is None, multi = confidence connected sigma attribute of the current instance
- radiusint | None
neighborhood radius (default None) if radius is None, raidus = morphology radius attribute of the current instance
- maskbool
if True, & (and) logic between mask and previous voxels (default False)
- replacebool
if True, mask replaces previous voxels
if False, | (or) logic between mask and previous voxels
- regionGrowingConfidenceBlob(x: int, y: int, z: int, niter: int | None = None, multi: float | None = None, radius: int | None = None) None
Region growing confidence from a seed voxel limited to a blob in the SisypheROI image attribute.
See SimpleITK ConfidenceConnectedImageFilter doc: https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1ConfidenceConnectedImageFilter.html
This filter extracts a connected set of voxels whose voxel intensities are consistent with the voxel statistics of a seed point. The mean and variance across a neighborhood (8-connected, 26-connected, …) are calculated for a seed point. Then voxels connected to this seed point whose values are within the confidence interval for the seed point are grouped. The width of the confidence interval is controlled by the “multi” parameter (the confidence interval is the mean plus or minus the “multi” times the standard deviation). If the intensity variations across a segment were gaussian, a “multi” setting of 2.5 would define a confidence interval wide enough to capture 99% of samples in the segment.
After this initial segmentation is calculated, the mean and variance are re-calculated. All the voxels in the previous segmentation are used to calculate the mean the standard deviation (as opposed to using the voxels in the neighborhood of the seed point). The segmentation is then recalculated using these refined estimates for the mean and variance of the voxel values. This process is repeated for the specified number of iterations. Setting the number of iterations to zero stops the algorithm after the initial segmentation from the seed point.
Parameters
- xint
x-axis seed voxel coordinate
- yint
y-axis seed voxel coordinate
- zint
z-axis seed voxel coordinate
- niterint | None
number of iteration (default None) if niter is None, niter = confidence connected iterations attribute of the current instance
- multifloat
confidence interval = multi * standard deviation (default None) if multi is None, multi = confidence connected sigma attribute of the current instance
- radiusint | None
neighborhood radius (default None) if radius is None, raidus = morphology radius attribute of the current instance
- regionGrowingConfidenceBlobSlice(sindex: int, dim: int, x: int, y: int, z: int, niter: int | None = None, multi: float | None = None, radius: int | None = None) None
Region growing confidence from a seed voxel limited to the surface of a blob in a slice of the SisypheROI attribute.
SimpleITK ConfidenceConnectedImageFilter doc: https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1ConfidenceConnectedImageFilter.html
This filter extracts a connected set of voxels whose voxel intensities are consistent with the voxel statistics of a seed point. The mean and variance across a neighborhood (8-connected, 26-connected, …) are calculated for a seed point. Then voxels connected to this seed point whose values are within the confidence interval for the seed point are grouped. The width of the confidence interval is controlled by the “multi” parameter (the confidence interval is the mean plus or minus the “multi” times the standard deviation). If the intensity variations across a segment were gaussian, a “multi” setting of 2.5 would define a confidence interval wide enough to capture 99% of samples in the segment.
After this initial segmentation is calculated, the mean and variance are re-calculated. All the voxels in the previous segmentation are used to calculate the mean the standard deviation (as opposed to using the voxels in the neighborhood of the seed point). The segmentation is then recalculated using these refined estimates for the mean and variance of the voxel values. This process is repeated for the specified number of iterations. Setting the number of iterations to zero stops the algorithm after the initial segmentation from the seed point.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- xint
x-axis seed voxel coordinate
- yint
y-axis seed voxel coordinate
- zint
z-axis seed voxel coordinate
- niterint | None
number of iteration (default None) if niter is None, niter = confidence connected iterations attribute of the current instance
- multifloat | None
confidence interval = multi * standard deviation (default None) if multi is None, multi = confidence connected sigma attribute of the current instance
- radiusint | None
neighborhood radius (default None) if radius is None, multi = morphology radius attribute of the current instance
- regionGrowingConfidenceSlice(sindex: int, dim: int, x: int, y: int, z: int, niter: int | None = None, multi: float | None = None, radius: int | None = None, mask: bool = False, replace: bool = False) None
Region growing confidence from a seed voxel in a slice of the SisypheROI attribute.
SimpleITK ConfidenceConnectedImageFilter doc: https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1ConfidenceConnectedImageFilter.html
This filter extracts a connected set of voxels whose voxel intensities are consistent with the voxel statistics of a seed point. The mean and variance across a neighborhood (8-connected, 26-connected, …) are calculated for a seed point. Then voxels connected to this seed point whose values are within the confidence interval for the seed point are grouped. The width of the confidence interval is controlled by the “multi” parameter (the confidence interval is the mean plus or minus the “multi” times the standard deviation). If the intensity variations across a segment were gaussian, a “multi” setting of 2.5 would define a confidence interval wide enough to capture 99% of samples in the segment.
After this initial segmentation is calculated, the mean and variance are re-calculated. All the voxels in the previous segmentation are used to calculate the mean the standard deviation (as opposed to using the voxels in the neighborhood of the seed point). The segmentation is then recalculated using these refined estimates for the mean and variance of the voxel values. This process is repeated for the specified number of iterations. Setting the number of iterations to zero stops the algorithm after the initial segmentation from the seed point.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- xint
x-axis seed voxel coordinate
- yint
y-axis seed voxel coordinate
- zint
z-axis seed voxel coordinate
- niterint | None
number of iteration (default None) if niter is None, niter = confidence connected iterations attribute of the current instance
- multifloat | None
confidence interval = multi * standard deviation (default None) if multi is None, multi = confidence connected sigma attribute of the current instance
- radiusint | None
neighborhood radius (default None) if radius is None, raidus = morphology radius attribute of the current instance
- maskbool
if True, & (and) logic between mask and previous voxels of the slice (default False)
- replacebool
if True, mask replaces previous voxels of the slice
if False (default), or logic between mask and previous voxels of the slice
- regionGrowingSlice(sindex: int, dim: int, x: int, y: int, z: int, mask: bool = False, replace: bool = False) None
Region growing from a seed voxel in a slice of the SisypheROI attribute.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- xint
x-axis seed voxel coordinate
- yint
y-axis seed voxel coordinate
- zint
z-axis seed voxel coordinate
- maskbool
if True, & (and) logic between mask and previous voxels of the slice (default False)
- replacebool
if True, mask replaces previous voxels of the slice
if False (default), or logic between mask and previous voxels of the slice
- removeROI() None
Remove the SisypheROI attribute to the current SisypheROIDraw instance.
- seedFill(x: int, y: int, z: int) None
Fill background voxels (i.e. 0 value) from a seed voxel in the SisypheROI. Filling algorithm starts from a seed voxel whose x, y and z coordinates are provided.
Parameters
- xint
x-axis seed coordinate
- yint
y-axis seed coordinate
- zint
z-axis seed coordinate
- seedFillSlice(sindex: int, dim: int, x: int, y: int, z: int) None
Fill background voxels (i.e. 0 value) from a seed voxel in a SisypheROI attribute slice. Filling algorithm starts from a seed voxel whose x, y and z coordinates are provided.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- xint
x-axis seed coordinate
- yint
y-axis seed coordinate
- zint
z-axis seed coordinate
- setActiveContourAdvectionWeight(weight: float = 1.0) None
Set the active contour advection weight attribute of the current SisypheDraw instance. This attribute is used by the activeContourSegmentation() method. Active contour is an iterative level set method of segmentation, starting from a seed sphere.
Advection attribute (default 1.0) controls the scaling of the vector advection field term relative to other terms in the level set equation.
Parameters
- weightfloat
active contour advection weight attribute
- setActiveContourAlgorithm(algo: str = 'geodesic') None
Set the active contour algorithm attribute of the current SisypheDraw instance. This attribute is used by the activeContourSegmentation() method. Active contour is an iterative level set method of segmentation, starting from a seed sphere.
Parameters
- algostr
active contour algorithm attribute (‘geodesic’, ‘shape’ or ‘threshold’)
- setActiveContourConvergence(rms: float = 0.01) None
Set the active contour convergence attribute of the current SisypheDraw instance. This attribute is used by the activeContourSegmentation() method. Active contour is an iterative level set method of segmentation, starting from a seed sphere.
The rms convergence attribute (0.0 < rms < 1.0, default 0.01) is used to determine when the solution has converged. A lower value will result in a tighter-fitting solution, but will require more computations. Too low a value could put the solver into an infinite loop unless a reasonable number of iterations parameter is set.
Parameters
- rmsfloat
active contour convergence attribute
- setActiveContourCurvatureWeight(weight: float = 1.0) None
Set the active contour curvature weight attribute of the current SisypheDraw instance. This attribute is used by the activeContourSegmentation() method. Active contour is an iterative level set method of segmentation, starting from a seed sphere.
The curvature attribute (default 1.0) controls the magnitude of the curvature values which are calculated on the evolving isophote. This is important in controlling the relative effect of curvature in the calculation. Default value is 1.0. Higher values relative to the other level set equation terms (propagation and advection) will give a smoother result.
Parameters
- weightfloat
active contour curvature weight attribute
- setActiveContourFactor(factor: float = 2.0) None
Set the active contour factor attribute of the current SisypheDraw instance. This attribute is used by the activeContourSegmentation() method. Active contour is an iterative level set method of segmentation, starting from a seed sphere.
The factor attribute is only used by the threshold version of the active contour algorithms, if threshold attributes are not defined. The formula mean +/- factor x standard deviation of the signal within the seed sphere is used to estimate the lower and upper threshold parameters (default 3.0).
Parameters
- factorfloat
active contour factor attribute
- setActiveContourNumberOfIterations(niter: int = 1000) None
Set the active contour number of iterations attribute of the current SisypheDraw instance. This attribute is used by the activeContourSegmentation() method. Active contour is an iterative level set method of segmentation, starting from a seed sphere.
Parameters
- niterint
active contour number of iterations attribute
- setActiveContourPropagationWeight(weight: float = 1.0) None
Set the active contour propagation weight attribute of the current SisypheDraw instance. This attribute is used by the activeContourSegmentation() method. Active contour is an iterative level set method of segmentation, starting from a seed sphere.
The propagation speed attribute (default 1.0) controls the scaling of the scalar propagation (speed) term relative to other terms in the level set equation. > 0 propagation outwards, < 0 propagating inwards.
Parameters
- weightfloat
active contour propagation weight attribute
- setActiveContourSeedRadius(radius: float = 2.0) None
Set the active contour seed radius attribute of the current SisypheDraw instance. This attribute is used by the activeContourSegmentation() method. Active contour is an iterative level set method of segmentation, starting from a seed sphere.
Parameters
- radiusfloat
active contour seed radius attribute, seed sphere radius in mm
- setActiveContourSigma(sigma: float = 1.0) None
Set the active contour sigma attribute of the current SisypheDraw instance. This attribute is used by the activeContourSegmentation() method. Active contour is an iterative level set method of segmentation, starting from a seed sphere.
The sigma attribute is a gaussian kernel parameter used to compute the magnitude of the gradient. The edge potential map of the level set algorithm is computed from the image gradient. Edge potential map is that it has values close to zero in regions near the edges and values close to one inside the shape itself. This map is the image from which the speed function will be calculated.
Parameters
- sigmafloat
active contour sigma attribute
- setActiveContourThresholds(thresholds: tuple[float, float] | None) None
Set the active contour threshold attributes of the current SisypheDraw instance. This attribute is used by the activeContourSegmentation() method. Active contour is an iterative level set method of segmentation, starting from a seed sphere.
Lower and upper threshold attributes are only used by the threshold version of the active contour algorithms.
Parameters
- thresholdstuple[float, float]
Lower and upper thresholds
- setBrushRadius(radius: int) None
Set the radius (in voxels) of the brush used to hand-draw in the SisypheROI image.
Parameters
- radiusint
brush radius in voxels
- setBrushType(brushtype: int | str) None
Set the brush type, as str name or int code, used to hand-draw in the SisypheROI image.
Parameters
- brushtype int | str
name or int code
0 or ‘solid’ disc-shaped 2D brush
1 or ‘threshold’ thresholded voxels of the disc-shaped 2D brush surface
2 or ‘solid3’ sphere-shaped 3D brush
3 or ‘threshold3’ thresholded voxels in sphere-shaped 3D brush volume
- setConfidenceConnectedIter(iters: int = 4) None
Set the confidence connected number of iterations attribute of the current SisypheDraw instance.
Parameters
- itersint
confidence connected number of iterations attribute
- setConfidenceConnectedSigma(sigma: float = 2.0) None
Set the confidence connected sigma attribute of the current SisypheDraw instance.
Parameters
- sigmafloat
confidence connected sigma attribute
- setFullRangeThreshold() None
Set the minimum and maximum value thresholds to the minimum and maximum scalar values in the reference SisypheVolume instance. These thresholds are used in some processing methods.
- setHuangThreshold(background: bool = False) None
Set minimum and maximum value thresholds using Huang algorithm. These thresholds are used in some processing methods.
Parameters
- backgroundbool
- True:
minimum threshold = minimum scalar value in the reference SisypheVolume instance
maximum threshold processed by Huang algorithm
- False:
minimum threshold processed by Huang algorithm
maximum threshold = maximum scalar value in the reference SisypheVolume instance
- setMeanThreshold(background: bool = False) None
Set minimum and maximum value thresholds using Mean algorithm. These thresholds are used in some processing methods.
Parameters
- backgroundbool
- True:
minimum threshold = minimum scalar value in the reference SisypheVolume instance
maximum threshold processed by Mean algorithm
- False:
minimum threshold processed by Mean algorithm
maximum threshold = maximum scalar value in the reference SisypheVolume instance
- setMorphologyRadius(radius: float) None
Set the radius (in voxels) of the structuring element used in morphological methods (erosion, dilatation, opening, closing).
Parameters
- radiusint
structuring element radius in voxels
- setOtsuThreshold(background: bool = False) None
Set minimum and maximum value thresholds using Otsu algorithm. These thresholds are used in some processing methods.
Parameters
- backgroundbool
- True:
minimum threshold = minimum scalar value in the reference SisypheVolume instance
maximum threshold processed by Otsu algorithm
- False:
minimum threshold processed by Otsu algorithm
maximum threshold = maximum scalar value in the reference SisypheVolume instance
- setROI(roi: SisypheROI) None
Set the SisypheROI image attribute to the current SisypheROIDraw instance. This is the ROI image processed in the current SisypheROIDraw instance. Same space as reference SisypheVolume attribute (same size and spacing).
Parameters
- roiSisyphe.core.sisypheROI.SisypheROI
roi to be processed
- setStructElement(struct: str) None
Set the structuring element shape, as str name, used in morphological methods (erosion, dilatation, opening, closing).
Parameters
- structstr
structuring element: ‘ball’, ‘box’, ‘cross’ or ‘annulus’
- setThickness(mm: float) None
Set the margin (in mm) used in euclidean expanding/shrinking methods (euclideanDilate, euclideanErode, 2D and 3D, whole and blob versions).
Parameters
- mmfloat
margin in mm
- setThresholdMax(vmax: float) None
Set the maximum value threshold used in some methods.
Parameters
- vmaxfloat
maximum value threshold
- setThresholdMin(vmin: float) None
Set the minimum value threshold used in some methods.
Parameters
- vminfloat
minimum value threshold
- setThresholds(vmin: float, vmax: float) None
Set the minimum and maximum value thresholds used in some methods.
Parameters
- vminfloat
minimum value threshold
- vmaxfloat
maximum value threshold
- setUndo(v: bool) None
Enables/disables undo/redo abilities of the current SisypheROIDraw instance. All ROI processing is stored in a LIFO stack if this option is enabled.
Parameters
- vboolean
undo enabled if True
- setUndoOff() None
Disables undo/redo abilities of the current SisypheROIDraw instance. All ROI processing is stored in a LIFO stack if this option is enabled.
- setUndoOn() None
Enables undo/redo abilities of the current SisypheROIDraw instance. All ROI processing is stored in a LIFO stack if this option is enabled.
- setVolume(volume: SisypheVolume) None
Set the reference SisypheVolume image attribute to the current SisypheROIDraw instance. Same space as SisypheROI attribute (same size and spacing). Many methods require a reference SisypheVolume (including segmentation methods).
Parameters
- volumeSisyphe.core.sisypheVolume.SisypheVolume
reference volume
- shift(movex: int, movey: int, movez: int) None
Image shift of the SisypheROI image attribute.
Parameters
- movexint
shift in x-slice-axis (in voxels)
- moveyint
shift in y-slice-axis (in voxels)
- movezint
shift in z-slice-axis (in voxels)
- shiftSlice(sindex: int, dim: int, movex: int, movey: int) None
Image shift of a SisypheROI attribute slice.
Parameters
- sindex :int
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- movexint
shift in x-slice-axis (in voxels)
- moveyint
shift in y-slice-axis (in voxels)
- solid3DBrush(x: int, y: int, z: int, c: int = 1) None
Draw a sphere at the x, y, z coordinates of the SisypheROI image attribute. Disk radius is defined with setBrushRadius() method.
Parameters
- xint
x-axis coordinate
- yint
y-axis coordinate
- zint
z-axis coordinate
- cint
0 (erase) or 1 (draw)
- solidBrush(x: int, y: int, z: int, c: int, dim: int) None
Draw a disk at the x, y, z coordinates of the SisypheROI image attribute. Disk radius is defined with setBrushRadius() method.
Parameters
- xint
x-axis coordinate
- yint
y-axis coordinate
- zint
z-axis coordinate
- cint
0 (erase) or 1 (draw)
- dimint
- slice orientation code
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- threshold3DBrush(x: int, y: int, z: int) None
Draw a sphere at the x, y, z coordinates of the SisypheROI image attribute. In this thresholded version, only voxels with scalar values above a threshold in the SisypheVolume reference are added. Disk radius is defined with setBrushRadius() method.
Parameters
- xint
x-axis coordinate
- yint
y-axis coordinate
- zint
z-axis coordinate
- thresholdBrush(x: int, y: int, z: int, dim: int) None
Draw a disk at the x, y, z coordinates of the SisypheROI image attribute. In this thresholded version, only voxels with scalar values above a threshold in the SisypheVolume reference are added. Disk radius is defined with setBrushRadius() method.
Parameters
- xint
x-axis coordinate
- yint
y-axis coordinate
- zint
z-axis coordinate
- dimint
- slice orientation code
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- thresholding(mask: bool = False, replace: bool = False) None
Calculate a mask of the SisypheROI image attribute of voxels whose scalar value is greater than a threshold in the reference SisypheVolume image attribute.
Parameters
- maskbool
if True, & (and) logic between mask and previous voxels (default False)
- replacebool
if True, mask replaces previous voxels
if False (default), | (or) logic between mask and previous voxels
- thresholdingBlob(x: int, y: int, z: int) None
Calculate a mask limited to a blob of the SisypheROI image attribute of voxels whose scalar value is greater than a threshold in the reference image SisypheVolume attribute.
Parameters
- xint
x-axis blob selection coordinate
- yint
y-axis blob selection coordinate
- zint
z-axis blob selection coordinate
- thresholdingBlobSlice(sindex: int, dim: int, x: int, y: int, z: int) None
Calculate a mask limited to the surface of a blob in a slice of the SisypheROI attribute of voxels whose scalar value is greater than a threshold in the reference SisypheVolume attribute.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- xint
x-axis blob selection coordinate
- yint
y-axis blob selection coordinate
- zint
z-axis blob selection coordinate
- thresholdingSlice(sindex: int, dim: int, mask: bool = False, replace: bool = False) None
Calculate a mask in a slice of the SisypheROI attribute of voxels whose scalar value is greater than a threshold in the reference SisypheVolume attribute.
Parameters
- sindexint
slice index
- dimint
- slice orientation code,
0 z-axis slice (axial),
1 y-axis slice (coronal),
2 x-axis slice (sagittal)
- maskbool
if True, & (and) logic between mask and previous voxels of the slice (default False)
- replacebool
if True, mask replaces previous voxels of the slice
if False, | (or) logic between mask and previous voxels of the slice
- class Sisyphe.core.sisypheROI.SisypheROIFeatures(vol: SisypheVolume | None = None, rois: SisypheROICollection | None = None)
Description
Extract features (descriptive statistics, shape, texture) from SisypheROI and SisypheVolume instance(s).
Inheritance
object -> SisypheROIFeatures
Creation: 08/09/2022 Last revision: 15/12/2023
- execute(progress: DialogWait | None = None) None
Execute features calculation.
- List of calculated features enabled by tag methods :
setFirstOrderTag()
setGrayLevelCooccurrenceMatrixTag()
setGrayLevelSizeZoneMatrixTag()
setGrayLevelRunLengthMatrixTag()
setNeighbouringGrayToneDifferenceMatrixTag()
setGrayLevelDependenceMatrixTag()
setShapeTag()
Feature results are set in the pandas.DataFrame instance attribute of the current SisypheROIFeatures instance.
Parameters
- progressSisyphe.gui.dialogWait.DialogWait | None
progress bar dialog (optional)
- getDataFrame() DataFrame
Get the pandas.DataFrame instance attribute of the current SisypheROIFeatures instance.
Returns
- pandas.DataFrame
DataFrame, table of features
- getGrayLevelCooccurrenceMatrixTag() bool
Get tag state of the GrayLevelCooccurrenceMatrix features.
Returns
- bool
True if enabled
- getGrayLevelDependenceMatrixTag() bool
Get tag state of the GrayLevelDependenceMatrix features.
Returns
- bool
True if enabled
- getGrayLevelRunLengthMatrixTag() bool
Get tag state of the GrayLevelRunLengthMatrix features.
Returns
- bool
True if enabled
- getGrayLevelSizeZoneMatrixTag() bool
Get tag state of the GrayLevelSizeZoneMatrix features.
Returns
- bool
True if enabled
- getNeighbouringGrayToneDifferenceMatrixTag() bool
Get tag state of the NeighbouringGrayToneDifferenceMatrix features.
Returns
- bool
True if enabled
- getROICollection() SisypheROICollection
Get the SisypheROICollection attribute from the current SisypheROIFeatures instance. Same space as SisypheROICollection attribute (same image size and spacing).
Returns
- SisypheROICollection
roi collection to be processed
- getVolume() SisypheVolume
Get the reference SisypheVolume image attribute from the current SisypheROIFeatures instance. Same space as SisypheROICollection attribute (same image size and spacing).
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
reference volume
- hasROICollection() bool
Check whether the SisypheROICollection attribute of the current SisypheROIFeatures instance is defined (not None).
Returns
- bool
True if SisypheROICollection attribute is defined
- hasVolume() bool
Check whether the reference SisypheVolume attribute of the current SisypheROIFeatures instance is defined (not None).
Returns
- bool
True if reference SisypheVolume attribute is defined
- saveToCSV(filename: str) None
Save calculated features to a CSV file (.csv).
Parameters
- filenamestr
csv file name
- saveToXLSX(filename: str) None
Save calculated features to an Excel file (.xlsx).
Parameters
- filenamestr
Excel file name
- setAllTagsOn() None
Enables all features.
- setFirstOrderTag(v: bool) None
Enable/Disable the FirstOrder features.
See https://pyradiomics.readthedocs.io/en/latest/features.html#radiomics.firstorder.RadiomicsFirstOrder
FirstOrder features : energy, total energy, entropy, 10th percentile, 90th percentile, minimum, maximum, mean, median, interquartile range, range, mean absolute deviation, robust mean absolute deviation, root mean squared, standard deviation
Parameters
- vbool
enabled if True
- setGrayLevelCooccurrenceMatrixTag(v: bool) None
Enable/Disable the GrayLevelCooccurrenceMatrix (GLCM) features.
See https://pyradiomics.readthedocs.io/en/latest/features.html#module-radiomics.glcm
GLCM features : autocorrelation, joint average, cluster prominence, cluster shade, cluster tendency, contrast, correlation, difference average, difference entropy, difference variance, dissimilarity, joint energy, joint entropy, homogeneity 1 and 2, informational measure of correlation 1 and 2, inverse difference moment, maximal correlation coefficient, inverse difference moment normalized, inverse difference, inverse difference normalized, inverse variance, maximum probability, sum average, sum variance, sum entropy, sum of squares
Parameters
- vbool
enabled if True
- setGrayLevelDependenceMatrixTag(v: bool) None
Enable/Disable the GrayLevelDependenceMatrix (GLDM) features.
See https://pyradiomics.readthedocs.io/en/latest/features.html#module-radiomics.gldm
GLDM features : small dependence emphasis, large dependence emphasis, gray level non-uniformity, gray level non-uniformity normalized, dependence non-uniformity, dependence non-uniformity normalized, gray level variance, dependence variance, dependence entropy, low gray level emphasis, high gray level emphasis, small dependence low gray level emphasis, small dependence high gray level emphasis, large dependence low gray level emphasis, large dependence high gray level emphasis
Parameters
- vbool
enabled if True
- setGrayLevelRunLengthMatrixTag(v: bool) None
Enable/Disable the GrayLevelRunLengthMatrix (GLRLM) features.
See https://pyradiomics.readthedocs.io/en/latest/features.html#module-radiomics.glrlm
GLRLM features : short run emphasis, long run emphasis, gray level non-uniformity, gray level non-uniformity normalized, run length non-uniformity, run length non-uniformity normalized, run percentage, gray level variance, run variance, run entropy, low gray level run emphasis, high gray level run emphasis, short run low gray level emphasis, short run high gray level emphasis, long run low gray level emphasis, long run high gray level emphasis
Parameters
- vbool
enabled if True
- setGrayLevelSizeZoneMatrixTag(v: bool) None
Enable/Disable the GrayLevelSizeZoneMatrix (GLSZM) features.
See https://pyradiomics.readthedocs.io/en/latest/features.html#module-radiomics.glszm
GLSZM features : small area emphasis, large area emphasis, gray level non-uniformity, gray level non-uniformity normalized, size-Zone non-uniformity, size-zone non-uniformity normalized, zone percentage, gray level variance, zone variance, zone entropy, low gray level zone emphasis, high gray level zone emphasis, small area low gray level emphasis, small area high gray level emphasis, large area low gray level emphasis, large area high gray level emphasis
Parameters
- vbool
enabled if True
- setNeighbouringGrayToneDifferenceMatrixTag(v: bool) None
Enable/Disable the NeighbouringGrayToneDifferenceMatrix (NGTDM) features.
See https://pyradiomics.readthedocs.io/en/latest/features.html#module-radiomics.ngtdm
NGTDM features : coarseness, contrast, busyness, complexity, strength
Parameters
- vbool
enabled if True
- setROICollection(rois: SisypheROICollection) None
Set the SisypheROICollection attribute to the current SisypheROIFeatures instance. Same space as SisypheVolume attribute (same image size and spacing).
Parameters
- roisSisypheROICollection
roi collection to be processed
- setROICollectionFromLabelVolume(v: SisypheVolume) None
Convert the SisypheVolume instance of labels to SisypheROI images added to a SisypheROICollection instance (see fromLabelVolume() docstrings of the SisypheROICollection class) and set it to the current SisypheROIFeatures instance.
Parameters
- vSisyphe.core.sisypheVolume.SisypheVolume
label volume
- setShapeTag(v: bool) None
Enable/Disable the Shape features.
See https://pyradiomics.readthedocs.io/en/latest/features.html#module-radiomics.shape
Shape features : mesh volume, voxel volume, surface area, surface area to volume ratio, sphericity, compactness 1 and 2, spherical disproportion, maximum 3D diameter, maximum 2D diameter (slice), maximum 2D diameter (column), maximum 2D diameter (row), major axis length, minor Axis Length, least axis Length, elongation, flatness, mesh Surface, pixel surface, perimeter, perimeter to surface ratio, sphericity, spherical disproportion, maximum 2D diameter, major axis length, minor axis length, elongation
Parameters
- vbool
enabled if True
- setVolume(volume: SisypheVolume) None
Set the reference SisypheVolume image attribute to the current SisypheROIFeatures instance. Same space as SisypheROICollection attribute (same image size and spacing).
Parameters
- volumeSisyphe.core.sisypheVolume.SisypheVolume
reference volume
- class Sisyphe.core.sisypheROI.SisypheROIHistogram(vol: SisypheVolume | None = None, rois: SisypheROICollection | None = None)
Description
Extract histograms from SisypheROICollection instance.
Inheritance
object -> SisypheROIHistogram
Creation: 08/09/2022 Last revision: 15/12/2023
- execute(progress: DialogWait | None = None) None
Execute histogram(s) calculation. Histogram results are set in the pandas.DataFrame instance attribute of the current SisypheROIFeatures instance.
Parameters
- progressSisyphe.gui.dialogWait.DialogWait | None
progress bar dialog (optional)
- getBins() int
Get the histogram bins attribute of the current SisypheROIHistogram instance.
Returns
- int
number of bins in the histogram
- getDataFrame() DataFrame
Get the pandas.DataFrame instance attribute of the current SisypheROIFeatures instance.
Returns
- pandas.DataFrame
DataFrame histogram values
- getHistograms(roi: SisypheROI, norm: bool = False) tuple[DataFrame, DataFrame]
Calculate the histograms of a SisypheROI instance.
Parameters
- roiSisypheROI
roi to be processed
- normbool
histogram normalization if True (default False)
Returns
- tuple[pandas.DataFrame, pandas.DataFrame]
histogram in the first pandas.DataFrame
cumulative histogram in the second pandas.DataFrame
- getROICollection() SisypheROICollection
Get the SisypheROICollection attribute from the current SisypheROIHistogram instance. Same space as SisypheROICollection attribute (same image size and spacing).
Returns
- SisypheROICollection
roi collection to be processed
- getVolume() SisypheVolume
Get the reference SisypheVolume image attribute from the current SisypheROIHistogram instance. Same space as SisypheROICollection attribute (same image size and spacing).
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
reference volume
- hasROICollection() bool
Check whether the SisypheROICollection attribute of the current SisypheROIHistogram instance is defined (not None).
Returns
- bool
True if SisypheROICollection attribute is defined
- hasVolume() bool
Check whether the reference SisypheVolume attribute of the current SisypheROIHistogram instance is defined (not None).
Returns
- bool
True if reference SisypheVolume attribute is defined
- saveToCSV(filename: str) None
Save calculated histogram(s) to a CSV file (.csv).
Parameters
- filenamestr
csv file name
- saveToXLSX(filename: str) None
Save calculated histogram(s) to an Excel file (.xlsx).
Parameters
- filenamestr
Excel file name
- setBins(v: int) None
Set the histogram bins attribute of the current SisypheROIHistogram instance.
Parameters
- vint
number of bins in the histogram
- setROICollection(rois: SisypheROICollection) None
Set the SisypheROICollection attribute to the current SisypheROIHistogram instance. Same space as SisypheVolume attribute (same image size and spacing).
Parameters
- roisSisypheROICollection
roi collection to be processed
- setROICollectionFromLabelVolume(v: SisypheVolume) None
Convert the SisypheVolume instance of labels to SisypheROI images added to a SisypheROICollection instance (see fromLabelVolume() docstrings of the SisypheROICollection class) and set it to the current SisypheROIHistogram instance.
Parameters
- vSisyphe.core.sisypheVolume.SisypheVolume
label volume
- setVolume(volume: SisypheVolume) None
Set the reference SisypheVolume image attribute to the current SisypheROIHistogram instance. Same space as SisypheROICollection attribute (same image size and spacing).
Parameters
- volumeSisyphe.core.sisypheVolume.SisypheVolume
reference volume