OrsVolumeROITools

Manages the tools applicable to Regions of Interest

author:

Dragonfly Team

contact:

https://dragonfly.comet.tech

email:

support.dragonfly@comet.tech

organization:

Comet Technologies Canada Inc.

address:

460 Ste-Catherine Ouest, suite 600, Montréal, Québec, Canada, H3B 1A7

copyright:

Comet Technologies Canada Inc. All rights reserved 2023.

date:

Sep 11 2015 12:03

dragonflyVersion:

3.1.0.286 (D)

UUID:

5bc96a00761e11e79055448a5b5d70c0

Class Code

class OrsPythonPlugins.OrsVolumeROITools.OrsVolumeROITools.OrsVolumeROITools(*args, **kwargs)
SobelWatershedFromMultiROI2D(aMultiROI, dataset=None, mask=None)

Entry point for computing watershed 2D on a MultiROI or from a list of ROIs

Parameters:
  • orsObject – MultiROI

  • roiForShape – ROI

interfacemethod addRange(listROIToModify: List[Union[ROI, MultiROI]], dataset: Channel, rangeMin: float, rangeMax: float, timeStep: int = 0) None

Adds each voxel where the intensity in the dataset is included in the given range.

Parameters:
  • listROIToModify (ORSModel.ors.ROI, ORSModel.ors.MultiROI) [count=[1, None]] – ROI or MultiROI to modify

  • dataset (ORSModel.ors.Channel) [const] – Dataset for range comparison

  • rangeMin (float) – minimal value of the range

  • rangeMax (float) – maximal value of the range

  • timeStep (int) – timeIndex, or -1 for all time

interfacemethod addRangeInterpolated(listROIToModify: List[ROI], dataset: Channel, rangeMin: float, rangeMax: float, cubicInterpolation: bool, timeStep: int = 0) None

Adds each voxel where the intensity in the dataset is included in the given range.

Parameters:
  • listROIToModify (ORSModel.ors.ROI) [count=[1, None]] – ROI to modify

  • dataset (ORSModel.ors.Channel) [const] – Dataset for range comparison

  • rangeMin (float) – minimal value of the range

  • rangeMax (float) – maximal value of the range

  • cubicInterpolation (bool) – use cubic interpolation

  • timeStep (int) – timeIndex

interfacemethod addRemoveRegionClip(listROIToModify: List[Union[ROI, MultiROI]], layoutFullName: str, dataset: Channel = None, rangeMin: float = 0.0, rangeMax: float = 0.0, add: bool = True, currentTime: int = 0) None

Adds or removes an area determined by a clipping box on a ROI or a MultiROI.

Parameters:
  • listROIToModify (ORSModel.ors.ROI, ORSModel.ors.MultiROI) [count=[1, None]] – ROI or MultiROI to modify

  • layoutFullName (str) – a genealogical name (the view in which the box is present)

  • dataset (ORSModel.ors.Channel) [const] – Dataset for range comparison (if application should be restricted to a range)

  • rangeMin (float) – minimal value of the range

  • rangeMax (float) – maximal value of the range

  • add (bool) – if True, an addition will be done; if False, a removal will be done.

  • currentTime (int) – Time step of the ROI

cleanup()

Deletes the variables managed by the plugin. It is the place to remove callbacks and other references to Python objects that would prevent them to be garbage collected. This method is called during the process of deletion of the plugin. It calls for the cleanup and deletion of the forms.

classmethod clear(listROIToModify, currentTime=0)

Clears the ROIs and/or MultiROIs

Parameters:
classmethod clearForAllTimeSteps(listROIToModify)

Clears the ROIs and/or MultiROIs

Parameters:

listROIToModify (ORSModel.ors.ROI, ORSModel.ors.MultiROI) [count=[1, None]] – ROIs or MultiROIs to clear

interfacemethod clearSingleROI(aROI: Union[ROI, MultiROI], timeStep: int = 0) None

Clears a ROI or MultiROI for a specific timestep

Parameters:
interfacemethod clearSingleROIForAllTimeSteps(aROI: Union[ROI, MultiROI]) None

Clears a ROI or MultiROI for All timeSteps

Parameters:

aROI (ORSModel.ors.ROI, ORSModel.ors.MultiROI) – the ROI or MultiROI to clear

interfacemethod close(aROIToModify: Union[ROI, MultiROI] = None, kernelShape: str = 'square', kernelDim: int = 3, kernelSize: int = 3, dataset: Channel = None, rangeMin: float = 0.0, rangeMax: float = 0.0, repetitionCount: int = 1, currentTime: int = 0, axis: int = 2, sliceIndicesExpr: str = '', listROIToModify: List[Union[ROI, MultiROI]] = None, sliceIndices: SequenceableCollection = None) None

Applies a morphological closing operation on a ROI or a MultiROI.

Changed in version -: Argument listToModify (list) is replaced by aROIToModify (single instance) - Argument sliceIndices (Array) is replaced by sliceIndicesExpr (string expression)

Parameters:
  • aROIToModify (ORSModel.ors.ROI, ORSModel.ors.MultiROI) – ROI or MultiROI to modify

  • kernelShape (str) – Kernel shape (‘square’, ‘circle’ or ‘cross’)

  • kernelDim (int) – Kernel dimension (2 or 3)

  • kernelSize (int) – Kernel size (odd number between 3 and 33)

  • dataset (ORSModel.ors.Channel) [const] – Dataset for range comparison (if application should be restricted to a range)

  • rangeMin (float) – minimal value of the range

  • rangeMax (float) – maximal value of the range

  • repetitionCount (int) – Count of repetition to be applied

  • currentTime (int) – Time step of the ROI

  • axis (int) – axis of operation if 2D kernel 0=X, 1=Y, 2=Z of the StructuredGrid

  • sliceIndicesExpr (str) – slices to work on in the given axis (string expression, 1-based, e.g. ‘1,2,3-5,4-20/3’)

  • listROIToModify (ORSModel.ors.ROI, ORSModel.ors.MultiROI) [count=[1, None]] [deprecated: use aROIToModify instead] – ROI or MultiROI to modify

  • sliceIndices (ORSModel.ors.SequenceableCollection) [deprecated: use sliceIndicesExpr instead] – collection of slices to work on in the given axis

interfacemethod computeAdaptiveWatershed(aROI: ROI, tStep: int, IProgress: Progress = None) MultiROI

Compute the adaptive watershed

Sun, H.Q., and Y.J.Luo. Adaptive watershed segmentation of binary particle image. Journal of microscopy 233.2(2009): 326 - 330.

Parameters:
Returns:

newMultiROI (ORSModel.ors.MultiROI) – the Watershed result MultiROI

interfacemethod computeAdaptiveWatershed2D(aROI: ROI, tStep, IProgress=None)

Compute the adaptive watershed 2D by processing each slice individually

Based on: Sun, H.Q., and Y.J.Luo. Adaptive watershed segmentation of binary particle image. Journal of microscopy 233.2(2009): 326 - 330.

Parameters:
Returns:

newMultiROI (ORSModel.ors.MultiROI) – the Watershed result MultiROI

classmethod computeAdaptiveWatershed2D_fromMenu(aROI: ROI)

Menu action method for the Adaptive Watershed 2D menu item

Parameters:

aROI (ORSModel.ors.ROI) – The ROI to process

interfacemethod computeAnisotropyMIL(aROI: ROI, anisotropyMILRadius: float, anisotropyMILSampling: float, anisotropyMILOrientations: int, anisotropyMILMinIterations: int, anisotropyMILMaxIterations: int, anisotropyMILTolerance: float, IProgress: Progress = None) float

Computes the measurement of the anisotropy using the Mean Intercept Length (MIL).

Parameters:
  • aROI (ORSModel.ors.ROI) [const] – ROI to analyze

  • anisotropyMILRadius (float) – radius to analyze per orientation per star

  • anisotropyMILSampling (float) – distance between each sample on the line of analysis

  • anisotropyMILOrientations (int) – count of lines to analyze per star

  • anisotropyMILMinIterations (int) – minimal count of star to iterate on

  • anisotropyMILMaxIterations (int) – maximal count of star to iterate on

  • anisotropyMILTolerance (float) – smallest variance of anisotropy to reach before ending the iterations

  • IProgress (ORSModel.ors.Progress) – a Progress object

Returns:

anisotropyMIL (float) – measurement of the anisotropy

interfacemethod computeAnisotropySVD(aROI: ROI, anisotropySVDRadius: float, anisotropySVDSampling: float, anisotropySVDOrientations: int, anisotropySVDMinIterations: int, anisotropySVDMaxIterations: int, anisotropySVDTolerance: float, IProgress: Progress = None) float

Computes the measurement of the anisotropy using the Star Volume Distribution (SVD).

Parameters:
  • aROI (ORSModel.ors.ROI) [const] – ROI to analyze

  • anisotropySVDRadius (float) – radius to analyze per orientation per star

  • anisotropySVDSampling (float) – distance between each sample on the line of analysis

  • anisotropySVDOrientations (int) – count of lines to analyze per star

  • anisotropySVDMinIterations (int) – minimal count of star to iterate on

  • anisotropySVDMaxIterations (int) – maximal count of star to iterate on

  • anisotropySVDTolerance (float) – smallest variance of anisotropy to reach before ending the iterations

  • IProgress (ORSModel.ors.Progress) – a Progress object

Returns:

anisotropySVD (float) – measurement of the anisotropy

interfacemethod computeSobelWatershedFromMultiROI2D(aMultiROI: MultiROI, dataset: Channel, mask: ROI, timeStep: int, IProgress: Optional[Progress] = None) MultiROI

Computes the 2D watershed from a MultiROI

Parameters:
  • aMultiROI (ORSModel.ors.MultiROI) – MultiROI to compute the watershed from. The watershed result is put in that same object.

  • dataset (ORSModel.ors.Channel) – Channel used to compute the edge map

  • mask (ORSModel.ors.ROI) – ROI used as a mask to compute the watershed

  • timeStep (int) – time index of aMultiROI and of datasetForShape

  • IProgress (ORSModel.ors.Progress) – progress object

Returns:

newMultiROI (ORSModel.ors.MultiROI) – the Watershed result MultiROI

classmethod computeSparseGraphFromROI2D(aROI: ROI, aProgress: Progress = None, tStep: int = 0) Graph

Computes the connectivity sparse graph from 2D slices of a ROI

Parameters:
Returns:

aGraph (ORSModel.ors.Graph) – resulting graph

classmethod computeSparseGraphFromROI2DAndPublish(aROI: ROI)

Computes the connectivity sparse graph from 2D slices of a ROI and publishes the result as a graph.

Parameters:

aROI (ORSModel.ors.ROI) – the ROI to skeletonize

classmethod computeWatershed(orsObject, datasetForShape=None)

Entry point for computing watershed on a MultiROI or from a list of ROIs

Parameters:

orsObject – MultiROI, or list of ROIs

computeWatershed2D(aMultiROI, roiForShape=None)

Entry point for computing watershed 2D on a MultiROI or from a list of ROIs

Parameters:
  • orsObject – MultiROI

  • roiForShape – ROI

interfacemethod computeWatershedFromMultiROI(aMultiROI: MultiROI, datasetForShape: Channel, timeStep: int) None

Computes the watershed from a MultiROI

Parameters:
  • aMultiROI (ORSModel.ors.MultiROI) – MultiROI to compute the watershed from. The watershed result is put in that same object.

  • datasetForShape (ORSModel.ors.Channel) [const] – Dataset used to compute the edge map

  • timeStep (int) – time index of aMultiROI and of datasetForShape

interfacemethod computeWatershedFromMultiROI2D(aMultiROI: MultiROI, roiForShape: ROI, timeStep: int) None

Computes the 2D watershed from a MultiROI

Deprecated since version 2022.2: use computeWatershedFromMultiROI2DFromGenealogicalName instead

Parameters:
  • aMultiROI (ORSModel.ors.MultiROI) – MultiROI to compute the watershed from. The watershed result is put in that same object.

  • roiForShape (ORSModel.ors.ROI) [const] – ROI used to compute the edge map

  • timeStep (int) – time index of aMultiROI and of datasetForShape

interfacemethod computeWatershedFromMultiROI2DFromGenealogicalName(aMultiROI: MultiROI, roiForShape: ROI, aViewGenealogicalName: str, timeStep: int) None

Computes the watershed from a MultiROI

Parameters:
  • aMultiROI (ORSModel.ors.MultiROI) – MultiROI to compute the watershed from. The watershed result is put in that same object.

  • roiForShape (ORSModel.ors.ROI) [const] – ROI used to compute the edge map

  • aViewGenealogicalName (str) – a layout genealogical name

  • timeStep (int) – time index of aMultiROI and of datasetForShape

interfacemethod computeWatershedFromMultiROI2DFromPlane(aMultiROI: MultiROI, roiForShape: ROI, aPlane: Plane, timeStep: int) None

Computes watershed 2D from a MultiROI using a plane

Parameters:
  • aMultiROI (ORSModel.ors.MultiROI) – MultiROI to compute the watershed from. The watershed result is put in that same object.

  • roiForShape (ORSModel.ors.ROI) [const] – ROI used to compute the edge map

  • aPlane (ORSModel.ors.Plane) – the plane on which the watershed 2D will take place

  • timeStep (int) – time index of aMultiROI and of datasetForShape

interfacemethod computeWatershedFromROIs(listOfROIs: List[ROI], datasetForShape: Channel, timeStep: int) None

Computes the watershed from a list of ROIs

Parameters:
  • listOfROIs (ORSModel.ors.ROI) [count=[2, None]] – list of ROIs to compute the watershed from. The watershed result is put in these same objects.

  • datasetForShape (ORSModel.ors.Channel) [const] – Dataset used to compute the edge map

  • timeStep (int) – time index of the input ROIs and of datasetForShape

interfacemethod create2DDistanceMapFromROIs(ROIs: List[ROI], tIndex: int, signed: bool = False, IProgress: Progress = None) Channel

Computes 2D distance map from a set of ROIs

Parameters:
  • ROIs (ORSModel.ors.ROI) [count=[1, None]] [const] – ROIs to compute the distance map from

  • tIndex (int) – time index of the ROIs to use

  • signed (bool) – is the distance map signed or not

  • IProgress (ORSModel.ors.Progress) – progress object

Returns:

distanceMapDataset (ORSModel.ors.Channel) – dataset of the computed distance map

interfacemethod createDistanceMapFromROIs(ROIs: List[ROI], tIndex: int, IProgress: Progress = None) Channel

Computes a distance map from a set of ROIs

Parameters:
  • ROIs (ORSModel.ors.ROI) [count=[1, None]] [const] – ROIs to compute the distance map from

  • tIndex (int) – time index of the ROIs to use

  • IProgress (ORSModel.ors.Progress) – progress object

Returns:

distanceMapDataset (ORSModel.ors.Channel) – dataset of the computed distance map

classmethod createEmptyROIFromStructuredGrid(structuredGrid, title, ROIColor, createAsMultiROI)

Creates an empty ROI or MultiROI from a StructuredGrid

Deprecated since version 2021.3: Use createROIFromStructuredGrid or createMultiROIFromStructuredGrid instead

Parameters:
  • structuredGrid (ORSModel.ors.StructuredGrid) [const] – reference shape of the new ROI

  • title (str) – title of the new ROI

  • ROIColor (ORSModel.ors.Color) – color of the new ROI

  • createAsMultiROI (bool) – create a MultiROI if True, a ROI if False

Returns:

output (ORSModel.ors.ROI, ORSModel.ors.MultiROI) – created ROI

classmethod createEmptyROIFromVisualBox(aVisualBox, title, currentTime, ROIColor, createAsMultiROI)

Creates an empty ROI or MultiROI from a VisualBox

Deprecated since version 2021.3: Use createROIFromVisualBox or createMultiROIFromVisualBox instead

Parameters:
  • aVisualBox (ORSModel.ors.VisualBox) [const] – reference shape of the new ROI

  • title (str) – title of the new ROI

  • currentTime (int) – currentTime to get the box of the visual box

  • ROIColor (ORSModel.ors.Color) – color of the new ROI

  • createAsMultiROI (bool) – create a MultiROI if True, a ROI if False

Returns:

output (ORSModel.ors.ROI, ORSModel.ors.MultiROI) – created ROI or MultiROI

interfacemethod createLabeledROIFromLabeledROI(aMultiROI: MultiROI, IProgress: Progress = None, includeDiagonal: bool = False, perSlice: bool = False) MultiROI

Computes the labelization of a labeled ROI by extracting each label, labelizing them and concatenating the results.

Parameters:
  • aMultiROI (ORSModel.ors.MultiROI) [const] – MultiROI to compute the labelization on

  • IProgress (ORSModel.ors.Progress) – progress object

  • includeDiagonal (bool) – include diagonal 26 neighbor (or 8 in 2D or when saelecting per slice)

  • perSlice (bool) – do a 2D connected component

Returns:

labelizationMultiROI (ORSModel.ors.MultiROI) – MultiROI of the labelized ROI

interfacemethod createLabeledROIFromROI(aROI: ROI, IProgress: Progress = None, includeDiagonal: bool = False, perSlice: bool = False) MultiROI

Computes the labelization of a ROI

Parameters:
  • aROI (ORSModel.ors.ROI) [const] – ROI to compute the labelization on

  • IProgress (ORSModel.ors.Progress) – progress object

  • includeDiagonal (bool) – include diagonal 26 neighbor

  • perSlice (bool) – do a 2D connected component

Returns:

labelizationMultiROI (ORSModel.ors.MultiROI) – MultiROI of the labelized ROI

interfacemethod createLabeledROIFromROIWithDiagonal(aROI: ROI, IProgress: Progress = None) MultiROI

Computes the labelization of a ROI 26 neighbor

Parameters:
Returns:

labelizationMultiROI (ORSModel.ors.MultiROI) – MultiROI of the labelized ROI

interfacemethod createMultiROIFromStructuredGrid(aStructuredGrid: StructuredGrid, title: str, classCount: int) MultiROI

Creates an empty MultiROI from a StructuredGrid

Parameters:
  • aStructuredGrid (ORSModel.ors.StructuredGrid) [const] – reference shape of the new MultiROI

  • title (str) – title of the new MultiROI

  • classCount (int) – class count

Anonymize title:

True

Returns:

output (ORSModel.ors.MultiROI) – created MultiROI

interfacemethod createMultiROIFromVisualBox(aVisualBox: VisualBox, title: str, currentTime: int, classCount: int) MultiROI

Creates an empty MultiROI from a VisualBox

Parameters:
  • aVisualBox (ORSModel.ors.VisualBox) [const] – reference shape of the new MultiROI

  • title (str) – title of the new MultiROI

  • currentTime (int) – currentTime to get the box of the visual box

  • classCount (int) – class count

Anonymize title:

True

Returns:

output (ORSModel.ors.MultiROI) – created MultiROI

interfacemethod createROIFromLabeledROI(aMultiROI: MultiROI, IProgress: Progress = None) ROI

Creates a new ROI by taking all the voxels from all the labels of the MultiROI

Parameters:
Returns:

aROI (ORSModel.ors.ROI) – a ROI

interfacemethod createROIFromStructuredGrid(aStructuredGrid: StructuredGrid, title: str, ROIColor: Color) ROI

Creates an empty ROI from a StructuredGrid

Parameters:
Anonymize title:

True

Returns:

output (ORSModel.ors.ROI) – created ROI

interfacemethod createROIFromVisualBox(aVisualBox: VisualBox, title: str, currentTime: int, ROIColor: Color) ROI

Creates an empty ROI from a VisualBox

Parameters:
  • aVisualBox (ORSModel.ors.VisualBox) [const] – reference shape of the new ROI

  • title (str) – title of the new ROI

  • currentTime (int) – currentTime to get the box of the visual box

  • ROIColor (ORSModel.ors.Color) – color of the new ROI

Anonymize title:

True

Returns:

output (ORSModel.ors.ROI) – created ROI

interfacemethod createROIInRange(dataset: Channel, title: str, rangeMin: float, rangeMax: float, timeStep: int = 0) ROI

Creates a ROI from a dataset and a range of intensities.

Parameters:
  • dataset (ORSModel.ors.Channel) [const] – dataset of reference

  • title (str) – title of the new ROI

  • rangeMin (float) – minimal value of the dataset intensity to include in the ROI

  • rangeMax (float) – maximal value of the dataset intensity to include in the ROI

  • timeStep (int) – timeIndex, or -1 for all time

Anonymize title:

True

Returns:

output (ORSModel.ors.ROI) – created ROI

interfacemethod createSignedDistanceMapFromROIs(ROIs: List[ROI], tIndex: int, IProgress: Progress = None) Channel

Computes a signed distance map from a set of ROIs

Parameters:
  • ROIs (ORSModel.ors.ROI) [count=[1, None]] [const] – ROIs to compute the distance map from

  • tIndex (int) – time index of the ROIs to use

  • IProgress (ORSModel.ors.Progress) – progress object

Returns:

distanceMapDataset (ORSModel.ors.Channel) – dataset of the computed distance map

interfacemethod createVolumeThicknessFromROI(aROI: ROI, currentTime: int, IProgress: Progress = None) Channel

Computes the volume thickness of a ROI

Parameters:
Returns:

volumeThicknessChannel (ORSModel.ors.Channel) – Volume thickness

interfacemethod cutFromData(listROIToAnalyze: List[ROI], dataset: Channel) None

Writes zeros in a dataset at the location of the ROI.

Parameters:
interfacemethod dilate(aROIToModify: Union[ROI, MultiROI] = None, kernelShape: str = 'square', kernelDim: int = 3, kernelSize: int = 3, dataset: Channel = None, rangeMin: float = 0.0, rangeMax: float = 0.0, repetitionCount: int = 1, currentTime: int = 0, axis: int = 2, sliceIndicesExpr: str = '', listROIToModify: List[Union[ROI, MultiROI]] = None, sliceIndices: SequenceableCollection = None) None

Applies a morphological dilation operation on a ROI or a MultiROI.

Changed in version -: Argument listToModify (list) is replaced by aROIToModify (single instance) - Argument sliceIndices (Array) is replaced by sliceIndicesExpr (string expression)

Parameters:
  • aROIToModify (ORSModel.ors.ROI, ORSModel.ors.MultiROI) – ROI or MultiROI to modify

  • kernelShape (str) – Kernel shape (‘square’, ‘circle’ or ‘cross’)

  • kernelDim (int) – Kernel dimension (2 or 3)

  • kernelSize (int) – Kernel size (odd number between 3 and 33)

  • dataset (ORSModel.ors.Channel) [const] – Dataset for range comparison (if application should be restricted to a range)

  • rangeMin (float) – minimal value of the range

  • rangeMax (float) – maximal value of the range

  • repetitionCount (int) – Count of repetition to be applied

  • currentTime (int) – Time step of the ROI

  • axis (int) – axis of operation if 2D kernel 0=X, 1=Y, 2=Z of the StructuredGrid

  • sliceIndicesExpr (str) – slices to work on in the given axis (string expression, 1-based, e.g. ‘1,2,3-5,4-20/3’)

  • listROIToModify (ORSModel.ors.ROI, ORSModel.ors.MultiROI) [count=[1, None]] [deprecated: use aROIToModify instead] – ROI or MultiROI to modify

  • sliceIndices (ORSModel.ors.SequenceableCollection) [deprecated: use sliceIndicesExpr instead] – collection of slices to work on in the given axis

interfacemethod erode(aROIToModify: Union[ROI, MultiROI] = None, kernelShape: str = 'square', kernelDim: int = 3, kernelSize: int = 3, dataset: Channel = None, rangeMin: float = 0.0, rangeMax: float = 0.0, repetitionCount: int = 1, currentTime: int = 0, axis: int = 2, sliceIndicesExpr: str = '', listROIToModify: List[Union[ROI, MultiROI]] = None, sliceIndices: SequenceableCollection = None) None

Applies a morphological erosion operation on a ROI or a MultiROI.

Changed in version -: Argument listToModify (list) is replaced by aROIToModify (single instance) - Argument sliceIndices (Array) is replaced by sliceIndicesExpr (string expression)

Parameters:
  • aROIToModify (ORSModel.ors.ROI, ORSModel.ors.MultiROI) – ROI or MultiROI to modify

  • kernelShape (str) – Kernel shape (‘square’, ‘circle’ or ‘cross’)

  • kernelDim (int) – Kernel dimension (2 or 3)

  • kernelSize (int) – Kernel size (odd number between 3 and 33)

  • dataset (ORSModel.ors.Channel) [const] – Dataset for range comparison (if application should be restricted to a range)

  • rangeMin (float) – minimal value of the range

  • rangeMax (float) – maximal value of the range

  • repetitionCount (int) – Count of repetition to be applied

  • currentTime (int) – Time step of the ROI

  • axis (int) – axis of operation if 2D kernel 0=X, 1=Y, 2=Z of the StructuredGrid

  • sliceIndicesExpr (str) – slices to work on in the given axis (string expression, 1-based, e.g. ‘1,2,3-5,4-20/3’)

  • listROIToModify (ORSModel.ors.ROI, ORSModel.ors.MultiROI) [count=[1, None]] [deprecated: use aROIToModify instead] – ROI or MultiROI to modify

  • sliceIndices (ORSModel.ors.SequenceableCollection) [deprecated: use sliceIndicesExpr instead] – collection of slices to work on in the given axis

interfacemethod exportROIAsALaplacianSmoothedAndSampledThicknessMesh(aROI: ROI, samplingX: int = 1, samplingY: int = 1, samplingZ: int = 1, currentTime: int = 0, nbOfIterations: int = 1) Tuple[Mesh, bool]

Generates a smoothed thickness mesh from a ROI

The smoothing algorithm is a Laplacian.

No mesh is generated if the input ROI is empty.

Parameters:
  • aROI (ORSModel.ors.ROI) [const] – the ROI to get a thickness mesh representation from

  • samplingX (int) – sampling in X

  • samplingY (int) – sampling in Y

  • samplingZ (int) – sampling in Z

  • currentTime (int) – time index in the ROI

  • nbOfIterations (int) – smoothing iterations count

Returns:
  • mesh (ORSModel.ors.Mesh) – the generated thickness mesh

  • isThicknessMeshComputationCancelled (bool) – flag to know if the computation has been cancelled by the user

interfacemethod exportROIAsAWindowedSmoothedAndSampledThicknessMesh(aROI: ROI, samplingX: int = 1, samplingY: int = 1, samplingZ: int = 1, currentTime: int = 0, nbOfIterations: int = 2, isBoundarySmoothedOn: bool = False, isFeatureEdgeOn: bool = False, featureAngle: float = 0.5, passBandFactor: float = 0.001) Tuple[Mesh, bool, int]

Generates a smoothed thickness mesh from a ROI

The smoothing algorithm is vtkWindowedSynFilter

No mesh is generated if the input ROI is empty.

Parameters:
  • aROI (ORSModel.ors.ROI) [const] – the ROI to get a thickness mesh representation from

  • samplingX (int) – sampling in X

  • samplingY (int) – sampling in Y

  • samplingZ (int) – sampling in Z

  • currentTime (int) – time index in the ROI

  • nbOfIterations (int) – smoothing iterations count

  • isBoundarySmoothedOn (bool) – if True, smoothing of vertices on the boundary of the mesh is performed

  • isFeatureEdgeOn (bool) – if True, smoothing along sharp interior edges is performed

  • featureAngle (float) – feature angle for sharp edge identification (in degree)

  • passBandFactor (float) – pass band value for the windowed filter

Returns:
  • mesh (ORSModel.ors.Mesh) – the generated thickness mesh

  • isThicknessMeshComputationCancelled (bool) – flag to know if the computation has been cancelled by the user

  • errorCode (int) – an error code

interfacemethod exportROIAsCubicMesh(aROI: Union[ROI, MultiROI], currentTime: int) Tuple[Mesh, bool]

Generates a cubic mesh from a ROI or a MultiROI

No mesh is generated if the input ROI or MultiROI is empty.

Parameters:
Returns:
  • mesh (ORSModel.ors.Mesh) – the generated cubic mesh

  • isCubicMeshComputationCancelled (bool) – flag to know if the computation has been cancelled by the user

interfacemethod exportROIAsSampledMesh(aROI: Union[ROI, MultiROI], samplingX: int, samplingY: int, samplingZ: int, currentTime: int = 0) Tuple[Mesh, bool]

Generates a sampled mesh from a ROI or a MultiROI

No mesh is generated if the input ROI or MultiROI is empty.

Parameters:
  • aROI (ORSModel.ors.ROI, ORSModel.ors.MultiROI) [const] – the ROI or MultiROI to get a sampled mesh representation from

  • samplingX (int) – sampling in X

  • samplingY (int) – sampling in Y

  • samplingZ (int) – sampling in Z

  • currentTime (int) – time index in the ROI

Returns:
  • mesh (ORSModel.ors.Mesh) – the generated sampled mesh

  • isSampledMeshComputationCancelled (bool) – flag to know if the computation has been cancelled by the user

interfacemethod exportROIAsThicknessMesh(aROI: ROI, currentTime: int = 0) Tuple[Mesh, bool]

Generates a thickness mesh from a ROI

No mesh is generated if the input ROI is empty.

Parameters:
  • aROI (ORSModel.ors.ROI) [const] – the ROI to get a thickness mesh representation from

  • currentTime (int) – time index in the ROI

Returns:
  • mesh (ORSModel.ors.Mesh) – the generated thickness mesh

  • isThicknessMeshComputationCancelled (bool) – flag to know if the computation has been cancelled by the user

interfacemethod exportROIAsThicknessMeshSample(aROI: ROI, xSampling: int, ySampling: int, zSampling: int, currentTime: int, smoothingIterationsCount: int = 0) Tuple[Mesh, bool]

Generates a thickness mesh from a ROI

No mesh is generated if the input ROI is empty.

Parameters:
  • aROI (ORSModel.ors.ROI) [const] – the ROI to get a thickness mesh representation from

  • xSampling (int) – sampling in X

  • ySampling (int) – sampling in Y

  • zSampling (int) – sampling in Z

  • currentTime (int) – time index in the ROI

  • smoothingIterationsCount (int) – smoothing iterations count

Returns:
  • mesh (ORSModel.ors.Mesh) – the generated thickness mesh

  • isThicknessMeshComputationCancelled (bool) – flag to know if the computation has been cancelled by the user

classmethod extractSliceAsMultiROI(multiROI, sliceIndex, timestep, IProgress=None)

Extract a single slice from a MultiROI as a new MultiROI.

interfacemethod fillInnerAreas(aROIToModify: Union[ROI, MultiROI] = None, fillInnerAreasMode: str = '3D', currentTime: int = 0, listToModify: List[Union[ROI, MultiROI]] = None) None

Applies a filling of inner areas on a ROI or a MultiROI.

Changed in version -: Argument listToModify (list) is replaced by aROIToModify (single instance) - Progress should be managed externally

Parameters:
  • aROIToModify (ORSModel.ors.ROI, ORSModel.ors.MultiROI) – ROI or MultiROI to modify

  • fillInnerAreasMode (str) – Filling mode (‘3D’, ‘2D (YZ)’, ‘2D (XZ)’ or ‘2D (XY)’)

  • currentTime (int) – Time step of the operation

  • listToModify (ORSModel.ors.ROI, ORSModel.ors.MultiROI) [count=[1, None]] [deprecated: use aROIToModify instead] – ROI or MultiROI to modify

classmethod get2DWindowLevel2Opacity(channel)

Gets the opacity of the range.

Parameters:

channel (ORSModel.ors.Channel) – associated channel to the visual

Returns:

rangeOpacity (float) – range opacity

interfacemethod getGridMultiROIFromROI(aROI: ROI, binX: int = 4, binY: int = 4, binZ: int = 4, IProgress: Progress = None) MultiROI

Construct a MultiROi from a ROI where each label is the content of the ROI intersecting a cell of a uniform grid

Parameters:
  • aROI (ORSModel.ors.ROI) – the roi to grid

  • binX (int) – an int x cell size

  • binY (int) – an int y cell size

  • binZ (int) – an int z cell size

  • IProgress (ORSModel.ors.Progress) – progress object

Returns:

newMultiROI (ORSModel.ors.MultiROI) – the gridded ROI as a MultiROI

interfacemethod getGridMultiROIFromStructuredGrtid(aStructuredGrid: StructuredGrid, binX: int = 4, binY: int = 4, binZ: int = 4, IProgress: Progress = None) MultiROI

Construct a MultiROi from a aStructuredGrid with an uniform grid

Parameters:
Returns:

newMultiROI (ORSModel.ors.MultiROI) – the gridded ROI as a MultiROI

classmethod getMainFormClass()

Gets the class of the main form

Returns:

output

getMinMaxCurrentChannel()

Gets the minimal and maximal value of the current range channel.

Returns:
  • minValue (float) – minimal value of the current range channel

  • maxValue (float) – maximal value of the current range channel

interfacemethod getOtsuThreshold(dataset: Channel, currentTime: int, mask: ROI, useRange: bool = False, lowerRange: float = 0, upperRange: float = 0) float

Get the otsu threshold of a dataset

Changed in version -: Argument useRange has been added - Argument lowerRange has been added - Argument upperRange has been added

Parameters:
  • dataset (ORSModel.ors.Channel) [const] – a dataset

  • currentTime (int) – timestep

  • mask (ORSModel.ors.ROI) [const] – a mask

  • useRange (bool) – if the range should be used

  • lowerRange (float) – lower range

  • upperRange (float) – upper range

Returns:

otsuThreshold (float) – the threshold value

interfacemethod getOtsuThresholdGivenRange(dataset: Channel, currentTime: int, mask: ROI, lowerRange: float, upperRange: float) None

Gets the range of the second leveling of a visual associated to a dataset to lower Otsu value.

Parameters:
  • dataset (ORSModel.ors.Channel) – associated dataset

  • currentTime (int) – current time

  • mask (ORSModel.ors.ROI) – a mask

  • lowerRange (float) – lower range

  • upperRange (float) – upper range

interfacemethod getRange(channel: Channel) Tuple[float, float]

Gets the range of a visual associated to a channel.

The returned values have no physical units.

Deprecated since version 4.5: Use getRangeInLayoutOfView.

Parameters:

channel (ORSModel.ors.Channel) – associated channel to the visual

Returns:
  • rangeMin (float) – minimal value of the range

  • rangeMax (float) – maximal value of the range

interfacemethod getRangeInLayoutOfView(channel: Channel, viewName: str) Tuple[float, float]

Gets the range of a visual associated to a channel.

The returned values have no physical units.

Parameters:
  • channel (ORSModel.ors.Channel) [const] – associated channel to the visual

  • viewName (str) – a genealogical name

Returns:
  • rangeMin (float) – minimal value of the range

  • rangeMax (float) – maximal value of the range

getRangeInPhysicalUnitsOfCurrentVisual()

Gets the range (window level 2) of a visual in physical units and the slope and offset of the associated channel.

Returns:
  • rangeMinInPhysicalUnits (float) – minimal value of the range in physical units

  • rangeMaxInPhysicalUnits (float) – maximal value of the range in physical units

  • slope (float) – slope value in the channel

  • offset (float) – offset value in the channel

getRangeNoPhysicalUnitsOfCurrentVisual()

Gets the range (window level 2) of a visual without the physical units.

Returns:
  • rangeMinNoPhysicalUnits (float) – minimal value of the range without physical units

  • rangeMaxNoPhysicalUnits (float) – maximal value of the range without physical units

getState()

This method is called when saving a plugin instance in a session to obtain the information required to set up the plugin at the loading of the session.

The plugin needs to be savable (see ORSServiceClass.OrsPlugin.abstractPlugin.AbstractPlugin.savable).

Return:

a string of information that will be sent back to the setState method

Rtype:

str

Note

The usage of the character " is not permitted, unless escaped.

interfacemethod interpolateROI(listROIToInterpolate: List[ROI], axis: int = 0, rbf: bool = False, timeStep: int = 0) None

Adds each voxel where the intensity in the dataset is included in the given range.

Parameters:
  • listROIToInterpolate (ORSModel.ors.ROI) [count=[1, None]] – ROI to modify

  • axis (int) – axis of interpolation

  • rbf (bool) – use rbf interpolation

  • timeStep (int) – timeIndex

interfacemethod invertWL2InView(channel: Channel, rangeMin: float, rangeMax: float, viewName: str) None

Invert the values of the selected range.

Parameters:
  • channel (ORSModel.ors.Channel) – associated channel to the visual

  • rangeMin (float) – minimum range of channel

  • rangeMax (float) – maximum range of channel

  • viewName (str) – a genealogical name

isCurrentChannelInFloatingRepresentation()

Get the floating representation status of the current range channel.

Returns:

isFloatingRepresentation (bool) – True if the channel has a float or double data type.

interfacemethod open(aROIToModify: Union[ROI, MultiROI] = None, kernelShape: str = 'square', kernelDim: int = 3, kernelSize: int = 3, dataset: Channel = None, rangeMin: float = 0.0, rangeMax: float = 0.0, repetitionCount: int = 1, currentTime: int = 0, axis: int = 2, sliceIndicesExpr: str = '', listROIToModify: List[Union[ROI, MultiROI]] = None, sliceIndices: SequenceableCollection = None) None

Applies a morphological opening operation on a ROI or a MultiROI.

Changed in version -: Argument listToModify (list) is replaced by aROIToModify (single instance) - Argument sliceIndices (Array) is replaced by sliceIndicesExpr (string expression)

Parameters:
  • aROIToModify (ORSModel.ors.ROI, ORSModel.ors.MultiROI) – ROI or MultiROI to modify

  • kernelShape (str) – Kernel shape (‘square’, ‘circle’ or ‘cross’)

  • kernelDim (int) – Kernel dimension (2 or 3)

  • kernelSize (int) – Kernel size (odd number between 3 and 33)

  • dataset (ORSModel.ors.Channel) [const] – Dataset for range comparison (if application should be restricted to a range)

  • rangeMin (float) – minimal value of the range

  • rangeMax (float) – maximal value of the range

  • repetitionCount (int) – Count of repetition to be applied

  • currentTime (int) – Time step of the ROI

  • axis (int) – axis of operation if 2D kernel 0=X, 1=Y, 2=Z of the StructuredGrid

  • sliceIndicesExpr (str) – slices to work on in the given axis (string expression, 1-based, e.g. ‘1,2,3-5,4-20/3’)

  • listROIToModify (ORSModel.ors.ROI, ORSModel.ors.MultiROI) [count=[1, None]] [deprecated: use aROIToModify instead] – ROI or MultiROI to modify

  • sliceIndices (ORSModel.ors.SequenceableCollection) [deprecated: use sliceIndicesExpr instead] – collection of slices to work on in the given axis

interfacemethod overwriteData(listROIToAnalyze: List[Union[ROI, MultiROI]], dataset: Channel, overwriteValue: float) None

Writes a given value in a dataset at the location of the ROI.

Parameters:
interfacemethod removeRange(listROIToModify: List[Union[ROI, MultiROI]], dataset: Channel, rangeMin: float, rangeMax: float, timeStep: int = 0) None

Removes each voxel where the intensity in the dataset is included in the given range.

Parameters:
  • listROIToModify (ORSModel.ors.ROI, ORSModel.ors.MultiROI) [count=[1, None]] – ROI or MultiROI to modify

  • dataset (ORSModel.ors.Channel) [const] – Dataset for range comparison

  • rangeMin (float) – minimal value of the range

  • rangeMax (float) – maximal value of the range

  • timeStep (int) – timeIndex, or -1 for all time

interfacemethod removeRangeInterpolated(listROIToModify: List[ROI], dataset: Channel, rangeMin: float, rangeMax: float, cubicInterpolation: bool, timeStep: int = 0) None

Removes each voxel where the intensity in the dataset is included in the given range.

Parameters:
  • listROIToModify (ORSModel.ors.ROI) [count=[1, None]] – ROI to modify

  • dataset (ORSModel.ors.Channel) [const] – Dataset for range comparison

  • rangeMin (float) – minimal value of the range

  • rangeMax (float) – maximal value of the range

  • cubicInterpolation (bool) – use cubic interpolation

  • timeStep (int) – timeIndex, or -1 for all time

interfacemethod reverse(aROIToModify: ROI = None, currentTime: int = 0, listROIToModify: List[ROI] = None) None

Reverse the inclusion state of each voxel.

Changed in version -: Argument listROIToModify (list) is replaced by aROIToModify (single instance)

Parameters:
  • aROIToModify (ORSModel.ors.ROI) – ROI to modify

  • currentTime (int) – Time step of the ROI, or -1 for all time

  • listROIToModify (ORSModel.ors.ROI) [count=[1, None]] [deprecated: use aROIToModify instead] – ROI to modify

interfacemethod set2DWindowLevel2OpacityInView(channel: Channel, rangeOpacity: float, viewName: str) None

Set the opacity of the range.

Parameters:
  • channel (ORSModel.ors.Channel) – associated channel to the visual

  • rangeOpacity (float) – range opacity

  • viewName (str) – a genealogical name

interfacemethod setRangeAsLowerOtsu(dataset: Channel, viewName: str, iTIndex: int, useRange: bool = False, lowerRange: float = 0, upperRange: float = 0) None

Sets the range of the second leveling of a visual associated to a dataset to lower Otsu value.

Changed in version -: Argument useRange has been added - Argument lowerRange has been added - Argument upperRange has been added

Parameters:
  • dataset (ORSModel.ors.Channel) – associated dataset

  • viewName (str) – a genealogical name

  • iTIndex (int) – current time step

  • useRange (bool) – flag to use the range

  • lowerRange (float) – lower range

  • upperRange (float) – upper range

interfacemethod setRangeAsUpperOtsu(dataset: Channel, viewName: str, iTIndex: int, useRange: bool = False, lowerRange: float = 0, upperRange: float = 0) None

Sets the range of the second leveling of a visual associated to a dataset to upper Otsu.

Changed in version -: Argument useRange has been added - Argument lowerRange has been added - Argument upperRange has been added

Parameters:
  • dataset (ORSModel.ors.Channel) – associated dataset

  • viewName (str) – a genealogical name

  • iTIndex (int) – current time step

  • useRange (bool) – flag to use the range

  • lowerRange (float) – lower range

  • upperRange (float) – upper range

setState(state)

This method is called to set up the plugin when loading a session.

Note

This method is called only if the string returned by ORSServiceClass.OrsPlugin.orsPlugin.OrsPlugin.getState() at the saving of the session was not empty.

Parameters:

state (str) – string of information as provided by the getState during the saving of the session

interfacemethod skeletonize(listROIToModify: List[ROI]) None

Applies a skeletonize operation.

Deprecated since version 4.0: Use skeletonizeROI.

Parameters:

listROIToModify (ORSModel.ors.ROI) [count=[1, None]] – ROI to modify

interfacemethod skeletonizeMultiROIAsGraph(aMultiROI: MultiROI, IProgress: Progress = None) Graph

Applies a skeletonize operation and output the result as a graph.

Parameters:
Returns:

skeletonGraph (ORSModel.ors.Graph) – the skeletonization of the ROI as a Graph

interfacemethod skeletonizeROI(aROI: ROI, IProgress: Progress = None) ROI

Applies a skeletonize operation.

Parameters:
Returns:

skeletonROI (ORSModel.ors.ROI) – the skeletonization of the ROI

classmethod skeletonizeROI2D(aROI: ROI, IProgress: ORSModel.ors.Progress | None = None) ROI

Applies a 2D skeletonize operation on each slice of the ROI.

Parameters:
Returns:

skeletonROI (ORSModel.ors.ROI) – the 2D skeletonization of the ROI

interfacemethod skeletonizeROI2DAndPublish(aROI: ROI)

Applies a 2D skeletonize operation on each slice of the ROI and publishes the result.

Parameters:

aROI (ORSModel.ors.ROI) – the ROI to skeletonize

classmethod skeletonizeROI2DAsGraph(aROI: ROI, IProgress: Progress = None, tStep: int = 0) Graph

Applies a skeletonize operation to 2D slices and output the result as a 2D graph.

Parameters:
Returns:

skeletonGraph (ORSModel.ors.Graph) – the skeletonization of the 2D slices of the ROI as a Graph

classmethod skeletonizeROI2DAsGraphAndPublish(aROI: ROI)

Applies a skeletonize operation to 2D slices and publishes the result as a graph.

Parameters:

aROI (ORSModel.ors.ROI) – the ROI to skeletonize

interfacemethod skeletonizeROIAsGraph(aROI: ROI, IProgress: Progress = None) Graph

Applies a skeletonize operation and output the result as a graph.

Parameters:
Returns:

skeletonGraph (ORSModel.ors.Graph) – the skeletonization of the ROI as a Graph

interfacemethod skeletonizeROIAsVoxelBasedGraph(aROI: ROI, IProgress: Progress = None) Graph

Applies a skeletonize operation and output the result as a graph.

Parameters:
Returns:

skeletonGraph (ORSModel.ors.Graph) – the skeletonization of the ROI as a Graph

interfacemethod smooth(ROIToModify: Union[ROI, MultiROI], kernelShape: str, kernelDim: int, kernelSize: int, allowNewVoxels: bool = True, dataset: Channel = None, rangeMin: float = 0.0, rangeMax: float = 0.0, currentTime: int = 0, IProgress: Progress = None, axis: int = 2) None

Applies a smoothing operation on a ROI or a MultiROI.

Parameters:
  • ROIToModify (ORSModel.ors.ROI, ORSModel.ors.MultiROI) – ROI or MultiROI to smooth

  • kernelShape (str) – kernel shape (‘square’, ‘circle’ or ‘cross’)

  • kernelDim (int) – kernel dimension (2 or 3)

  • kernelSize (int) – kernel size (odd number between 3 and 33)

  • allowNewVoxels (bool) – if True, new voxels may be added by the smoothing operation; otherwise, the smoothing operation will only remove voxels.

  • dataset (ORSModel.ors.Channel) [const] – dataset for range comparison (if application should be restricted to a range)

  • rangeMin (float) – minimal value of the range

  • rangeMax (float) – maximal value of the range

  • currentTime (int) – time step of the ROI

  • IProgress (ORSModel.ors.Progress) – progress object

  • axis (int) – axis of operation if 2D kernel 0=X, 1=Y, 2=Z of the StructuredGrid

interfacemethod splitAtOtsu(ROIToAnalyze: ROI, dataset: Channel, useRange: bool = False, lowerRange: float = 0, upperRange: float = 0, currentTime: int = 0, IProgress: Progress = None) Tuple[ROI, ROI, bool]

Creates the ROIs of the background and foreground obtained by the Otsu’s method. The values taken in the histogram are those where in the dataset at the location in the ROI.

Changed in version -: Argument useRange has been added - Argument lowerRange has been added - Argument upperRange has been added

Parameters:
  • ROIToAnalyze (ORSModel.ors.ROI) [const] – ROI over which the dataset will be analyzed

  • dataset (ORSModel.ors.Channel) [const] – Dataset to analyze

  • useRange (bool) – flag to know if we do the Otsu on the range

  • lowerRange (float) – Lower threshold range

  • upperRange (float) – Upper threshold range

  • currentTime (int) – Time step of the ROI and of the dataset

  • IProgress (ORSModel.ors.Progress) – progress object

Returns:
  • ROIBackground (ORSModel.ors.ROI) – the locations of the ROI to analyze where the dataset has the values lower than the Otsu threshold

  • ROIForeground (ORSModel.ors.ROI) – the locations of the ROI to analyze where the dataset has the values higher than the Otsu threshold

  • isComputationCancelled (bool) – flag to know if the computation has been cancelled by the user

interfacemethod undo(listROIToModify: List[Union[ROI, MultiROI]]) None

Undo the last operation made on a ROI or MultiROI.

Deprecated since version 2022.2: Use undoSingleROI instead

Parameters:

listROIToModify (ORSModel.ors.ROI, ORSModel.ors.MultiROI) [count=[1, None]] – ROI to modify

interfacemethod undoSingleROI(aROIorMROI: Union[ROI, MultiROI]) None

Undo the last operation made on a ROI or MultiROI.

Parameters:

aROIorMROI (ORSModel.ors.ROI, ORSModel.ors.MultiROI) – ROI to modify

updateHistogramDataOfCurrentChannel()

Updates or creates an histogram data model object for the current range channel.

Return: