OrsHelpers

abstractLogger

class OrsHelpers.abstractLogger.AbstractLogger

Bases: object

Helper to be used when a layout or a view should be obtained from a genealogical name.

classmethod getBestLayoutForName(aName)
classmethod getBestViewForName(aName)

abstractSelectedObjectHelper

class OrsHelpers.abstractSelectedObjectHelper.AbstractSelectedObjectHelper

Bases: object

Helper related to the objects in the selection.

callSublassManagingContextIfMethodDefined()
classmethod getAbstractDatasetPresentersVisibleInDisplay(*args)
static getAllSubclasses(aClass, outputCollection=None)
classmethod getBestBoxFromSelection(*args)
classmethod getBoxContainingAllSelectedVisualsVisibleInView(*args)
classmethod getBoxForCine(*args)
classmethod getBoxOfVisualRoiInView(aPluginForContext, visualROI, view)
classmethod getFallBackBox(aPluginForContext, view)
classmethod getFallBackVisual(aPluginForContext, view)
classmethod getFirstVisualMesh(*args)
classmethod getFirstVisualOfClass(*args)
classmethod getFirstVisualROI(*args)
classmethod getMaxTimeStepForCine(*args)
classmethod getSelectedVisualVisibleInDisplay(*args)
classmethod getSubclassManagingContext(contextName)
classmethod getVisualMeshVisibleInDisplay(*args)
classmethod getVisualOfClassVisibleInDisplay(*args)
classmethod getVisualROIVisibleInDisplay(*args)
classmethod getVolumeForLeveling(*args)
managedContext = []
classmethod managedContextInclude(contextName)

annotationhelper

class OrsHelpers.annotationhelper.AnnotationHelper

Bases: object

Helper related to the annotations.

interfacemethod setColor(anAnnotation, aColor)

Sets the normal color of an annotation

Parameters:
interfacemethod setIsVisibleForViewFromLayoutGenealogicalName(aName, annotation, isVisible)

Set view mode for annotation

Deprecated since version 4.0.

Parameters:
  • aName (str) – a genealogical name
  • annotation (ORSModel.ors.Annotation) – an annotation
  • isVisible (bool) – visibility
classmethod setIsVisibleIn2D(annotation, view, value)
Parameters:
interfacemethod setIsVisibleIn2DFromGenealogicalName(name, annotation, isVisible)

Sets the visibility of an annotation in all 2D views of the given scene layout

Parameters:
  • name (str) – a genealogical name of a scene layout
  • annotation (ORSModel.ors.Annotation) – an annotation
  • isVisible (bool) – True to set as visible, False otherwise

arrayhelper

class OrsHelpers.arrayhelper.ArrayHelper(ors_array)

Bases: object

Helper for manipulating ORS arrays with Numpy.

static ConvertNumpyToOrsArray(np_array, packet_size=64)

Convert numpy.ndarray to Ors array

Parameters:np_array (numpy.ndarray) – The input numpy array to copy
Return:The output OrsArray copy
Rtype:OrsArray
static ConvertOrsToNumpyArray(ors_array)

Convert Ors array to numpy.ndarray

Parameters:ors_array (OrsArray) – The input OrsArray to copy
Return:The numpy array copy
Rtype:numpy.ndarray
at(index)
atPut(index, value)
copyFromNumpyArray(np_array)

Copy a numpy.ndarray into this Ors Array

Parameters:np_array (numpy.ndarray) – The numpy array to copy
getNumpyArrayCopy()

Get a numpy.ndarray copy of this Ors Array

Return:A numpy array copy of the underlying OrsArray
Rtype:numpy.ndarray
getSize()
setAll(value)
setSize(new_size)

datasetcompare

class OrsHelpers.datasetcompare.DatasetCompareHelper

Bases: object

Helper to perform comparison on datasets.

This is essentially for testing purposes.

classmethod compare(dataset1, dataset2)

Compares datasets. :param dataset1: First dataset. :param dataset2: Second dataset. :return: True if both datasets are equivalent; False otherwise.

datasethelper

class OrsHelpers.datasethelper.DatasetHelper

Bases: object

Helper related to the class ORSModel.ors.Channel.

interfacemethod copyDataset(aDataset)

Copies a dataset

Parameters:aDataset (ORSModel.ors.Channel) – the dataset to copy
Returns:newDataset (ORSModel.ors.Channel) – the copied dataset
classmethod copyDatasetAndPublish(aDataset)
interfacemethod copyDatasetNotInitialize(aDataset)

Copies a dataset no intialize

Parameters:aDataset (ORSModel.ors.Channel) – the dataset to copy
Returns:newDataset (ORSModel.ors.Channel) – the copied dataset
interfacemethod createDatasetFromMultiROI(aMultiROI, IProgress=None)

Creates a new dataset where the value at each pixel is the label in the MultiROI

Parameters:
Returns:

dataset (ORSModel.ors.Channel) – new dataset

interfacemethod createMultiROIFromDataset(dataset, multiROI, IProgress=None)

Creates a new MultiROI where each pixel is contained in the label matching the dataset value at that location

Parameters:
Returns:

aMultiROI (ORSModel.ors.MultiROI) – new MultiROI

interfacemethod deleteDataset(aDataset)

Deletes a dataset

Parameters:aDataset (ORSModel.ors.Channel) – the dataset to delete
classmethod fitToView(dataset, view)
classmethod getDatasetGroupContainingDataset(dataset)
classmethod getIsDerivedNew(dataset)
classmethod loadPreset(presetName, view, visual)
classmethod loadPresetWithTitle(title, view, visual)
classmethod setDerivedNew(dataset)
classmethod setDerivedSaved(dataset)
classmethod setDerivedState(dataset, state)
interfacemethod setIsVisibleForViewFromLayoutGenealogicalName(aName, dataset, isVisible)

Set view mode for dataset

Deprecated since version 4.0: Use setIsVisibleIn2DFromGenealogicalName.

Parameters:
  • aName (str) – a genealogical name
  • dataset (ORSModel.ors.Channel) – a dataset
  • isVisible (bool) – visibility
classmethod setIsVisibleIn2D(dataset, view, value)
Parameters:
interfacemethod setIsVisibleIn2DFromGenealogicalName(name, dataset, isVisible)

Sets the visibility of a dataset in all 2D views of the given scene layout

Parameters:
  • name (str) – a genealogical name of a scene layout
  • dataset (ORSModel.ors.Channel) – a dataset
  • isVisible (bool) – True to set as visible, False otherwise

datasetPresenterLogger

class OrsHelpers.datasetPresenterLogger.DatasetPresenterLogger

Bases: OrsHelpers.visualLogger.VisualLogger

Helper related to the class ORSModel.ors.DatasetPresenter.

dimensionUnitHelper

class OrsHelpers.dimensionUnitHelper.DimensionUnitHelper

Bases: object

Helper for manipulating dimension units.

classmethod convertValueToString(value, dimensionUnit=None, view=None)

Convert and format a value in a given dimension unit to a view dimension unit.

Parameters:
  • value – ths source value
  • dimensionUnit – the source dimension unit
  • view – the view
Returns:

output – a string representation of the converted value

classmethod getAngleToString(value, view=None)
classmethod getLenghtToString(value, view=None)
classmethod getSurfaceToString(value, view=None)
static getViewUnitOfSameType(view, dimensionUnit)
classmethod getVolumeToString(value, view=None)

discretecolorsequence

class OrsHelpers.discretecolorsequence.DiscreteColorSequence

Bases: object

Iterator on colors.

XPATH = 'sequentialColorValues_%03d'
classmethod getColorIterator()
classmethod get_next_color()
next_color_index = 0

displayDatasetInLayout

class OrsHelpers.displayDatasetInLayout.DisplayDatasetInLayout

Bases: object

Helper for attaching/detaching channels and related objects (visuals, …) to layouts.

classmethod addChannelToLayout(IChannel, inLayout=None, pluginInContext=None)
classmethod createGridUnderTopFrame(topFrame)
classmethod createObjectsForDisplaysOfLayout(layout, topFrame, pluginInContext=None)
classmethod removeChannelFromLayout(IChannel, layout)
classmethod removeChannelFromLayoutOfDisplay(IChannel, display)

displayGraph

class OrsHelpers.displayGraph.DisplayGraph

Bases: object

Helper for attaching/detaching graph and related objects (visuals, …) to layouts.

classmethod addModelToLayout(graph, layout, pluginInContext=None)
classmethod removeModelFromGroupOfDisplay(graph, IDisplay, disableFusion)

displaymesh

class OrsHelpers.displaymesh.DisplayMesh

Bases: object

Helper for attaching/detaching meshes and related objects (visuals, …) to layouts.

classmethod addModelToLayout(IMeshModel, layout, pluginInContext=None)
classmethod removeModelFromGroupOfDisplay(IMeshModel, IDisplay, disableFusion)

displayROI

class OrsHelpers.displayROI.DisplayROI

Bases: object

Helper for attaching/detaching ROIs and MultiROIs and related objects (visuals, …) to layouts.

classmethod addROIToLayout(aROI, layout) → ORSModel.ors.VisualROI
interfacemethod deleteMultiROI(aMultiROI)

Deletes a MultiROI

Parameters:aMultiROI (ORSModel.ors.MultiROI) – the MultiROI to delete
interfacemethod deleteROI(aROI)

Deletes a ROI

Parameters:aROI (ORSModel.ors.ROI) – the ROI to delete

displayVectorField

class OrsHelpers.displayVectorField.DisplayVectorField

Bases: object

Helper for attaching/detaching vector fields and related objects (visuals, …) to layouts.

classmethod addModelToLayout(vectorField, layout, pluginInContext=None)
classmethod removeModelFromGroupOfDisplay(vectorField, IDisplay, disableFusion)

distancemaphelper

class OrsHelpers.distancemaphelper.DistanceMapHelper

Bases: object

Helper for computing distance maps.

classmethod eucledianDistanceMapFromROI(aROI, reverseROI, ROIMask, IProgress=None, showProgress=False, distanceMap=None)
classmethod geodesicDistanceMapFromROI(aROI, seedROI, timestep)

Computes the geodesic distance in the source ROI from the seedROI

Parameters:
Returns:

geodesicChannel (ORSModel.ors.Channel) – the geodesic channel

classmethod geodesicInexactDistanceMapFromROI(aROI, seedROI, timestep)

Computes the geodesic distance in the source ROI from the seedROI

Parameters:
Returns:

geodesicChannel (ORSModel.ors.Channel) – the geodesic channel

classmethod logMemoryErrorAndDeleteWorkingObject(currentObject, listOfObjectGUIDsToDelete)

formatHelper

class OrsHelpers.formatHelper.FormatHelper

Bases: object

Helper for formatting (and centralizing).

classmethod formatNumber(value, min_precision: Union[int, NoneType] = None, padding: Union[int, NoneType] = 0)
classmethod getCountOfDecimalDigits(aString)
classmethod getFloatFromString(aString, default=0.0)
classmethod getIntFromString(aString)
classmethod validateFilename(filename, parent=None)

gpuhelper

class OrsHelpers.gpuhelper.GPUHelper

Bases: object

classmethod getAvailableVideoMemory()
Returns:output – an OrsVector containing the new x,y,z values

graphhelper

class OrsHelpers.graphhelper.GraphHelper

Bases: OrsHelpers.unstructuredGridHelper.UnstructuredGridHelper

Helper related to the class ORSModel.ors.Graph.

interfacemethod copy(aGraph)

Copies a graph

Parameters:aGraph (ORSModel.ors.Graph) – the graph to copy
Returns:newGraph (ORSModel.ors.Graph) – the copied graph
interfacemethod copyGraph(aGraph)

Copies a Graph

Parameters:aGraph (ORSModel.ors.Graph) – the graph to copy
Returns:aNewGraph (ORSModel.ors.Graph) – the copied graph
classmethod copyGraphdAndPublish(aGraph)
classmethod createVisualFromModel(graph, layout=None, aScalarValueTypeTag='')

Creates the mesh object from the model structured object.

Parameters:
Returns:

visual (ORSModel.ors.Visual) – the visual object

classmethod createVisualGraphFromGraph(graph, layout=None)

Creates the graph visual object from the Graph model object.

Parameters:
Returns:

visualgraph (ORSModel.ors.VisualGraph) – the graph visual object

classmethod getDisplayModelClass()
classmethod getIsEnabledIn2D(obj)
classmethod getIsEnabledIn3D(obj)
classmethod getLegendTitle(aGraph, aScalarValueTypeTag='')
classmethod getModelClass()
classmethod getVisualModelClass()
classmethod mapDatasetValuesToAnUnstructuredGrid(sourceGraph: ORSModel.ors.Graph, referenceChannel, referenceChannelTIndex, sourceGraphTIndex, defaulfScalarValue=1.0, scalarValueTypeTag='Vertex Scalar Values')

Maps values from a dataset (reference), as vertex scalar values, to a graph (source)

Parameters:
  • sourceGraph (ORSModel.ors.Graph) – a source graph
  • referenceChannel (ORSModel.ors.Channel) – a reference Channel
  • referenceChannelTIndex (int) – the time step of the reference dataset
  • sourceGraphTIndex (int) – the time step of the source graph
  • defaulfScalarValue (float) – A default value if no match is possible between a vertex and the dataset
  • aScalarValueTypeTag (str) – an Id to know which legend update
Returns:

output (bool) – True if the mapping works, else False

interfacemethod setIsVisibleForViewFromLayoutGenealogicalName(aName, aGraph, isVisible)

Set view mode for graph

Deprecated since version 4.0.

Parameters:
  • aName (str) – a genealogical name
  • aGraph (ORSModel.ors.Graph) – a Graph
  • isVisible (bool) – visibility
interfacemethod setIsVisibleIn2DFromGenealogicalName(name, aGraph, isVisible)

Sets the visibility of a graph in all 2D views of the given scene layout

Parameters:
  • name (str) – a genealogical name of a scene layout
  • aGraph (ORSModel.ors.Graph) – a graph
  • isVisible (bool) – True to set as visible, False otherwise
classmethod updateColorFromEdgeScalarValue(aGraph, forceToRefresh=False, iTIndex=0)
classmethod updateColorFromVertexScalarValue(aGraph, forceToRefresh=False, aScalarValueTypeTag='', iTIndex=0)
classmethod updateLegend(aGraph, display=None, ITopFrame=None, aScalarValueTypeTag='')
classmethod updateModelColor(aGraph)

groupofpathhelper

class OrsHelpers.groupofpathhelper.GroupOfPathHelper

Bases: object

Helper related to the class ORSModel.ors.Group associated to paths.

interfacemethod copy(anObject)

Copies a Group object, associated to paths.

All paths in that group are copied.

Parameters:anObject (ORSModel.ors.Group) – the Group of paths object to copy
Returns:newObject (ORSModel.ors.Group) – the copied Group of paths
classmethod getFirstPath(obj)
classmethod setIsVisibleIn2D(groupOfPaths, view, value)
Parameters:
interfacemethod setIsVisibleIn2DFromGenealogicalName(name, groupOfPaths, isVisible)

Sets the visibility of a group of paths in all 2D views of the given scene layout

Parameters:
  • name (str) – a genealogical name of a scene layout
  • groupOfPaths (ORSModel.ors.Group) – a group of paths
  • isVisible (bool) – True to set as visible, False otherwise

kernelHelper

class OrsHelpers.kernelHelper.KernelHelper

Bases: object

Helper for manipulating kernels.

These kernels are to be used with convolution filters.

applyGaussianShape(kernelMatrix, standardDeviation, normalize=True)
getElementValue()
getKernelDim()
getKernelMatrix()
classmethod getKernelObjectFromNumpyArray(kernelMatrix)
classmethod getKernelObjectGaussianShape(sigma, truncate=2.0)

Gets a ConvolutionKernel object from the specifications of standard deviation in each axe.

Parameters:
  • sigma – list of standard deviation. If a single element is given, a 1D kernel will be created. If 2 elements are given, a 2D kernel will be created. If 3 elements are given, a 3D kernel will be created. The first element in the list is for the “X” axe, the second element is for the “Y” axe, and the third element is for the “Z” axe.
  • truncate – truncate the kernel at this many standard deviations.
Returns:

output – a ConvolutionKernel object

getKernelShape()
getKernelSize()
classmethod normalize(kernelMatrix)
setElementValue(elementValue)
setKernelDim(kernelDim)
setKernelShape(kernelShape)
setKernelSize(kernelSize)

layoutHelper

class OrsHelpers.layoutHelper.LayoutHelper

Bases: object

Helper for manipulating layouts.

classmethod getChildSceneLayoutOfLayout(layout: ORSModel.ors.Layout)
classmethod getIsViewMaximized(display)
classmethod getLayoutOfView(display) → ORSModel.ors.Layout
classmethod getLayoutOfViewFromGUID(displayGUID)
classmethod getSceneLayoutOfLayout(layout)
classmethod getSceneLayoutOfTopFrame(topFrame)
classmethod getSceneLayoutOfView(display) → ORSModel.ors.Layout
classmethod getSceneLayoutOfViewFromGUID(displayGUID)
classmethod getTopLayoutOfContext(pluginInContext, createIfAbsent=True)
classmethod getTopLayoutOfLayout(layout)
classmethod maximizeViewInItsSceneLayout(view, hide3DCursor=True)
classmethod refreshAllViewsInSceneLayoutOfView(display)
classmethod refreshViewTitleFromLayout(layout)
classmethod restoreAfterMaximizeViewInItsSceneLayout(view)
classmethod setTopLayoutOfContext(topLayout, pluginInContext)

layoutpropertieshelper

class OrsHelpers.layoutpropertieshelper.LayoutPropertiesHelper

Bases: object

Helper for setting and getting information of the layouts (LUT to use, current time step, …).

class LayoutProperties(propertyId, showLegend=None, showScaleBar=None, showTextAnnotation=None, isLODEnabled2D=None, isLODEnabled3D=None)

Bases: dict

currentTimeStep
exportToXml()
get2DLUTUUID(aVisual, aScalarValueTypeTag='')
get3DLUTUUID(aVisual, aScalarValueTypeTag='')
getContourThickness(anObject)
getGamma2D(anObject)
getGamma3D(anObject)
getOpacity2D(anObject)
getOpacity3D(anObject)
getRangeSelectionEnabled(anObject)
getSecondLeveling2D(anObject)
getShowContour(anObject)
getUse2DLUTAlpha(anObject)
getWindowLevel2D(anObject)
getWindowLevel3D(anObject)
isLODEnabled2D
isLODEnabled3D
loadFromOrsObject(anObject)
loadFromXml(xml)
saveToOrsObject(anObject)
set2DLUTUUID(aVisual, lutUUID, aScalarValueTypeTag='')
set3DLUTUUID(aVisual, lutUUID, aScalarValueTypeTag='')
setContourThickness(anObject, value)
setGamma2D(anObject, gamma)
setGamma3D(anObject, gamma)
setOpacity2D(anObject, value)
setOpacity3D(anObject, value)
setRangeSelectionEnabled(anObject, value)
setSecondLeveling2D(anObject, min, max)
setShowContour(anObject, value)
setUse2DLUTAlpha(anObject, value)
setWindowLevel2D(anObject, width, center)
setWindowLevel3D(anObject, width, center)
showLegend
showScaleBar
showTextAnnotation
classesToUpdateAllViews = ['CxvLabeledMultiROI']
defaultLutPath = '\\\\?\\C:\\RootReferences\\OrsQtPlateform\\resource\\lut\\grayscale 7b00da82eefc11e68693448a5b87686a.tfi'
classmethod get2DLUTUUID(layout, anObject, aScalarValueTypeTag='')
classmethod get3DLUTUUID(layout, anObject, aScalarValueTypeTag='')
classmethod getContourThickness(layout, anObject)
classmethod getGamma2D(layout, anObject)
classmethod getGamma3D(layout, anObject)
classmethod getLODEnabled2D(layout)
classmethod getLODEnabled3D(layout)
interfacemethod getLUTFromGenealogicalName(layoutFullName, dataset)

Gets the dataset LUT in layout

Parameters:
Returns:

lut (ORSModel.ors.LookupTable) – a LUT

classmethod getLayoutPropertiesId(layout)
classmethod getOpacity2D(layout, anObject)
classmethod getRangeSelectionEnabled(layout, anObject)
classmethod getSecondLeveling2D(layout, anObject)
classmethod getShowContour(layout, anObject)
classmethod getShowLegend(layout)
classmethod getShowScaleBar(layout)
classmethod getShowTextAnnotation(layout)
classmethod getUse2DLUTAlpha(layout, anObject)
classmethod getWindowLevel2D(layout, anObject)
classmethod getWindowLevel3D(layout, anObject)
interfacemethod getWindowLevel3DMinMaxFromGenealogicalName(layoutFullName, dataset)

Gets the dataset 3D window/level range in layout

Parameters:
Returns:
  • rangeMin (float) – minimal value of the range
  • rangeMax (float) – maximal value of the range
classmethod getWindowLevelRange2D(layout, anObject)
classmethod set2DBackgroundColor(layout, color)
interfacemethod set2DBackgroundColorFromGenealogicalName(layoutFullName, color)

Set show text annotation in layout

Parameters:
classmethod set2DLUTUUID(layout, anObject, lutUUID, aScalarValueTypeTag='')
interfacemethod set2DLUTUUIDFromGenealogicalName(layoutFullName, anObject, lutUUID, aScalarValueTypeTag='')

Sets the lut of an object in layout

Parameters:
classmethod set3DLUTUUID(layout, anObject, lutUUID, aScalarValueTypeTag='')
interfacemethod set3DLUTUUIDFromGenealogicalName(layoutFullName, anObject, lutUUID, aScalarValueTypeTag='')

Set the lut of an object in layout

Parameters:
classmethod setContourThickness(layout, anObject, thickness)
interfacemethod setContourThicknessFromGenealogicalName(layoutFullName, anObject, thickness)

Set contour thickness of ROI/MultiROI in layout

Parameters:
classmethod setCurrentTimeStep(layout, time_step)
interfacemethod setCurrentTimeStepFromGenealogicalName(layoutFullName, time_step)

Change time step in layout

Parameters:
  • layoutFullName (str) – a genealogical name
  • time_step (int) – new time step
classmethod setGamma2D(layout, anObject, gamma, logging=False)
interfacemethod setGamma2DFromGenealogicalName(layoutFullName, dataset, gamma)

Sets the dataset 2D gamma value in layout

Parameters:
  • layoutFullName (str) – a genealogical name
  • dataset (ORSModel.ors.Channel) – a dataset
  • gamma (float) – the gamma value
classmethod setGamma3D(layout, anObject, gamma, logging=False)
interfacemethod setGamma3DFromGenealogicalName(layoutFullName, dataset, gamma)

Sets the dataset 3D gamma value in layout

Parameters:
  • layoutFullName (str) – a genealogical name
  • dataset (ORSModel.ors.Channel) – a dataset
  • gamma (float) – the gamma value
classmethod setLODEnabled2D(layout, isLODEnabled2D)
interfacemethod setLODEnabled2DFromGenealogicalName(layoutFullName, isLODEnabled2D)

Set the enabled LOD flag for 2D views in layout

Parameters:
  • layoutFullName (str) – a genealogical name
  • isLODEnabled2D (bool) – a flag
classmethod setLODEnabled3D(layout, isLODEnabled3D)
interfacemethod setLODEnabled3DFromGenealogicalName(layoutFullName, isLODEnabled3D)

Set the enabled LOD flag for the 3D view in layout

Parameters:
  • layoutFullName (str) – a genealogical name
  • isLODEnabled3D (bool) – a flag
classmethod setLayoutPropertiesId(layout, id_)
classmethod setOpacity2D(layout, anObject, value, logging=False)
interfacemethod setOpacity2DFromGenealogicalName(layoutFullName, dataset, value)

Set VisualChannel 2D opacity in layout

Parameters:
  • layoutFullName (str) – a genealogical name
  • dataset (ORSModel.ors.Channel) – a dataset
  • value (float) – a value
classmethod setOpacity3D(layout, anObject, value, logging=False)
interfacemethod setOpacity3DFromGenealogicalName(layoutFullName, dataset, value)

Set VisualChannel 3D opacity in layout

Parameters:
  • layoutFullName (str) – a genealogical name
  • dataset (ORSModel.ors.Channel) – a dataset
  • value (float) – a value
classmethod setRangeSelectionEnabled(layout, visualChannel, value)
interfacemethod setRangeSelectionEnabledFromGenealogicalName(layoutFullName, dataset, value)

Sets the enabled state of the range selection in a layout

Parameters:
  • layoutFullName (str) – a genealogical name
  • dataset (ORSModel.ors.Channel) – a dataset
  • value (bool) – a value
classmethod setSecondLeveling2D(layout, anObject, min, max, logging=False)

Sets the limits of the range selection

Parameters:
  • layout – a scene layout
  • anObject (VisualChannel) –
  • min
  • max
  • logging
interfacemethod setSecondLeveling2DFromGenealogicalName(layoutFullName, dataset, min, max)

Sets the dataset 2D range selection in layout

Parameters:
  • layoutFullName (str) – a genealogical name
  • dataset (ORSModel.ors.Channel) – a dataset
  • min (float) – a min
  • max (float) – a max
classmethod setShowContour(layout, anObject, showContour)
interfacemethod setShowContourFromGenealogicalName(layoutFullName, anObject, showContour)

Set show contour of ROI/MultiROI in layout

Parameters:
classmethod setShowLegend(layout, showLegend, aScalarValueTypeTag='')
interfacemethod setShowLegendFromGenealogicalName(layoutFullName, showLegend, aScalarValueTypeTag='')

Set show legend in layout

Parameters:
  • layoutFullName (str) – a genealogical name
  • showLegend (bool) – a flag
  • aScalarValueTypeTag (str) – an Id to know which legend to update
classmethod setShowScaleBar(layout, showScaleBar)
interfacemethod setShowScaleBarFromGenealogicalName(layoutFullName, showScaleBar)

Set show text annotation in layout

Parameters:
  • layoutFullName (str) – a genealogical name
  • showScaleBar (bool) – a flag
classmethod setShowTextAnnotation(layout, showTextAnnotation)
interfacemethod setShowTextAnnotationFromGenealogicalName(layoutFullName, showTextAnnotation)

Set show text annotation in layout

Parameters:
  • layoutFullName (str) – a genealogical name
  • showTextAnnotation (bool) – a flag
classmethod setUnit(layout, unit_type, unitId)
interfacemethod setUnitFromGenealogicalName(layoutFullName, unit_type, unitId)

Set unit in layout

Parameters:
  • layoutFullName (str) – a genealogical name
  • unit_type (IntEnum CxvUniverse_Dimension_Type) – an unit type
  • unitId (IntEnum CxvUniverse_Dimension) – an unit id
classmethod setUse2DLUTAlpha(layout, visualChannel, value)
interfacemethod setUse2DLUTAlphaFromGenealogicalName(layoutFullName, dataset, value)

Set VisualChannel 3D window/level in layout

Parameters:
  • layoutFullName (str) – a genealogical name
  • dataset (ORSModel.ors.Channel) – a dataset
  • value (bool) – a value
classmethod setWindowLevel2D(layout, anObject, width, center, logging=False)
Parameters:
  • layout – a scene layout
  • anObject (VisualChannel) –
  • width
  • center
  • logging
Returns:

output

interfacemethod setWindowLevel2DFromGenealogicalName(layoutFullName, dataset, width, center)

Sets the dataset 2D window/level in layout

Parameters:
  • layoutFullName (str) – a genealogical name
  • dataset (ORSModel.ors.Channel) – a dataset
  • width (float) – a width
  • center (float) – a center
classmethod setWindowLevel3D(layout, anObject, width, center, logging=False)
interfacemethod setWindowLevel3DFromGenealogicalName(layoutFullName, dataset, width, center)

Sets the dataset 3D window/level in layout

Parameters:
  • layoutFullName (str) – a genealogical name
  • dataset (ORSModel.ors.Channel) – a dataset
  • width (float) – a width
  • center (float) – a center
tmpLutPath = '\\\\?\\C:\\Users\\RD\\AppData\\Local\\ORS\\Dragonfly2020.3\\tempLut.tfi'
classmethod updateLUTAllViews(layout, layoutProperties)
classmethod updateSceneProperties(layout, datasetIsVisible=False)

legendLogic

class OrsHelpers.legendLogic.LegendLogic(implementation)

Bases: object

Helper related to the class ORSModel.ors.VisualLegend.

classmethod createDiscreteLegend(legendTitle, parentObject, layout, lutUUID=None, updateLayoutProperties=False, aScalarValueTypeTag='')
classmethod createDiscreteLegendFromMultiROILabelColors(legendTitle, aMultiROI, lutUUID=None, aScalarValueTypeTag='')
classmethod createLegend(legendTitle, parentObject, layout, lutUUID=None, useColorLUT=False, updateLayoutProperties=True, aScalarValueTypeTag='')
classmethod selectedObjectsChange(implementation)
classmethod updateDiscreteLegendFromMultiROILabelColors(legend, aMultiROI)
classmethod updateDiscreteLegendFromMultiROISpecificLabelColor(legend, aMultiROI, specificLabel)
classmethod updateLegendVisibility(implementation, listOfLegends, setDisplayDirty=True)

ListHelper

class OrsHelpers.ListHelper.ListHelper

Bases: object

Helper for manipulating Python lists and ORS lists.

classmethod asPythonCollection(orslist)
classmethod asPythonCollectionString(orslist)
classmethod convertStringifiedListOfFilenames(string)
classmethod deleteAllObjectInORSList(aListOfObjectToBeDeleted)
classmethod fromPythonCollection(aList, asPythonList=False)
classmethod fromPythonCollectionString(guids)

managedhelper

class OrsHelpers.managedhelper.ManagedHelper

Bases: object

Helper related to the class ORSModel.ors.Managed.

interfacemethod copy(anObject)

Copies a Managed object

Parameters:anObject (ORSModel.ors.Managed) – the Managed object to copy
Returns:newObject (ORSModel.ors.Managed) – the copied Managed
classmethod copyAndPublish(anObject)
classmethod copyAndPublishMany(listOfManaged)
interfacemethod delete(anObject)

Deletes a Managed Object

Parameters:anObject (ORSModel.ors.Managed) – the Managed object to delete
classmethod getDoAFitToView(layout)

Gets to know if a fit to view should be done when setting an instance of Managed as visible.

Parameters:layout – a scene layout
Returns:outputTrue if a fit to view should be performed in the the views of the layout; False otherwise.
classmethod getDoAFitToView3D(layout)

Gets to know if a fit to view should be done when setting an instance of Managed as visible.

Parameters:layout – a scene layout
Returns:outputTrue if a fit to view should be performed in the the views of the layout; False otherwise.
interfacemethod publish(anObject)

Publishes an object.

Parameters:anObject (ORSModel.ors.Managed) – an object
classmethod publishStringifiedList(aString)

Publishes a list of objects, where the list is stringified.

No logging of the publish is made, since this method has been designed to be used for the postinstantiate step (to reload autosaved objects).

classmethod showInCurrentContextIfSceneIsEmpty(anObject, select=True, considerPreferences=True)

Shows the object in the current scene of the current context if it is empty.

Parameters:
  • anObject (ORSModel.ors.Managed) – an object
  • select (bool) – if True (default), the object will also be added to the selection if the scene is empty.
  • considerPreferences (bool) – if True (default), the user preference to display the first dataset if the scene is empty will be considered; if False, this user preference will be ignored.
interfacemethod unpublish(anObject)

Unpublishes an object.

Parameters:anObject (ORSModel.ors.Managed) – an object

meshcompare

class OrsHelpers.meshcompare.MeshCompareHelper

Bases: object

Helper to perform comparison on meshes.

This is essentially for testing purposes.

classmethod compare(mesh1, mesh2, is_test=False)

Compares meshes. :param mesh1: First mesh. :param mesh2: Second mesh. :return: True if both meshes are equivalent; False otherwise.

meshhelper

class OrsHelpers.meshhelper.MeshHelper

Bases: OrsHelpers.unstructuredGridHelper.UnstructuredGridHelper

Helper related to the class ORSModel.ors.Mesh.

interfacemethod computeGuassianCurvatureAsVertexScalarValues(IMeshModel, iTIndex)

Compute Gaussian curvature and put the result as a vertex scalar values

Parameters:
  • IMeshModel (ORSModel.ors.Mesh) – the mesh to analyse curvature
  • iTIndex (int) – the current time step
interfacemethod computeMeanCurvatureAsVertexScalarValues(IMeshModel, iTIndex)

Compute mean curvature and put the result as a vertex scalar values

Parameters:
  • IMeshModel (ORSModel.ors.Mesh) – the mesh to analyse curvature
  • iTIndex (int) – the current time step
interfacemethod copy(aMesh)

Copies a mesh

Parameters:aMesh (ORSModel.ors.Mesh) – the mesh to copy
Returns:newMesh (ORSModel.ors.Mesh) – the copied mesh
interfacemethod copyMesh(aMesh)

Copies a mesh

Parameters:aMesh (ORSModel.ors.Mesh) – the mesh to copy
Returns:newMesh (ORSModel.ors.Mesh) – the copied mesh
classmethod copyMeshAndPublish(aMesh)
classmethod createMeshFromAbstractMesh(IMeshModel, layout=None)

Creates the mesh visual object from the mesh model object.

Parameters:
Returns:

visualMesh (ORSModel.ors.VisualMesh) – the mesh visual object

interfacemethod createMeshFromMultiROI(aMultiROI, IProgress=None)

Creates a new mesh from a MultiROI

Parameters:
Returns:

aMesh (ORSModel.ors.Mesh) – new mesh

classmethod createOrientedContourPathFromAnOrientedPlaneMeshCutter(IMeshModel, IListOfOrientedPlane, ITIndex)
classmethod exportToVtkPolyData(IMeshModel, IPath, ITIndex)
classmethod exportToXMLVtkPolyData(IMeshModel, IPath, ITIndex)
interfacemethod generateInterfacialCubicMeshFromROIs(referenceROI, listOfROIs, iTIndex=0, world=True, aProgress=None)

Generates a cubic mesh of the interface surface between a reference ROI and an union of other ROIs. MultiROI can also be set as input.

Parameters:
Returns:
  • interfaceMesh (ORSModel.ors.Mesh) – interface surface as a cubic mesh
  • error (int) – If the ROIs contain intersecting voxel, error code returned is -1. If error is -2, it’s means that no interface is shared. See the note below for more information

Note

Interface will be computed only if the reference ROI and others ROI do not share any voxels. (ROIs intersection = 0). Please edit the ROIs before generate the interfacial surface.

interfacemethod generateInterfacialMeshFromROIs(referenceROI, listOfROIs, iTIndex=0, samplingX=1, samplingY=1, samplingZ=1, world=True, aProgress=None)

Generates a mesh the interface surface between a reference ROI and an union of other ROIs. MultiROI can also be set as input.

Parameters:
  • referenceROI (ORSModel.ors.ROI, ORSModel.ors.MultiROI) – reference object
  • listOfROIs (ORSModel.ors.ROI, ORSModel.ors.MultiROI) [count=[1, None]] – other ROIs and Multi-ROIs that share an interface with the reference
  • iTIndex (int) – a time step
  • samplingX (int) – sampling factor in x local direction (1 means no sampling and it’s the default value)
  • samplingY (int) – sampling factor in y local direction (1 means no sampling and it’s the default value)
  • samplingZ (int) – sampling factor in z local direction (1 means no sampling and it’s the default value)
  • world (bool) – true to have the resulting mesh model in world coordinates, false in local
  • aProgress (ORSModel.ors.Progress) – an optional progress object
Returns:
  • interfaceMesh (ORSModel.ors.Mesh) – interface surface as a marching cubes mesh
  • error (int) – If the ROIs contain intersecting voxel, error code returned is -1. If error is -2, it’s means that no interface is shared. See the note below for more information

Note

Interface will only be computed if the reference ROI and others ROI do not share any voxels. (ROIs intersection = 0). Please edit the ROIs before generate the interfacial surface.

classmethod generateLinearInterpolatedContourMesh(aStructuredGrid, isovalue, forceAClosedMesh=True, samplingX=1, samplingY=1, samplingZ=1)

Generates a mesh from a structured grid using a vtk marching cube algorithm

Parameters:
  • aStructuredGrid (ORSModel.ors.StructuredGrid) – reference structured grid for mesh generation
  • isovalue (float) – select the intensity value for which the contour mesh will be generated on the structured grid for ROI and Multi-ROI use an isovalue between 0 and 100.
  • forceAClosedMesh (bool) – if true, generate a closed contour mesh
  • samplingX (int) – sampling factor in x direction
  • samplingY (int) – sampling factor in y direction
  • samplingZ (int) – sampling factor in z direction
Returns:

orsSurface (ORSModel.ors.Mesh) – a contour mesh

classmethod getDisplayModelClass()
classmethod getIsEnabledIn3D(obj)
classmethod getLegendTitle(aMesh, aScalarValueTypeTag='')
classmethod getListOfDisplayRenderingMesh(aMesh)

Deprecated : Use getListOfDisplayRendering instead

Deprecated since version 4.0.

classmethod getModelClass()
interfacemethod getNonManifoldEdgesCount(mesh, iTIndex=0, progress=None)

Find non manifold edges count

Parameters:
Returns:

output (int) – non manifold edges count, or -1 if the computation fail

classmethod getPointsFromAPlaneMeshCutter(IMeshModel, IPlane, ITIndex)
classmethod getVisualModelClass()
classmethod loadFromVTKFile(IPath, showProgress, progress, ITIndex)

Deprecated : this function cannot load a VTK file with chinese characters in the path name

classmethod loadFromXMLVTKFile(IPath, showProgress, progress, ITIndex)

Deprecated : this function cannot load a XML VTK file with chinese characters in the path name

classmethod mapAListOfScalarSlotFromAMeshToAnother(sourceMesh: ORSModel.ors.Mesh, referenceMesh: ORSModel.ors.Mesh, listOfSlotId, referenceTIndex, sourceTIndex, defaultScalarValue)

Maps vertices scalar values of a reference mesh to a source mesh

Parameters:
  • sourceMesh (ORSModel.ors.Mesh) – a source mesh
  • referenceMesh (ORSModel.ors.Mesh) – a reference mesh
  • listOfSlotId (int) [count=[1, None]] – a list of scalar slot index
  • referenceTIndex (int) – the time step of the reference mesh
  • sourceTIndex (int) – the time step of the source mesh
  • defaultScalarValue (float) – A default value if no match is possible between a vertex and the Multi ROI label
Returns:

output (bool) – True if the mapping works, else False

classmethod mapAListOfScalarSlotFromAMultiROIToAMesh(sourceMesh: ORSModel.ors.Mesh, referenceMultiROI: ORSModel.ors.MultiROI, listOfSlotId, referenceMultiROITIndex, sourceMeshTIndex, defaulfScalarValue=1.0)
classmethod mapDatasetValuesToAnUnstructuredGrid(sourceMesh: ORSModel.ors.Mesh, referenceChannel, referenceChannelTIndex, sourceMeshTIndex, defaulfScalarValue=1.0, scalarValueTypeTag='')

Maps values from a dataset (reference), as vertex scalar values, to an mesh (source)

Parameters:
  • sourceMesh (ORSModel.ors.Mesh) – a source unstructured grid
  • referenceChannel (ORSModel.ors.Channel) – a reference Channel
  • referenceChannelTIndex (int) – the time step of the reference dataset
  • sourceMeshTIndex (int) – the time step of the source mesh
  • defaulfScalarValue (float) – A default value if no match is possible between a vertex and the dataset
  • scalarValueTypeTag (str) – an Id to know which legend update
Returns:

output (bool) – True if the mapping works, else False

classmethod performHanningWindowedSmoothing(mesh, nbOfIterations, boundarySmoothing=False, featureEdgeSmoothing=False, featureAngle=0.5, passBandFactor=0.1, includesScalars=False, createNewMesh=False, iTIndex=0, IProgress=None)

Smooth a mesh with vtkWindowedSincPolyDataFilter algorithm. For more information, check the official vtk vtkWindowedSincPolyDataFilter documentation

Parameters:
  • mesh (ORSModel.ors.Mesh) – a mesh
  • nbOfIterations (int) – number of iterations
  • boundarySmoothing (bool) – perform smoothing of vertices on the boundary of the mesh, default value is False
  • featureEdgeSmoothing (bool) – smoothing along sharp interior edges, default value is False
  • featureAngle (float) – specify the feature angle for sharp edge identification (in degree) 0.5 by default
  • passBandFactor (float) – Set the pass band value for the windowed filter, default value is 0.1
  • includesScalars (bool) – if true scalars values will be keeped, else not. Default value is False
  • createNewMesh (bool) – if true, the output will be an new mesh object, else perform smoothing on the input. Default value is False.
  • iTIndex (int) – current time step, default value is 0
  • IProgress (ORSModel.ors.Progress) – a progress, default value is None
Returns:
  • output (ORSModel.ors.Mesh, None) – a Smoothed mesh if worked, else None
  • errorCode (int) – an error code that provide more information when the computation fail
classmethod performVTKButterflyMeshSubdivision(mesh, numberOfSubdivision=1, includeScalars=False, createNewMesh=False, iTIndex=0, IProgress=None)

Subdivide a mesh by a factor based on the vtkButterflySubdivisionFilter. For more information, check the original documentation.

Parameters:
  • mesh (ORSModel.ors.Mesh) – a mesh model
  • numberOfSubdivision (int) – number of subdivisions
  • createNewMesh (bool) – the number of times that the mesh will be subdivided
  • includeScalars (bool) – Include or not scalar in input
  • iTIndex (int) – current time step
  • IProgress (ORSModel.ors.Progress) – a progress bar object
Returns:
  • output (ORSModel.ors.Mesh) – a subdivided mesh if it worked, else None
  • errorString (str) – give more information why the algorithm did not succeed
classmethod performVTKLinearMeshSubdivision(mesh, numberOfSubdivision=1, includeScalars=False, createNewMesh=False, iTIndex=0, IProgress=None)

Subdivide a mesh by a factor based on the vtkLinearSubdivisionFilter. For more information, check the original documentation.

Parameters:
  • mesh (ORSModel.ors.Mesh) – a mesh model
  • numberOfSubdivision (int) – number of subdivisions
  • createNewMesh (bool) – the number of times that the mesh will be subdivided
  • includeScalars (bool) – Include or not scalar in input
  • iTIndex (int) – current time step
  • IProgress (ORSModel.ors.Progress) – a progress bar object
Returns:
  • output (ORSModel.ors.Mesh) – a subdivided mesh if it worked, else None
  • errorString (str) – give more information why the algorithm did succed
classmethod performVTKLoopMeshSubdivision(mesh, numberOfSubdivision=1, includeScalars=False, createNewMesh=False, iTIndex=0, IProgress=None)

Subdivide a mesh by a factor based on the vtkLoopSubdivisionFilter. For more information, check the original documentation.

Parameters:
  • mesh (ORSModel.ors.Mesh) – a mesh model
  • numberOfSubdivision (int) – number of subdivisions
  • createNewMesh (bool) – the number of times that the mesh will be subdivided
  • includeScalars (bool) – Include or not scalar in input
  • iTIndex (int) – current time step
  • IProgress (ORSModel.ors.Progress) – a progress bar object
Returns:
  • output (ORSModel.ors.Mesh) – a subdivided mesh if it worked, else None
  • errorString (str) – give more information why the algorithm did succed
classmethod performVTKProMeshDecimation(mesh, targetDecimator=0.5, iTIndex=0, createNewMesh=False, includeScalar=False, bShowProgress=True)
classmethod performVTKProMeshDecimationFromGUID(meshGUID, targetDecimator=0.5, iTIndex=0, createNewMesh=False, includeScalar=False, bShowProgress=True)
classmethod performVTKProMeshDecimationFromGUIDAndPublish(meshGUID, targetDecimator=0.5, iTIndex=0, createNewMesh=True, includeScalar=False, bShowProgress=True)
classmethod performVTKProMeshDecimationFromGUIDAndPublishAndShow(meshGUID, targetDecimator=0.5, iTIndex=0, createNewMesh=True, includeScalar=False, bShowProgress=True)
classmethod performVTKQuadricMeshDecimation(mesh, targetDecimator=0.5, iTIndex=0, createNewMesh=False, bShowProgress=True)
classmethod readAFile(reader, IPath)
classmethod refreshOctree(aMesh)
interfacemethod setIsVisibleForViewFromLayoutGenealogicalName(aName, aMesh, isVisible)

Set view mode for Mesh

Deprecated since version 4.0.

Parameters:
  • aName (str) – a genealogical name
  • aMesh (ORSModel.ors.Mesh) – a Mesh
  • isVisible (bool) – visibility
interfacemethod setIsVisibleIn2DFromGenealogicalName(name, aMesh, isVisible)

Sets the visibility of a mesh in all 2D views of the given scene layout

Parameters:
  • name (str) – a genealogical name of a scene layout
  • aMesh (ORSModel.ors.Mesh) – a Mesh
  • isVisible (bool) – True to set as visible, False otherwise
classmethod setLUT(aMesh, aLUT, aView=None, aScalarValueTypeTag='')

Set LUT for a View, if view is None, the lut will be set for all view

classmethod updateColorFromVertexScalarValue(aMesh, forceToRefresh=False, aScalarValueTypeTag='', iTIndex=0)
classmethod updateLegend(aMesh, display=None, ITopFrame=None, aScalarValueTypeTag='')
classmethod updateMeshColorFromVertexScalarValue(IMeshModel, forceToRefresh=False)

multiroicomparehelper

class OrsHelpers.multiroicomparehelper.MultiROICompareHelper

Bases: object

Helper to perform comparison on MultiROIs.

This is essentially for testing purposes.

classmethod compare(aMultiROI1, aMultiROI2)

Compares MultiROIs. :param aMultiROI1: First Multi-ROI. :param aMultiROI2: Second Multi-ROI. :return: True if both Multi-ROIs are equivalent; False otherwise.

classmethod getWarningFromLastCompare()
lastWarning = ''

multiroilabelhelper

class OrsHelpers.multiroilabelhelper.MultiROILabelHelper

Bases: object

Helper related to the ORSModel.ors.MultiROI to manage the labels

interfacemethod addLabels(multiroi: ORSModel.ors.MultiROI, add_count)

Adds N labels to a Multi-ROI

Parameters:
interfacemethod clearSelectedLabels(multiroi: ORSModel.ors.MultiROI, tIndex: int)

Clears all the selected labels in the Multi-ROI

Parameters:
interfacemethod connectedComponentsOnLabels(multiroi: ORSModel.ors.MultiROI, labels: ORSModel.ors.ArrayUnsignedLong, on_26_connected: bool)

Computes connected components on all the supplied labels in the Multi-ROI. All the supplied labels are gathered in one blob, and then they are separated into distinct objects. Those distinct objects are put back into the MultiROI, replacing the selected labels and possibly adding more labels.

Parameters:
classmethod extractSelectedLabelsToROI(roi: ORSModel.ors.ROI, multiroi: ORSModel.ors.MultiROI, tIndex: int)

Extracts all selected labels from a Multi-ROI into a supplied ROI.

Parameters:
interfacemethod extractSelectedLabelsToROIs(multiroi: ORSModel.ors.MultiROI, tIndex: int)

Extracts each selected label from a Multi-ROI into a separate ROI.

Parameters:
Returns:

guids (str) [count=[0, None]] – list of created ROI guids

interfacemethod mergeSelectedLabels(multiroi: ORSModel.ors.MultiROI, tIndex: int)

Merges all the selected labels in the Multi-ROI. They are merged so: all the selected labels are merged into the first label of the selection.

Parameters:
interfacemethod removeSelectedLabels(multiroi: ORSModel.ors.MultiROI, tIndex: int)

Removes all the selected labels from the Multi-ROI

Parameters:
interfacemethod setLabelUseGlobalOpacity(multiroi: ORSModel.ors.MultiROI, label)

The specified label will use the MultiROI global intensity

Parameters:
interfacemethod setSelectedLabelsUseGlobalOpacity(multiroi: ORSModel.ors.MultiROI, tIndex)

The selected labels will use the MultiROI global intensity

Parameters:

nodehelper

class OrsHelpers.nodehelper.NodeHelper

Bases: object

Helper related to the class ORSModel.ors.Node.

interfacemethod applyNodeOrder(nodeOrder, pluginInstance=None)

Switches the order of the nodes under the top frame and views of the context where the pluginInstance is contained

Parameters:
  • nodeOrder (ORSModel.ors.Node) [count=[0, None]] – new node order. The first item in the list will be put at a low child index; the last item in the list will be put at a high child index.
  • pluginInstance (plugin instance) – plugin instance determining the top frame under which the reordering will be done. If None, the top frame of the current context will be used.

opacityholder

class OrsHelpers.opacityholder.OpacityHolder(highlightOpacity, highlightOpacityInRange, highlightOpacityOutRange, volumeOpacity, roiOpacity, roiOpacityInRange, roiOpacityOutRange)

Bases: tuple

effectiveHighlightOpacityInRange
effectiveHighlightOpacityOutRange
effectiveROIOpacityInRange
effectiveROIOpacityOutRange
highlightOpacity

Alias for field number 0

highlightOpacityInRange

Alias for field number 1

highlightOpacityOutRange

Alias for field number 2

roiOpacity

Alias for field number 4

roiOpacityInRange

Alias for field number 5

roiOpacityOutRange

Alias for field number 6

volumeOpacity

Alias for field number 3

orsregistrationhelper

class OrsHelpers.orsregistrationhelper.OrsRegistrationHelper

Bases: object

Helper for performing registration.

classmethod addTransformationMatrixToUserInfo(objectGUI, matrix, registrationMethod=None)
classmethod applyTransformationFromAnObjectToAnOtherObject(referenceObjectGUID, movingObjectGUID, iTIndex=0)
classmethod copyAllTransformationMatrixFromAnObjectToAnother(referenceObject, targetObject)
classmethod deleteLastTransformationMatrix(objectGUID)
classmethod getAllTransfromationStringMatrixFromUserInfo(objectGUID)
classmethod getCurrentRegistrationIndex(objectGUI)
classmethod getCurrentRegistrationKey(objectGUI)
classmethod getCurrentRegistrationKeyOfManaged(aManaged)
classmethod getEulerAnglesFromTransformMatrix(transformationMatrix, scale)
classmethod getEulerAnglesInDegreeFromTransformMatrix(transformationMatrix, scale)
classmethod getIdentityTransformationMatrix()
classmethod getIsFirstTransformationOn(objectGUI)
classmethod getIsLastTransformationOn(objectGUI)
classmethod getLastRegistrationMethod(objectGUI)
classmethod getLastTransformationMatrix(objectGUI)
classmethod getNumberOfRegistrationKeys(objectGUI)
classmethod getTotalAppliedTransformationMatrix(channelGUID)
classmethod getTransformationMatrixAtIndex(objectGUI, index)
classmethod getTransformationMatrixThatAreDifferentFromAReferenceObject(referenceObjectGUID, anObjectGUID)
classmethod removeTransformationMatrixFromUserInfo(objectGUI)

orthogonalityhelper

class OrsHelpers.orthogonalityhelper.OrthogonalityHelper

Bases: object

classmethod checkOrthogonality(direction, up, normal, epsilon)
classmethod orthogonalize(aBox, direction, up, normal)

overlayhelper

class OrsHelpers.overlayhelper.OverlayHelper

Bases: object

classmethod copyOverlayModel(overlay, view=None)

Copies an overlay

interfacemethod copyOverlayModelForGenealogicalName(visualOverlay, viewName='')

Copies an overlay

Parameters:
Returns:

newOverlay (ORSModel.ors.VisualOverlay) – The created visualOverlay

classmethod getIsVisibleIn2D(visualOverlay, view)
Parameters:
Returns:

output (bool) – the 2D visualOverlay visibility

classmethod getIsVisibleIn3D(visualOverlay, view)
Parameters:
Returns:

output (bool) – the 3D VisualOverlay visibility

classmethod setIsVisibleIn2D(visualOverlay, view, value)
Parameters:
interfacemethod setIsVisibleIn2DFromGenealogicalName(name, visualOverlay, value)

Sets the visibility of a VisualOverlay in the given view layout

Parameters:
  • name (str) – a genealogical name of a view layout
  • visualOverlay (ORSModel.ors.VisualOverlay) – a VisualOverlay
  • value (bool) – True to set as visible, False otherwise
classmethod setIsVisibleIn3D(visualOverlay, view, value)
Parameters:

phantomgenerators

class OrsHelpers.phantomgenerators.PhantomGenerators

Bases: object

Helper for generating testing/debugging datasets.

classmethod circleIntensityToDataset(datasetGUID, circleDiameter, circleDepth, boxHeight, boxWidth, boxDepth, intensityList)

Method that adds circles with the specified dimensions and intensities to an existing dataset. The number of shapes created will depend on the dimensions given and the number of intensities within the intensityList.

Parameters:
  • datasetGUID – string Unique identification of an ORSChannel.
  • circleDiameter – uint Diameter according to the Y and X axis that all shapes will have.
  • circleDepth – uint Depth according to the Z axis that all volumes will have.
  • boxHeight – uint Height according to the Y axis of the box surrounding the shape. Having greater box dimensions than shape dimensions will prevent overlapping.
  • boxWidth – uint Width according to the X axis of the box surrounding the shape. Having greater box dimensions than shape dimensions will prevent overlapping.
  • boxDepth – uint Depth according to the Z axis of the box surrounding the shape. Having greater box dimensions than shape dimensions will prevent overlapping.
  • intensityList – list of float Intensity values that will be given to individual volume generated.
classmethod createEmptyChannel(xSize=100, ySize=100, zSize=100, title='New Phantom Image', dataType=<class 'numpy.uint8'>, spacing=[1.0, 1.0, 1.0, 1.0])

Method that generates an empty channel with the desired dimensions, spacing, title and data type.

Parameters:
  • xSize – uint Width of the generated dataset.
  • ySize – uint Height of the generated dataset.
  • zSize – uint Depth of the generated dataset.
  • title – string Name that will be given to the generated dataset.
  • dataType – type Numpy data type the array should have. This data type will be the same as the one used in the generated
  • spacing – list of floats Each index specifies the spacing of direction0, direction1, direction2 and T. dataset.
Returns:

output – Dataset’s GUID if it is generated correctly.

static flattenList(listToFlatten, numberOfTime)
static generate4dPhantom(pathToWritte, xySize, imgSize, imgToHidePath=None, posToHide=None, fontsize=50)
static generate5dPhantom(pathToWritte, xySize, imgSize, imgToHidePath=None, posToHide=None, fontsize=50)
static generate6dPhantom(pathToWritte, xySize, imgSize, imgToHidePath=None, posToHide=None, fontsize=50)
static generateHyperDimensionalFromNumpyArray(pathToWritte, array, labels, unit)
classmethod generateIntensities(dataset, listNumbers, fontsize=50)
classmethod rectangleIntensityToDataset(datasetGUID, rectangleHeight, rectangleWidth, rectangleDepth, boxHeight, boxWidth, boxDepth, intensityList)

Method that adds rectangles with the specified dimensions and intensities to an existing dataset. The number of shapes created will depend on the dimensions given and the number of intensities within the intensityList.

Parameters:
  • datasetGUID – string Unique identification of an ORSChannel.
  • rectangleHeight – uint Height according to the Y axis that all shapes will have.
  • rectangleWidth – uint Width according to the X axis that all shapes will have.
  • rectangleDepth – uint Depth according to the Z axis that all volumes will have.
  • boxHeight – uint Height according to the Y axis of the box surrounding the shape. Having greater box dimensions than shape dimensions will prevent overlapping.
  • boxWidth – uint Width according to the X axis of the box surrounding the shape. Having greater box dimensions than shape dimensions will prevent overlapping.
  • boxDepth – uint Depth according to the Z axis of the box surrounding the shape. Having greater box dimensions than shape dimensions will prevent overlapping.
  • intensityList – list of float Intensity values that will be given to individual volume generated.
classmethod saveImagesFromNumpyArray(npArray, outputImageFileStringToFormat)

Helper to save a numpy array as a set of images into a directory

Parameters:
  • npArray – numpy array Array to write as individual images. The accepted shape is (z, y, x).
  • outputImageFileStringToFormat – string String to format with an image number, where the images will be saved. Ex: C:tmpImagesTestImage_{:04g}.tif
Returns:

output – None

classmethod saveImagesIntensities(numberMin, numberMax, xSize, ySize, fontsize=50, imgPath='C:\\tmp\\ImagesTest\\Image_{:04g}.tif')
classmethod shapeAndIntensityToDataset(datasetGUID, shape, shapeHeight, shapeWidth, shapeDepth, boxHeight, boxWidth, boxDepth, intensityList)

Method that adds the desired shape with the specified dimensions and intensities to an existing dataset. The number of shapes created will depend on the dimensions given and the number of intensities within the intensityList.

Parameters:
  • datasetGUID – string Unique identification of an ORSChannel.
  • shape – string 2D shape of the area to be painted, either ‘circle’ or ‘rectangle’.
  • shapeHeight – uint Height according to the Y axis that all shapes will have.
  • shapeWidth – uint Width according to the X axis that all shapes will have.
  • shapeDepth – uint Depth according to the Z axis that all volumes will have.
  • boxHeight – uint Height according to the Y axis of the box surrounding the shape. Having greater box dimensions than shape dimensions will prevent overlapping.
  • boxWidth – uint Width according to the X axis of the box surrounding the shape. Having greater box dimensions than shape dimensions will prevent overlapping.
  • boxDepth – uint Depth according to the Z axis of the box surrounding the shape. Having greater box dimensions than shape dimensions will prevent overlapping.
  • intensityList – list of float Intensity values that will be given to individual volume generated.
Returns:

output – None if the intensityList is empty. None if the provided shape is not recognized.

primitivehelper

class OrsHelpers.primitivehelper.PrimitiveHelper

Bases: OrsHelpers.managedhelper.ManagedHelper

Helper related to the class ORSModel.ors.Annotation.

interfacemethod addControlPoint(anAnnotation, timeStep, position, transformationMatrix=None)

Adds a control point in an annotation.

Parameters:
Returns:

success (bool) – True if successful, False otherwise

classmethod attachPrimitiveToView(anAnnotation, aView)
interfacemethod createPrimitive(primitiveClass, aLayoutName, associatedState)

Creates an annotation.

Parameters:
  • primitiveClass (ORSModel.ors.Annotation class) – the class of the annotation to create
  • aLayoutName (str) – a layout genealogical name
  • associatedState (str) – edition associated state
Returns:

newAnnotation (ORSModel.ors.Annotation) – the created annotation

interfacemethod deletePrimitive(anAnnotation)

Deletes an annotation.

Parameters:anAnnotation (ORSModel.ors.Annotation) – the annotation object to delete
Returns:success (bool) – True if successful, False otherwise
interfacemethod deselectControlPoint(anAnnotation, controlPointIndex, timeStep)

Deselects a control point from an annotation.

Parameters:
  • anAnnotation (ORSModel.ors.Annotation) – the annotation object to modify
  • controlPointIndex (int) – index of the control point in the annotation
  • timeStep (int) – time index of the annotation
Returns:

success (bool) – True if successful, False otherwise

interfacemethod insertControlPoint(index, anAnnotation, timeStep, position, transformationMatrix=None)

Insert a control point.

Parameters:
  • index (int) – index of the control point to insert
  • anAnnotation (ORSModel.ors.Annotation) – the annotation object to modify
  • timeStep (int) – time index of the annotation
  • position (ORSModel.ors.Vector3) – (X, Y, Z) coordinate of the new position
  • transformationMatrix (ORSModel.ors.Matrix4x4) – the transformation matrix (optional)
Returns:

success (bool) – True if successful, False otherwise

interfacemethod removeControlPoint(anAnnotation, controlPointIndex, timeStep)

Removes a control point from an annotation.

Parameters:
  • anAnnotation (ORSModel.ors.Annotation) – the annotation object to modify
  • controlPointIndex (int) – index of the control point in the annotation
  • timeStep (int) – time index of the annotation
Returns:

success (bool) – True if successful, False otherwise

interfacemethod selectControlPoint(anAnnotation, controlPointIndex, timeStep)

Selects a control point from an annotation.

Parameters:
  • anAnnotation (ORSModel.ors.Annotation) – the annotation object to modify
  • controlPointIndex (int) – index of the control point in the annotation
  • timeStep (int) – time index of the annotation
Returns:

success (bool) – True if successful, False otherwise

interfacemethod setControlPointPosition(anAnnotation, controlPointIndex, timeStep, position, transformationMatrix=None)

Sets the position of a control point.

Parameters:
  • anAnnotation (ORSModel.ors.Annotation) – the annotation object to modify
  • controlPointIndex (int) – index of the control point in the annotation
  • timeStep (int) – time index of the annotation
  • position (ORSModel.ors.Vector3) – (X, Y, Z) coordinate of the new position
  • transformationMatrix (ORSModel.ors.Matrix4x4) – the transformation matrix (optional)
Returns:

success (bool) – True if successful, False otherwise

interfacemethod setRegionShape(anAnnotation, regionShape)

Sets the shape of an region annotation.

Parameters:
  • anAnnotation (ORSModel.ors.Annotation) – the annotation object to modify
  • regionShape (IntEnum CxvRegion_Shape) – the shape to set
Returns:

success (bool) – True if successful, False otherwise

interfacemethod translatePrimitive(anAnnotation, timeStep, xOffset, yOffset, zOffset)

Translates an annotation.

Parameters:
  • anAnnotation (ORSModel.ors.Annotation) – the annotation object to modify
  • timeStep (int) – time index of the annotation
  • xOffset (float) – translation X distance
  • yOffset (float) – translation Y distance
  • zOffset (float) – translation Z distance
Returns:

success (bool) – True if successful, False otherwise

processislandhelper

class OrsHelpers.processislandhelper.ProcessIslandHelper

Bases: object

interfacemethod isolateNLargest(aROI, numberOfObject, as26Connected, aProgress=None)

Keeps only the N largest objects of a ROI.

Parameters:
  • aROI (ORSModel.ors.ROI) – the ROI to modify
  • numberOfObject (int) – number of objects to keep
  • as26Connected (bool) – if True, the connectivity will be made using 26 neighbors; if False, the connectivity will be made using 6 neighbors.
  • aProgress (ORSModel.ors.Progress) – progress object
interfacemethod processIslands(aROI, voxelCountThreshold, keepLargeObjects, as26Connected, timeIndex, aProgress=None)

Removes small or big objects of a ROI based on their voxel count.

Parameters:
  • aROI (ORSModel.ors.ROI) – the ROI to modify
  • voxelCountThreshold (int) – voxel count threshold
  • keepLargeObjects (bool) – if True, only the objects having a voxel count greater than or equal to the count threshold will be kept; if False, only the objects having a voxel count smaller than or equal to the count threshold will be kept.
  • as26Connected (bool) – if True, the connectivity will be made using 26 neighbors; if False, the connectivity will be made using 6 neighbors.
  • timeIndex (int) – T index
  • aProgress (ORSModel.ors.Progress) – progress object
classmethod queryKeepOrRemoveByVoxelCountValues(parent, remove)
classmethod queryKeepOrRemoveNLargestValues(parent, remove)
interfacemethod removeNLargest(aROI, numberOfObject, as26Connected, aProgress=None)

Removes the N biggest objects of a ROI.

Parameters:
  • aROI (ORSModel.ors.ROI) – the ROI to modify
  • numberOfObject (int) – number of objects to remove
  • as26Connected (bool) – if True, the connectivity will be made using 26 neighbors; if False, the connectivity will be made using 6 neighbors.
  • aProgress (ORSModel.ors.Progress) – progress object
translator = <PyQt5.QtCore.QObject object>

progresslogger

class OrsHelpers.progresslogger.ProgressLogger

Bases: object

Helper related to the class ORSModel.ors.Progress.

Deprecated since version 3.1: Set the optional argument logging at True when calling the constructor or any method to log the call.

interfacemethod closeProgress(aProgress)

Closes the progress bar

This protocol is also called automatically when the interface gets deleted, so it is not necessary to call it.

Parameters:aProgress (ORSModel.ors.Progress) – a Progress object
interfacemethod createProgressObject()

Creates a Progress object

Returns:aProgress (ORSModel.ors.Progress) – the created progress object
interfacemethod decrementRangeBy(aProgress, decrementRangeValue)

Decrements the progress range

This protocol is only relevant when the progress is not a working progress.

Parameters:
  • aProgress (ORSModel.ors.Progress) – a Progress object
  • decrementRangeValue (int) – the range decrement
interfacemethod deleteProgressObject(aProgress)

Deletes a Progress object

Parameters:aProgress (ORSModel.ors.Progress) – a progress object
interfacemethod incrementRangeBy(aProgress, incrementRangeValue)

Increments the progress range

This protocol is only relevant when the progress is not a working progress.

Parameters:
  • aProgress (ORSModel.ors.Progress) – a Progress object
  • incrementRangeValue (int) – the range increment
classmethod logCreateProgressObject(IProgress)

This method is to be able to use the overloaded “new” of Progress.

This is to cover the 4 common situations:
  • call aProgress = Progress() in Python (call “new” with log);
  • calling createProgressObject directly (from Python code or from the execution of a macro);
  • calling aProgress = orsObj(aProgressGUID) (this calls “new” to create a new Python reference,
    but should not log because the logging of that object occurred at its creation);
  • calling a COMWrapper method with a progress at None (this calls “new” from sip
    with a Progress object at none; this should not log).
Parameters:IProgress – the newly created Progress object to log
loggedProgressGUID = []
newProgressGUID = ''
interfacemethod resetCancelledState(aProgress)

Resets the cancelled state

Parameters:aProgress (ORSModel.ors.Progress) – a Progress object
interfacemethod setExtraText(aProgress, text)

Sets the extra text

Parameters:
interfacemethod setIsCancellable(aProgress, isCancellable)

Sets if the progress is cancellable

Parameters:
  • aProgress (ORSModel.ors.Progress) – a progress object
  • isCancellable (bool) – True to make the progress cancellable, False otherwise
interfacemethod setIsCancelled(aProgress, isCancelled)

Sets the progress to be cancelled or not

This protocol is only relevant when the progress is a cancellable progress.

Parameters:
  • aProgress (ORSModel.ors.Progress) – a Progress object
  • isCancelled (bool) – True to set in a cancelled state, False otherwise
interfacemethod startProgressWithCaption(aProgress, caption, range, isCancellable)

Starts a normal progress bar

Parameters:
  • aProgress (ORSModel.ors.Progress) – a Progress object
  • caption (str) – the progress caption
  • range (int) – the range
  • isCancellable (bool) – True if the progress bar is to be cancellable, False otherwise
interfacemethod startProgressWithID(aProgress, progressID, range, isCancellable)

Starts a normal progress bar

Parameters:
  • aProgress (ORSModel.ors.Progress) – a Progress object
  • progressID (int) – the progress ID (see ORSProgressBars.h for supported IDs)
  • range (int) – the range
  • isCancellable (bool) – True if the progress bar is to be cancellable, False otherwise
interfacemethod startWorkingProgressWithCaption(aProgress, caption, isCancellable)

Starts a working progress bar

Parameters:
  • aProgress (ORSModel.ors.Progress) – a Progress object
  • caption (str) – the progress caption
  • isCancellable (bool) – True if the progress bar is to be cancellable, False otherwise
interfacemethod startWorkingProgressWithID(aProgress, progressID, isCancellable)

Starts a working progress bar

Parameters:
  • aProgress (ORSModel.ors.Progress) – a Progress object
  • progressID (int) – the progress ID (see ORSProgressBars.h for supported IDs)
  • isCancellable (bool) – True if the progress bar is to be cancellable, False otherwise
interfacemethod updateProgress(aProgress, progressPosition)

Updates the progress bar

This protocol should not be used with working progress bars, as they do not have a position.

Parameters:
  • aProgress (ORSModel.ors.Progress) – a Progress object
  • progressPosition (int) – the new progress bar position

refreshHelper

class OrsHelpers.refreshHelper.RefreshHelper

Bases: object

Helper for refreshing views.

classmethod getAllParentDisplaysWhereVisualsAreVisible(visuals)

reporthelper

class OrsHelpers.reporthelper.ReportHelper

Bases: object

Helper for report generation.

interfacemethod captureSnapshot(viewName, filename, xSize, ySize)

Captures a snapshot of a view and saves it in a file

Parameters:
  • viewName (str) – a genealogical name of a view
  • filename (file saving) – the file name of the snapshot
  • xSize (int) – snapshot X size
  • ySize (int) – snapshot Y size
interfacemethod captureSnapshotAsImage(viewName, xSize, ySize)

Captures a snapshot of a view as an Image

Parameters:
  • viewName (str) – a genealogical name of a view
  • xSize (int) – snapshot X size
  • ySize (int) – snapshot Y size
Returns:

snapshotImage (ORSModel.ors.Image) – the snapshot image

roicomparehelper

class OrsHelpers.roicomparehelper.ROICompareHelper

Bases: object

Helper to perform comparison on ROIs.

This is essentially for testing purposes.

classmethod compare(aROI1, aROI2)

Compares ROIs. :param aROI1: First ROI. :param aROI2: Second ROI. :return: True if both ROIs are equivalent; False otherwise.

classmethod getWarningFromLastCompare()
lastWarning = ''

roihelper

class OrsHelpers.roihelper.ROIHelper

Bases: object

Helper related to the classes ORSModel.ors.ROI and ORSModel.ors.MultiROI.

interfacemethod closeHoles(aROI, threshold, progress)

Creates a ROI obtained from the closing operation of the input ROI

Parameters:
Returns:

closedROI (ORSModel.ors.ROI) – a new ROI

interfacemethod computeInterfacialSurface(referenceROI, listOfROIs, iTIndex=0, aProgress=None)

Compute the interfacial surface area between a reference ROI/Multi-ROI and other ROI/Multi-ROI

Parameters:
Returns:

interfacialSurface – the interfacial surface

classmethod computeThicknessMesh(roi, currentTime, smoothingIterationsCount=0)
classmethod computeThicknessMeshSampled(roi, xSampling, ySampling, zSampling, currentTime, smoothingIterationsCount=0)
classmethod computeWindowedSmoothedThicknessMeshSampled(roi, samplingX, samplingY, samplingZ, currentTime=0, nbOfIterations=2, isBoundarySmoothedOn=False, isFeatureEdgeOn=False, featureAngle=0.5, passBandFactor=0.001, IProgress=None)
classmethod convertLabeledMultiROIToROI(LMRSource, ROIDestination, labelList=None)
classmethod copyLabeledMultiROI(LMRSource, LMRDestination, labelList=None)
interfacemethod copyMultiROI(aMultiROI)

Copies a MultiROI

Parameters:aMultiROI (ORSModel.ors.MultiROI) – the MultiROI to copy
Returns:newMultiROI (ORSModel.ors.MultiROI) – the copied MultiROI
classmethod copyMultiROIAndPublish(aMultiROI)
interfacemethod copyROI(aROI)

Copies a ROI

Parameters:aROI (ORSModel.ors.ROI) – the ROI to copy
Returns:newROI (ORSModel.ors.ROI) – the copied ROI
classmethod copyROIAndPublish(aROI)
classmethod createFullVolumeROIWithStructuredGrid(aROI)
interfacemethod createMultiROIFromStructuredGrid(structuredGridReference, MultiROITitle)

Creates a Multi ROI with the same shape of a reference structured grid.

Parameters:
  • structuredGridReference (ORSModel.ors.StructuredGrid) – the structured grid of reference
  • MultiROITitle (str) – title of the MultiROI
Returns:

aMultiROI (ORSModel.ors.MultiROI) – new MultiROI

interfacemethod createROIFromStructuredGrid(structuredGridReference, ROITitle, ROIColor)

Creates a ROI with the same shape of a reference structured grid.

Parameters:
Returns:

aROI (ORSModel.ors.ROI) – new ROI

classmethod executeMethod(listROIGUIDToModify, methodToExecute, args=None, updateUndo=True)
classmethod exportROIAsThicknessMeshSampled(aROI, xSampling, ySampling, zSampling, currentTime, smoothingIterationsCount=0)

Generates a thickness mesh from a ROI

No mesh is generated if the input ROI is empty.

Parameters:
  • aROI (ORSModel.ors.ROI) – 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
Const aROI:

True

Returns:
  • mesh (ORSModel.ors.Mesh) – the generated thickness mesh
  • isThicknessMeshComputationCancelled (bool) – flag to know if the computation has been cancelled by the user
classmethod extractROISFromMultiROI(source_multiROI)
classmethod fitBoundingBoxOfLabelToView(aMultiROI, label, view)
classmethod fitBoundingBoxToView(aROI, view)
classmethod fitToView(aROI, view)
classmethod generateMultiROILabelColor(aMultiROI, startLabelIndex: int, endLabelIndex: int)
classmethod get2DOpacity(aROI, view=None)
classmethod get3DOpacity(aROI, view=None)
classmethod getCenterOfMass(anOrsObject, iTIndex)
classmethod getColor(aROI, view=None)

Return the color of a ROI for a given display

Parameters:
Returns:

output – (r, g, b, a) a tuple of normalized color

classmethod getContourThickness(aROI, view)
interfacemethod getDenseMultiROIFromMultiROI(multiROI: ORSModel.ors.MultiROI, progress: ORSModel.ors.Progress)

Creates a Multi-ROI obtained from Roi list and the complement of the ROI list union

Parameters:
Returns:

denseMultiROI (ORSModel.ors.MultiROI) – a new multi ROI

interfacemethod getDenseMultiROIFromROIs(roi_list, progress: ORSModel.ors.Progress)

Creates a Multi-ROI obtained from Roi list and the complement of the ROI list union

Parameters:
Returns:

denseMultiROI (ORSModel.ors.MultiROI) – a new multi ROI

classmethod getEmptyLabels(aMultiROI)
interfacemethod getHighlightOpacityForAllViews(aROI)

Gets the in-range and out-of-range highlight opacity of a ROI or MultiROI for all views

Parameters:

aROI (ORSModel.ors.ROI, ORSModel.ors.MultiROI) – a ROI or a MultiROI

Returns:
  • highlightOpacityInRange (float) – in-range highlight opacity
  • highlightOpacityOutRange (float) – out-of-range highlight opacity
classmethod getIntersectionOfROIAndMultiROIThatIntersectPositionOnRectangle(rectangle, worldposition, roisOrMultiROIs, timestep)
classmethod getIsVisible(roi, display)
classmethod getIsVisibleIn2D(aROI, view)
Parameters:
Returns:

output (bool) – the 2D ROI visibility

classmethod getIsVisibleIn3D(aROI, view)
Parameters:
Returns:

output (bool) – the 3D ROI visibility

classmethod getLUT(aMultiROI, forceCreation=False)
classmethod getLegend(aMultiROI, forceCreation=False)
classmethod getLegendTitle(aMultiROI)
classmethod getListOf2DDisplayRenderingROI(aROI)
classmethod getListOf3DDisplayRenderingROI(aROI)
classmethod getListOfDisplayRenderingROI(aROI)
classmethod getMultiROIColor(aMultiROI, tIndex=0, adding=True)

Return the color of a MultiROI, which is the current selected label

Parameters:
  • aMultiROI (ORSModel.ors.MultiROI) – a MultiROI
  • tIndex (int) – T Index
  • adding (bool) – For Adding or not
Returns:

output – (r, g, b, a, adding) a tuple of normalized colors, and a bool to indicate if adding to another label

classmethod getNonEmptyLabels(aMultiROI)
classmethod getROIInterpolationMode(aROI)
classmethod getShowContour(aROI, view)
classmethod getUndoROI(aROI)
classmethod getUseDiscreteLegend(aMultiROI)
classmethod getVisualROI(aROI, forceCreation=False)

Return the VisualROI associated with a ROI

Parameters:
Returns:

output (ORSModel.ors.VisualROI) – the VisualROI

interfacemethod intersection(inputROIs, destinationROI, clearDestination=False, keepEmptyLabels=False)

Intersects multiple ROIs or Multi-ROi.

The input argument destinationROI cannot be None. If required, create a ROI or a MultiROI prior to calling this method (ex: ROIHelper.createROIFromStructuredGrid).

Parameters:
  • inputROIs (ORSModel.ors.ROI, ORSModel.ors.MultiROI) [count=[2, None]] – list of ROIs and/or Multi-ROIs
  • destinationROI (ORSModel.ors.ROI, ORSModel.ors.MultiROI) – ROI or MultiROI of destination
  • clearDestination (bool) – if True, the destinationROI will be cleared before getting the output result.
  • keepEmptyLabels (bool) – This is only applicable for the situation where the destination is a MultiROI. If False, empty labels of the destination are removed.
interfacemethod keepLabelIntersectingRoiOrMultiROI(iRoiOrMRoi, listOfRoiAndMRoiIntersecting, iTIndex, oRoiorMRoi=None)

Keep label that are intersecting the ROI and Multi-ROI in the list.

Parameters:
  • iRoiOrMRoi (ORSModel.ors.ROI, ORSModel.ors.MultiROI) – input reference ROI or Multi-ROI
  • iTIndex (int) – time step
  • listOfRoiAndMRoiIntersecting (ORSModel.ors.ROI, ORSModel.ors.MultiROI) [count=[1, None]] – list of ROIs and/or Multi-ROIs that will be used for intersection
  • oRoiorMRoi – an output ROI or Multi-ROI that contain the result (labels not removed from the intersection)
interfacemethod loadROIsFromFile(filename)

Loads all ROIs found in an ORSObject file

Parameters:filename (file) – fully qualified file name
Returns:newROIs (ORSModel.ors.ROI) [count=[0, None]] – list of new ROIs
classmethod outputROIListToPNG(ROIList, filename)
classmethod recoverFromUndo(listROIGUIDToRecoverFromUndo)
interfacemethod removeEmptyLabelsAndRenumber(aMultiROI)

Removes the empty labels and renumber the remaining ones

Parameters:aMultiROI (ORSModel.ors.MultiROI) – the MultiROI to modify
interfacemethod removeEmptyLabelsAndRenumberOnSize(aMultiROI, bAscending)

Removes the empty labels and renumber the remaining ones

Parameters:
  • aMultiROI (ORSModel.ors.MultiROI) – the MultiROI to modify
  • bAscending (bool) – a boolean flag indicating the sort order
interfacemethod removeLabelIntersectingRoiOrMultiROI(iRoiOrMRoi, listOfRoiAndMRoiIntersecting, iTIndex, oRoiorMRoi=None)

Remove label that are intersecting the ROI and Multi-ROI in the list.

Parameters:
  • iRoiOrMRoi (ORSModel.ors.ROI, ORSModel.ors.MultiROI) – input reference ROI or Multi-ROI
  • iTIndex (int) – time step
  • listOfRoiAndMRoiIntersecting (ORSModel.ors.ROI, ORSModel.ors.MultiROI) [count=[1, None]] – list of ROIs and/or Multi-ROIs that will be used for intersection
  • oRoiorMRoi – an output ROI or Multi-ROI that contain the result (labels not removed from the intersection)
classmethod roiConnectedComponentBySliceIterator(aROI: ORSModel.ors.ROI, tIndex: int, considerDiagonal: bool, box=None)
Parameters:
  • aROI – ROI to extract connected components from
  • tIndex
  • considerDiagonal – whether to consider areas with touching points on diagonal as connected
Returns:

output – list of connected ROIs in each slice

classmethod set2DOpacity(aROI, view=None, highlightOpacity=None, highlightOpacityInRange=None, highlightOpacityOutRange=None)
classmethod set3DOpacity(aROI, view=None, highlightOpacity=None, highlightOpacityInRange=None, highlightOpacityOutRange=None, roiOpacity=None, roiOpacityInRange=None, roiOpacityOutRange=None)
interfacemethod setColor(aROI, aColor, highlightOpacityInRange=None)

Sets the ROI color.

Parameters:
  • aROI (ORSModel.ors.ROI) – the ROI to set the color to
  • aColor (ORSModel.ors.Color) – the new color
  • highlightOpacityInRange (float) – the alpha normalized color (between 0.0 and 1.0) (optional)
classmethod setContourThickness(aROI, view, value)
classmethod setIsVisibleIn2D(aROI, view, value)
Parameters:
interfacemethod setIsVisibleIn2DFromGenealogicalName(name, aROI, isVisible)

Sets the visibility of a ROI or MultiROI in all 2D views of the given scene layout

Parameters:
  • name (str) – a genealogical name of a scene layout
  • aROI (ORSModel.ors.ROI, ORSModel.ors.MultiROI) – a ROI or a MultiROI
  • isVisible (bool) – True to set as visible, False otherwise
classmethod setIsVisibleIn3D(aROI, view, value)
Parameters:
interfacemethod setIsVisibleIn3DFromGenealogicalName(name, aROI, isVisible)

set 3D visibility of a ROI or of a MultiROI

Parameters:
classmethod setLUT(aMultiROI, newLUT, aView=None)

Note if aView is None the LUT will be set for all views

classmethod setROIInterpolationMode(obj, value)
classmethod setShowContour(aROI, view, value)
classmethod squarify(source_multiROI: ORSModel.ors.ROI, label_range: Tuple[int, int] = None)

“Squarify” each ROI island in a MultiROI

Parameters:
  • source_multiROI (ORSModel.ors.MultiROI) – source MultiROI
  • label_range (Tuple[int, int]) – Tuple indicating the label range
interfacemethod subtract(firstROI, secondROI, destinationROI, clearDestination=False, keepEmptyLabels=False)

Subtracts a ROI or Multi-ROi from another ROi or Multi-ROI, as: destinationROI = firstROI - secondROI.

The input argument destinationROI cannot be None. If required, create a ROI or a MultiROI prior to calling this method (ex: ROIHelper.createROIFromStructuredGrid).

Parameters:
interfacemethod union(inputROIs, destinationROI, keepEmptyLabels=False)

Makes the union of multiple ROIs or Multi-ROi.

The input argument destinationROI cannot be None. If required, create a ROI or a MultiROI prior to calling this method (ex: ROIHelper.createROIFromStructuredGrid).

Parameters:
classmethod updateLegend(aMultiROI, view, lutUUID, forceUpdate=False)
classmethod updateMultiROIColor(aMultiROI)
classmethod updateMultiROILabelColor(aMultiROI: ORSModel.ors.MultiROI, labelIndex: int, color: ORSModel.ors.Color)
classmethod updateMultiROILabelColorFromLUT(aMultiROI: ORSModel.ors.MultiROI, lut: ORSModel.ors.LookupTable)
classmethod updateMultiROISpecificLabelColor(aMultiROI, label)
classmethod updateUndo(listROIGUIDToUpdate)

SaversHelper

class OrsHelpers.SaversHelper.SaversHelper

Bases: object

Helper to start plugins of the “saver” kind (ex: OrsImageSaver, OrsMeshSaver).

classmethod openImageSaverOnDataset(aChannelGUID, forceWL=False)
classmethod openMeshSaverOnDataset(aMeshGUID, aLutGUID='')

sequentialcolorgenerator

class OrsHelpers.sequentialcolorgenerator.SequentialColorGenerator(lut_name=None, lut_guid=None, startIdx=0)

Bases: object

Generator of colors.

getColorIndex(key)
getDiscreteLUT()
getJSONData()
getOrsColor(key)
getQColor(key)
reset(startIdx=0)
setDiscreteLUT(ILUT)
setJSONData(data)
setOrsColor(key, orsColor)
setQColor(key, qColor)

sessionHelper

class OrsHelpers.sessionHelper.SessionHelper

Bases: object

Helper to manage sessions.

classmethod canLoseUnsavedObjects(exiting=True)
classmethod getUnsavedObjects()
classmethod startNewSessionInteractive()

Starts a new session, but if no objects live in the current session then just bypass.

Returns:output (bool) – True if the new session was started; False if the new session was cancelled.

shapehelper

class OrsHelpers.shapehelper.ShapeHelper

Bases: object

classmethod getColor(visualShape, view)
classmethod getIsVisibleIn2D(visualShape, view)
Parameters:
Returns:

output (bool) – the 2D VisualShape visibility

classmethod getIsVisibleIn3D(visualShape, view)
Parameters:
Returns:

output (bool) – the 3D VisualShape visibility

classmethod getThickness(visualShape, view)
classmethod set2DThickness(visualShape, view, thickness)
classmethod set3DThickness(visualShape, view, thickness)
classmethod setColor(aVisualShape, view, aColor)

Sets the color of a VisualShape

Parameters:
interfacemethod setColorFromGenealogicalName(aVisualShape, name, aColor)

Sets the color of a VisualShape

Parameters:
classmethod setIsVisibleIn2D(visualShape, view, value)
Parameters:
interfacemethod setIsVisibleIn2DFromGenealogicalName(name, visualShape, isVisible)

Sets the visibility of a VisualShape in all 2D views of the given scene layout

Parameters:
  • name (str) – a genealogical name of a scene layout
  • visualShape (ORSModel.ors.VisualShape) – a VisualShape
  • isVisible (bool) – True to set as visible, False otherwise
classmethod setIsVisibleIn3D(visualShape, view, value)
Parameters:
classmethod setThickness(visualShape, view, thickness)

Sets the color of a VisualShape

Parameters:
interfacemethod setThicknessFromGenealogicalName(visualShape, name, thickness)

Sets the thickness of a VisualShape

Parameters:
  • visualShape (ORSModel.ors.VisualShape) – a VisualShape
  • name (str) – a genealogical name
  • thickness (float) – the new thickness

structuredGridHelper

class OrsHelpers.structuredGridHelper.StructuredGridHelper

Bases: object

Helper related to the manipulation of classes inheriting ORSModel.ors.StructuredGrid (namely, Channel, ROI and MultiROI).

classmethod getClipBox(structuredGrid, viewOrTopFrame, forceCreation=False)
classmethod getClipBoxForCurrentView(structuredGrid, forceCreation=True, implementation=None)
classmethod getClipBoxes(structuredGrid)
classmethod getVisual(structuredGrid)
classmethod getVisualReachableByDisplay(structuredGrid, view)
classmethod refreshVisual(structuredGrid)
classmethod resetVisualBox(structuredGrid, view=None)

Resets the visual box of a structured grid.

Parameters:
  • structuredGrid (ORSModel.ors.StructuredGrid) – the structured grid object to reset the visual box to
  • view (ORSModel.ors.View) – a specific view in which the visual box is attached to. If set as None, the first parent will be used.
classmethod resetVisualBoxOfChannel(channel, view=None)
classmethod resetVisualBoxOfROI(roiOrLabelROI, view=None)
classmethod setClipBoxVisibility(structuredGrid, isVisible, view=None, logging=True)

Sets the visibility of the clip box associated to a structured grid in the layout of the view

Parameters:
  • structuredGrid (ORSModel.ors.StructuredGrid) – the associated structured grid
  • isVisible (bool) – if True, the clip box will be set as visible; if False, the clip box will be hidden.
  • view (ORSModel.ors.View) – the view
classmethod setVisualBox(structuredGrid, aBox, view=None)

Sets the visual box of a structured grid.

Parameters:

structuredGridLogger

class OrsHelpers.structuredGridLogger.StructuredGridLogger

Bases: OrsHelpers.abstractLogger.AbstractLogger

Helper related to the visibility of classes inheriting ORSModel.ors.StructuredGrid (namely, Channel, ROI and MultiROI).

interfacemethod resetVisualBoxOfChannelFromLayoutGenealogicalName(aName, channel)

Resets the visual box of a Channel

Parameters:
interfacemethod resetVisualBoxOfROIFromLayoutGenealogicalName(aName, aROIOrMultiROI)

Resets the visual box of a ROI or of a MultiROI

Parameters:
interfacemethod setBox(aStructuredGrid, aBox)

Sets box of StructuredGrid

Parameters:
classmethod setClipBoxVisibilityOfChannel(channel, isVisible, view=None)
interfacemethod setClipBoxVisibilityOfChannelFromLayoutGenealogicalName(aName, channel, isVisible)

Sets the visual box visibility of a Channel

Parameters:
  • aName (str) – a genealogical name
  • channel (ORSModel.ors.Channel) – a Channel
  • isVisible (bool) – if True, the clip box will be set as visible; if False, the clip box will be hidden.
classmethod setClipBoxVisibilityOfROI(aROIOrMultiROI, isVisible, view=None)
interfacemethod setClipBoxVisibilityOfROIFromLayoutGenealogicalName(aName, aROIOrMultiROI, isVisible)

Sets the visual box visibility of a ROI or of a MultiROI

Parameters:
  • aName (str) – a genealogical name
  • aROIOrMultiROI (ORSModel.ors.ROI, ORSModel.ors.MultiROI) – a ROI or a MultiROI
  • isVisible (bool) – if True, the clip box will be set as visible; if False, the clip box will be hidden.
classmethod setVisualBox(aROIOrMultiROIOrChannel, aBox, display=None)
interfacemethod setVisualBoxOfChannelFromLayoutGenealogicalName(aName, channel, aBox)

Sets the visual box of a Channel

Parameters:
interfacemethod setVisualBoxOfROIFromLayoutGenealogicalName(aName, aROIOrMultiROI, aBox)

Sets the visual box of a ROI or of a MultiROI

Parameters:

unstructuredGridHelper

class OrsHelpers.unstructuredGridHelper.UnstructuredGridHelper

Bases: object

Helper related to the manipulation of classes inheriting ORSModel.ors.UnstructuredGrid (namely, Mesh and Graph).

classmethod applyTransformToAllClipBoxParents(unstructuredGrid, aTransformationMatrix, iTIndex=0)
classmethod copy(anUnstructuredGrid)

Copies an UnstructuredGrid

Parameters:anUnstructuredGrid (ORSModel.ors.UnstructuredGrid) – the UnstructuredGrid to copy
Returns:newUnstructuredGrid (ORSModel.ors.UnstructuredGrid) – the copied UnstructuredGrid
classmethod copyAndPublish(anUnstructuredGrid)
classmethod createVisualFromModel(aModelUnstructuredGrid, layout=None, aScalarValueTypeTag='')

Creates the mesh object from the model structured object.

Parameters:
Returns:

visual (ORSModel.ors.Visual) – the visual object

classmethod fitToView(anUnstructuredGrid, view)
classmethod getClipBox(unstructuredGrid, viewOrTopFrame, forceCreation=False)
classmethod getClipBoxForCurrentView(structuredGrid, forceCreation=True, implementation=None)
classmethod getClipBoxes(unstructuredGrid)
classmethod getDisplayModelClass()
classmethod getIsEnabledIn2D(obj)
classmethod getIsEnabledIn3D(obj)
classmethod getIsVisible(anUnstructuredGrid, view)
classmethod getIsVisibleIn2D(anUnstructuredGrid, view)
Parameters:
Returns:

output (bool) – the 2D UnstructuredGrid visibility

classmethod getIsVisibleIn3D(anUnstructuredGrid, view)
Parameters:
Returns:

output (bool) – the 3D ROI visibility

classmethod getLUT(anUnstructuredGrid, aView=None, aScalarValueTypeTag='')
classmethod getLegend(aVisualOrModel, forceCreation=False, aScalarValueTypeTag='')
classmethod getLegendTitle(anUnstructuredGrid, aScalarValueTypeTag='')
classmethod getListOfDisplayRendering(anUnstructuredGrid)
classmethod getModel(obj)
classmethod getModelClass()
classmethod getOpacity(anUnstructuredGrid, view)
classmethod getUseDiscreteLegend(aVisualOrModel)
classmethod getVisual(obj, forceCreation=False)
classmethod getVisualModelClass()
classmethod getVisualReachableByDisplay(unstructuredGrid, display)
classmethod growVisualBoxForUnstructuredGridVisual(anUnstructureGrid, aBox)
classmethod isclose(a, b, rel_tol=1e-09, abs_tol=0.0)
classmethod mapAListOfScalarSlotFromAMultiROIToAnUnstructuredGrid(sourceUnstructuredGrid: ORSModel.ors.UnstructuredGrid, referenceMultiROI: ORSModel.ors.MultiROI, listOfSlotId, referenceMultiROITIndex, sourceUnstructuredGridITIndex, defaulfScalarValue=1.0)

Maps a list of scalar values from a reference multi ROI to an unstructured grid vertex scalar slot

Parameters:
  • sourceUnstructuredGrid (ORSModel.ors.UnstructuredGrid) – an unstructured grid
  • referenceMultiROI (ORSModel.ors.MultiROI) – a reference MultiROI
  • listOfSlotId (int) [count=[1, None]] – a list of scalar slots index to map
  • referenceMultiROITIndex (int) – the time step of the reference multiROI
  • sourceUnstructuredGridITIndex (int) – the time step of the unstructured grid
  • defaulfScalarValue (float) – A default value if no match is possible between a vertex and the Multi ROI label
Returns:

output (bool) – True if the mapping works, else False

classmethod mapDatasetValuesToAnUnstructuredGrid(sourceUnstructuredGrid: ORSModel.ors.UnstructuredGrid, referenceDataset, referenceDatasetTIndex, sourceUnstructuredGridTIndex, defaulfScalarValue=1.0, scalarValueTypeTag='Vertex Scalar Values')

Maps values from a dataset (reference), as vertex scalar values, to an unstructured grid (source)

Parameters:
  • sourceUnstructuredGrid (ORSModel.ors.UnstructuredGrid) – a source unstructured grid
  • referenceDataset (ORSModel.ors.Channel) – a reference dataset
  • referenceDatasetTIndex (int) – the time step of the reference dataset
  • sourceUnstructuredGridTIndex (int) – the time step of the source unstructured grid
  • defaulfScalarValue (float) – A default value if no match is possible between a vertex and the dataset
  • aScalarValueTypeTag (str) – an Id to know which legend update
Returns:

output (bool) – True if the mapping works, else False

classmethod refreshUnstructuredGridVisual(unstructuredGrid)
classmethod refreshVisual(unstructuredGrid)
classmethod resetVisualBox(unstructuredGrid, view=None)

Resets the visual box of an unstructured grid.

Parameters:
  • unstructuredGrid (ORSModel.ors.UnstructuredGrid) – the unstructured grid object to reset the visual box to
  • view (ORSModel.ors.View) – a specific display in which the visual box is attached to. If set as None, the first parent will be used.
classmethod resetVisualFrame(unstructuredGrid, display=None)
classmethod resetVisualFrameAndApplyRotation(unstructuredGrid, pivot, axis, angle, display=None)
classmethod resetVisualFrameAndApplyTranslation(unstructuredGrid, translation, display=None)
classmethod resetVisualFrameAndSetTransformation(unstructuredGrid, matrix, display=None)
classmethod resetVisualFrameWithBox(unstructuredGrid, box, display=None)
classmethod set2DOpacity(anUnstructuredGrid, view, opacity: float = None, opacityInRange: float = None, opacityOutRange: float = None)
classmethod set3DOpacity(anUnstructuredGrid, view, opacity: float = None, opacityInRange: float = None, opacityOutRange: float = None)
classmethod setClipBoxVisibility(unstructuredGrid, isVisible, view=None)

Sets the visibility of the clip box associated to an unstructured grid in the layout of the view

Parameters:
  • unstructuredGrid (ORSModel.ors.UnstructuredGrid) – the associated unstructuredGrid grid
  • isVisible (bool) – if True, the clip box will be set as visible; if False, the clip box will be hidden.
  • view (ORSModel.ors.View) – the view
classmethod setIsVisibleForViewFromLayoutGenealogicalName(aName, anUnstructuredGrid, isVisible)

Set view mode for Unstructured Grid

Deprecated since version 4.0.

Parameters:
classmethod setIsVisibleIn2D(anUnstructuredGrid, view, value)
Parameters:
classmethod setIsVisibleIn2DFromGenealogicalName(name, anUnstructuredGrid, isVisible)

Sets the visibility of an Unstructured grid in all 2D views of the given scene layout

Parameters:
  • name (str) – a genealogical name of a scene layout
  • anUnstructuredGrid (ORSModel.ors.UnstructuredGrid) – an UnstructuredGrid
  • isVisible (bool) – True to set as visible, False otherwise
classmethod setIsVisibleIn3D(anUnstructuredGrid, view, value)
Parameters:
classmethod setLUT(aModel, aLUT, aView=None, aScalarValueTypeTag='')

Set LUT for a View, if view is None, the lut will be set for all view

classmethod setOpacity(anUnstructuredGrid, opacity: float = None, opacityInRange: float = None, opacityOutRange: float = None, view=None)
classmethod setVisualBox(unstructuredGrid, aBox, view=None)

Resets the visual box of an unstructured grid.

Parameters:
classmethod updateColorFromVertexScalarValue(anUnstructuredGrid: ORSModel.ors.UnstructuredGrid, forceToRefresh=False, aScalarValueTypeTag='', iTIndex=0)
classmethod updateLegend(anUnstructuredGrid, display=None, ITopFrame=None, aScalarValueTypeTag='')
classmethod updateModelColor(anUnstructureGrid)

unstructuredGridLogger

class OrsHelpers.unstructuredGridLogger.UnstructuredGridLogger

Bases: OrsHelpers.abstractLogger.AbstractLogger

Helper related to the visibility of classes inheriting ORSModel.ors.UnstructuredGrid (Mesh, Graph and vector field).

classmethod getClassHelper(anUnstructuredGrid)
interfacemethod resetVisualBoxOfMeshFromLayoutGenealogicalName(aName, mesh)

Resets the visual box of a Mesh

Deprecated since version 4.0.

Parameters:
interfacemethod resetVisualBoxOfUnstrucuredGridFromLayoutGenealogicalName(aName, anUnstructuredGrid, iTIndex=0)

Resets the visual box of a Mesh

Parameters:
  • aName (str) – a genealogical name
  • anUnstructuredGrid (ORSModel.ors.UnstructuredGrid) – an unstructured grid
  • iTIndex (int) – current time step
classmethod setClipBoxVisibilityOfMesh(mesh, isVisible, view=None)

Deprecated since version 4.0.

interfacemethod setClipBoxVisibilityOfMeshFromLayoutGenealogicalName(aName, mesh, isVisible)

Sets the visual box visibility of a Mesh

Deprecated since version 4.0.

Parameters:
  • aName (str) – a genealogical name
  • mesh (ORSModel.ors.Mesh) – a Mesh
  • isVisible (bool) – if True, the clip box will be set as visible; if False, the clip box will be hidden.
classmethod setClipBoxVisibilityOfUnstructuredGrid(anUnstructuredGrid, isVisible, view=None)
interfacemethod setClipBoxVisibilityOfUnstructuredGridFromLayoutGenealogicalName(aName, anUnstructuredGrid, isVisible)

Sets the visual box visibility of an anUnstructuredGrid

Parameters:
  • aName (str) – a genealogical name
  • anUnstructuredGrid (ORSModel.ors.UnstructuredGrid) – an unstructured grid
  • isVisible (bool) – if True, the clip box will be set as visible; if False, the clip box will be hidden.
classmethod setVisualBoxOfMesh(mesh, aBox, display=None)

Deprecated since version 4.0.

interfacemethod setVisualBoxOfMeshFromLayoutGenealogicalName(aName, mesh, aBox)

Sets the visual box of a Mesh

Deprecated since version 4.0.

Parameters:
classmethod setVisualBoxOfUnstructuredGrid(anUnstucturedGrid, aBox, display=None, iTIndex=0, reset=False)
interfacemethod setVisualBoxOfUnstructuredGridFromLayoutGenealogicalName(aName, anUnstructuredGrid, aBox)

Sets the visual box of an unstructured grid

Parameters:

vectorfieldhelper

class OrsHelpers.vectorfieldhelper.VectorFieldHelper

Bases: OrsHelpers.unstructuredGridHelper.UnstructuredGridHelper

Helper related to the class ORSModel.ors.VectorField.

interfacemethod copy(aVectorField)

Copies a Vector Field

Parameters:aVectorField (ORSModel.ors.VectorField) – the Vector Field to copy
Returns:newVectorField (ORSModel.ors.VectorField) – the copied vector field
interfacemethod copyVectorField(aVectorField)

Copies a vector field

Parameters:aVectorField (ORSModel.ors.VectorField) – the vector field to copy
Returns:newVectorField (ORSModel.ors.VectorField) – the copied vector field
classmethod copyVectorFieldAndPublish(aVectorField)
classmethod createVisualVectorFieldFromVectorField(vectorField, layout=None)

Creates the vector field visual object from the vectorField model object.

Parameters:
Returns:

visualVectorField (ORSModel.ors.VisualVectorField) – the vector field visual object

classmethod getDisplayModelClass()
classmethod getIsEnabledIn2D(obj)
classmethod getIsEnabledIn3D(obj)
classmethod getLegendTitle(aVectorField, aScalarValueTypeTag='')
classmethod getModelClass()
classmethod getVisualModelClass()
classmethod growVisualBoxForUnstructuredGridVisual(aVectorField, aBox)
interfacemethod setIsVisibleForViewFromLayoutGenealogicalName(aName, aVectorField, isVisible)

Set view mode for vector Field

Deprecated since version 4.0.

Parameters:
  • aName (str) – a genealogical name
  • aVectorField (ORSModel.ors.VectorField) – a Vector Field
  • isVisible (bool) – visibility
interfacemethod setIsVisibleIn2DFromGenealogicalName(name, aVectorField, isVisible)

Sets the visibility of a vector field in all 2D views of the given scene layout

Parameters:
  • name (str) – a genealogical name of a scene layout
  • aVectorField (ORSModel.ors.VectorField) – a Vector Field
  • isVisible (bool) – True to set as visible, False otherwise
classmethod setShowArrowHead(vectorField, showArrowHead, view, logging=False)
interfacemethod setShowArrowHeadFromGenealogicalName(vectorField, showArrowHead, viewName)

Shows or hide the arrow head of the vectors

The visual vector field should exist.

Parameters:
  • vectorField (ORSModel.ors.VectorField) – a vectorField
  • showArrowHead (bool) – True to show the arrow head, False to hide it
  • viewName (str) – a genealogical name of a scene layout
classmethod setUseDirectionAsColor(vectorField, useDirectionAsColor, view, logging=False)
interfacemethod setUseDirectionAsColorFromGenealogicalName(vectorField, useDirectionAsColor, viewName)

Switches the color setting to use the direction as color or not

The visual vector field should exist.

Parameters:
  • vectorField (ORSModel.ors.VectorField) – a vectorField
  • useDirectionAsColor (bool) – True to color the vectors using their direction, False to use a LUT
  • viewName (str) – a genealogical name of a scene layout

viewhelper

class OrsHelpers.viewhelper.ViewHelper

Bases: object

Helper related to the class ORSModel.ors.View.

classmethod applyRotationInDegree(display, degree, logging=True)
classmethod applyRotationInRadian(display, radian, logging=True)
classmethod copyViewSettings(source: ORSModel.ors.View, destination: ORSModel.ors.View)
classmethod flipViewHorizontally(display, logging=True)
classmethod flipViewVertically(display, logging=True)
classmethod getCursor3DForView(display)
classmethod refreshAllViewsOfSameGroupAs(display, d2D=False, d3D=False)

viewLayoutHelper

class OrsHelpers.viewLayoutHelper.DisplayLayoutHelper

Bases: object

Helper related to the layouts (disposition of the views).

classmethod copyVisibilityStatesOfVisualInView(oldDisplay, newDisplay)
classmethod fitBoxInAllViewsOfLayout(layout, box, logging=True)
classmethod fitBoxInLayoutOfView(display, box)
classmethod fitVisualInAllViewsOfLayout(layout, visual)
classmethod fitVisualInLayoutOfView(display, visual)
classmethod get3DCursorForLayout(layout)
classmethod get3DCursorForView(display)
classmethod get3DCursorPositionForView(display)
classmethod getAll2DNonPlanarViewsInLayout(layout)
classmethod getAll2DPlanarViewsInLayout(layout)
classmethod getAll2DViewsInLayout(layout)
classmethod getAll2DViewsOfLayoutOfView(display)
classmethod getAll3DViewsInLayout(layout)
classmethod getAll3DViewsOfLayoutOfView(display)
classmethod getAllOther2DPlanarViewsInLayoutOfView(display)
classmethod getAllOther2DViewsInLayoutOfView(display)
classmethod getAllOther3DViewsInLayoutOfView(display)
classmethod getAllOtherViewsOfLayoutOfView(display)
classmethod getAllViewsOfLayoutOfView(display)
classmethod getExistsVisible2DViewInLayoutOfView(display)
classmethod getGridForLayout(layout)
classmethod getGridForView(display)
classmethod getIsSceneEmpty(aView)

Gets to know if a scene is empty.

Parameters:aView (ORSModel.ors.View) – a view
Returns:output (bool) – True if the scene is considered empty; False otherwise.
classmethod getOrsQtLayoutPluginInstanceForView(IDisplay)
classmethod getScaleBarForLayout(layout)
classmethod getScaleBarForView(display)
classmethod getTopFrameForLayout(layout)
classmethod getTopFrameForView(display)
classmethod move2DLayoutOfViewToIncludePoint(display, worldposition, center=False, logging=True)
classmethod move2DViewOfLayoutToIncludePoint(layout, worldposition, center=False, logging=True)
classmethod move3DLayoutOfViewToIncludePoint(display, worldposition, center=False, logging=True)
classmethod move3DViewOfLayoutToIncludePoint(layout, worldposition, center=False, logging=True)
classmethod refreshAll2DViewsOfLayout(layout)
classmethod refreshAll2DViewsOfLayoutOfView(display)
classmethod refreshAll3DViewsOfLayoutOfView(display)
classmethod refreshAllOtherViewsOfLayoutOfView(display)
classmethod refreshAllViewsOfLayoutOfView(display)
classmethod reset3DCursorOfLayout(layout)
static setTopFrameForAllViewsOfLayout(layout, topFrame)

viewLogger

class OrsHelpers.viewLogger.ViewLogger

Bases: OrsHelpers.abstractLogger.AbstractLogger

Helper related to the class ORSModel.ors.View.

classmethod fitBoundedPlaneInView(view, rectangle)
interfacemethod fitBoundedPlaneInViewFromLayoutGenealogicalName(aName, rectangle)

Fit Rectangle in View

Parameters:
classmethod fitBoxInView(view, box)
interfacemethod fitBoxInViewFromLayoutGenealogicalName(aName, box)

Fit box in View

Parameters:
interfacemethod setCameraFromLayoutGenealogicalName(aName, camera)

Sets the camera of the view based on the fullname of the view layout

Parameters:
classmethod setCameraView(view, camera)
classmethod setProjectionMode2D(view, projectionMode)
interfacemethod setProjectionMode2DFromLayoutGenealogicalName(aName, projectionMode)

Set view mode

Parameters:
  • aName (str) – a genealogical name
  • projectionMode (IntEnum CxvVolumeProjection_Mode) – a viewMode
classmethod setViewMode(view, viewMode)
interfacemethod setViewModeFromLayoutGenealogicalName(aName, viewMode)

Set view mode

Parameters:
  • aName (str) – a genealogical name
  • viewMode (IntEnum CxvView_Mode) – a viewMode
classmethod setViewOrientedPlane(view, orientedPlane, thickness)
interfacemethod setViewOrientedPlaneFromLayoutGenealogicalName(aName, orientedPlane, thickness)

Sets the view oriented plane from genealogical name

Parameters:
  • aName (str) – a genealogical name
  • orientedPlane (ORSModel.ors.OrientedPlane) – the view futur oriented plane
  • thickness (float) – a thickness in meter
classmethod setViewOrientedPlaneWithBox(view, orientedPlane, box)
interfacemethod setViewOrientedPlaneWithBoxFromLayoutGenealogicalName(aName, orientedPlane, box)

Sets the view orientation from box

Parameters:
classmethod setViewOrthoZoomFactor(view, zoomFactor)
interfacemethod setViewOrthoZoomFactorFromLayoutGenealogicalName(aName, zoomFactor)

Sets the view ortho zoom factor

Parameters:
  • aName (str) – a genealogical name
  • zoomFactor (float) – a zoom factor
classmethod setViewPlanePosition(view, point, center)
interfacemethod setViewPlanePositionFromLayoutGenealogicalName(aName, point, center)

Sets the view plane position from genealogical name

Parameters:
  • aName (str) – a genealogical name
  • point (ORSModel.ors.Vector3) – a point
  • center (bool) – should the point be the center of the view
classmethod setViewSlabThickness(view, thickness)
interfacemethod setViewSlabThicknessFromLayoutGenealogicalName(aName, thickness)

Sets the view plane position from genealogical name

Parameters:
  • aName (str) – a genealogical name
  • thickness (float) – a thickness in meter
classmethod setViewSliceIndexOfBox(view, box, sliceIndex)
interfacemethod setViewSliceIndexOfBoxFromLayoutGenealogicalName(aName, box, sliceIndex)

Sets the view plane position at box index from genealogical name

Parameters:
  • aName (str) – a genealogical name
  • box (ORSModel.ors.Box) – a box
  • sliceIndex (float) – a slice index

visualboxhelper

class OrsHelpers.visualboxhelper.VisualBoxHelper

Bases: object

Helper for manipulation of instances of VisualBox

interfacemethod alignBoxWithDirection(aVisualBox, aDirection, timestep)

Aligns the direction0 of the VisualBox with the provided direction

Parameters:
interfacemethod createVisualBoxFromBox(aBox)

Creates a new VisualBox in the limits of the provided box

Parameters:aBox (ORSModel.ors.Box) – a box
Returns:aVisualBox (ORSModel.ors.VisualBox) – new VisualBox
interfacemethod moveFaceSoThatDirectionHasSize(aVisualBox, movingFaceIndex, newSize, timestep)

Moves a face of a VisualBox to adapt the size of the VisualBox in that direction.

Parameters:
  • aVisualBox (ORSModel.ors.VisualBox) – a VisualBox
  • movingFaceIndex (int) – moving face index 0: Face normal in direction2, containing the origin 1: Face normal in direction2, not containing the origin 2: Face normal in direction1, containing the origin 3: Face normal in direction1, not containing the origin 4: Face normal in direction0, containing the origin 5: Face normal in direction0, not containing the origin
  • newSize (float) – the new direction size (should be > 0)
  • timestep (int) – the time index
interfacemethod rotateAroundFaceCenter(aVisualBox, rotationAxis, movingFaceIndex, pointToAlignMovingFaceCenter, timestep)

Sets the location of the center of a face of a VisualBox (keeping the opposite face center fixed). This is done by rotating the box around the provided axis and resizing along the direction of the moving face (from the fixed face) to align the center of the moving face with the provided point in the direction of the rotation axis.

Parameters:
  • aVisualBox (ORSModel.ors.VisualBox) – a VisualBox
  • rotationAxis (ORSModel.ors.Vector3) – rotation axis
  • movingFaceIndex (int) – moving face index 0: Face normal in direction2, containing the origin 1: Face normal in direction2, not containing the origin 2: Face normal in direction1, containing the origin 3: Face normal in direction1, not containing the origin 4: Face normal in direction0, containing the origin 5: Face normal in direction0, not containing the origin
  • pointToAlignMovingFaceCenter (ORSModel.ors.Vector3) – point to align the moving face center with (in direction of rotationAxis)
  • timestep (int) – the time index
interfacemethod setBox(aVisualBox, box, timestep)

Sets the box of a VisualBox

Parameters:
interfacemethod setCenter(aVisualBox, center, timestep)

Sets the location of the center of a VisualBox

Parameters:
interfacemethod setDirection0Size(aVisualBox, direction0Size, timestep)

Sets the size of the direction0 of a VisualBox (keeping the same center)

Parameters:
  • aVisualBox (ORSModel.ors.VisualBox) – a VisualBox
  • direction0Size (float) – the new direction0 size
  • timestep (int) – the time index
interfacemethod setDirection1Size(aVisualBox, direction1Size, timestep)

Sets the size of the direction1 of a VisualBox (keeping the same center)

Parameters:
  • aVisualBox (ORSModel.ors.VisualBox) – a VisualBox
  • direction1Size (float) – the new direction1 size
  • timestep (int) – the time index
interfacemethod setDirection2Size(aVisualBox, direction2Size, timestep)

Sets the size of the direction2 of a VisualBox (keeping the same center)

Parameters:
  • aVisualBox (ORSModel.ors.VisualBox) – a VisualBox
  • direction2Size (float) – the new direction2 size
  • timestep (int) – the time index
interfacemethod setFaceCenter(aVisualBox, faceIndex, faceCenter, timestep)

Sets the location of the center of a face of a VisualBox (keeping the opposite face center fixed). This is done by rotating the box around the axis normal to the plane formed by: - the opposite face center; - the old face center; - the new face center.

Parameters:
  • aVisualBox (ORSModel.ors.VisualBox) – a VisualBox
  • faceIndex (int) – moving face index 0: Face normal in direction2, containing the origin 1: Face normal in direction2, not containing the origin 2: Face normal in direction1, containing the origin 3: Face normal in direction1, not containing the origin 4: Face normal in direction0, containing the origin 5: Face normal in direction0, not containing the origin
  • faceCenter (ORSModel.ors.Vector3) – the new face center
  • timestep (int) – the time index

visualcapsulehelper

class OrsHelpers.visualcapsulehelper.VisualCapsuleHelper

Bases: object

Helper for manipulation of instances of VisualCapsule

interfacemethod alignCapsuleWithDirection(aVisualCapsule, aDirection, timestep)

Aligns the main axis of the VisualCapsule with the provided direction

Parameters:
interfacemethod createVisualCapsuleFromBox(aBox)

Creates a new VisualCapsule in the limits of the provided box

Parameters:aBox (ORSModel.ors.Box) – a box
Returns:aVisualCapsule (ORSModel.ors.VisualCapsule) – new VisualCapsule
interfacemethod setCap1Center(aVisualCapsule, cap1Center, timestep)

Sets the location of the center of the first cap of a VisualCapsule (keeping the second cap fixed)

Parameters:
interfacemethod setCap2Center(aVisualCapsule, cap2Center, timestep)

Sets the location of the center of the second cap of a VisualCapsule (keeping the first cap fixed)

Parameters:
interfacemethod setCapsule(aVisualCapsule, capsule, timestep)

Sets the capsule of a VisualCapsule

Parameters:
interfacemethod setCenter(aVisualCapsule, center, timestep)

Sets the location of the center of a VisualCapsule

Parameters:
interfacemethod setHeight(aVisualCapsule, height, timestep)

Sets the height of a VisualCapsule (keeping the same center)

Parameters:
  • aVisualCapsule (ORSModel.ors.VisualCapsule) – a VisualCapsule
  • height (float) – the new height
  • timestep (int) – the time index
interfacemethod setHeightMovingSingleCap(aVisualCapsule, cap2IsMoving, height, timestep)

Sets the height of a VisualCapsule (keeping a cap fixed)

Parameters:
  • aVisualCapsule (ORSModel.ors.VisualCapsule) – a VisualCapsule
  • cap2IsMoving (bool) – if True, the first cap is fixed and the second cap is moved. If False, the second cap is fixed and the first cap is moved.
  • height (float) – the new height
  • timestep (int) – the time index
interfacemethod setRadius(aVisualCapsule, radius, timestep)

Sets the radius of a VisualCapsule

Parameters:
  • aVisualCapsule (ORSModel.ors.VisualCapsule) – a VisualCapsule
  • radius (float) – the new radius
  • timestep (int) – the time index

visualChannelLogger

class OrsHelpers.visualChannelLogger.VisualChannelLogger

Bases: OrsHelpers.datasetPresenterLogger.DatasetPresenterLogger

Helper related to the visual state of Channels.

visualColorBarLogger

class OrsHelpers.visualColorBarLogger.VisualColorBarLogger

Bases: OrsHelpers.visualLogger.VisualLogger

Helper related to the visual state of ColorBars.

classmethod setCanBeVisibleForView(visualColorBar, view, value)
interfacemethod setCanBeVisibleForViewFromLayoutGenealogicalName(aName, parentNode, value)

Sets the visibility of a Visual color bar

Parameters:
classmethod setLookupTableForView(visualColorBar, view, lut)
interfacemethod setLookupTableForViewFromLayoutGenealogicalName(aName, parentNode, lutUUID)

Sets the lookup table of a visual color bar

Parameters:

visualcylinderhelper

class OrsHelpers.visualcylinderhelper.VisualCylinderHelper

Bases: object

Helper for manipulation of instances of VisualCylinder

interfacemethod alignCylinderWithDirection(aVisualCylinder, aDirection, timestep)

Aligns the main axis of the VisualCylinder with the provided direction

Parameters:
interfacemethod createVisualCylinderFromBox(aBox)

Creates a new VisualCylinder in the limits of the provided box

Parameters:aBox (ORSModel.ors.Box) – a box
Returns:aVisualCylinder (ORSModel.ors.VisualCylinder) – new VisualCylinder
interfacemethod setCap1Center(aVisualCylinder, cap1Center, timestep)

Sets the location of the center of the first cap of a VisualCylinder (keeping the second cap fixed)

Parameters:
interfacemethod setCap2Center(aVisualCylinder, cap2Center, timestep)

Sets the location of the center of the second cap of a VisualCylinder (keeping the first cap fixed)

Parameters:
interfacemethod setCenter(aVisualCylinder, center, timestep)

Sets the location of the center of a VisualCylinder

Parameters:
interfacemethod setCylinder(aVisualCylinder, cylinder, timestep)

Sets the cylinder of a VisualCylinder

Parameters:
interfacemethod setHeight(aVisualCylinder, height, timestep)

Sets the height of a VisualCylinder (keeping the same center)

Parameters:
  • aVisualCylinder (ORSModel.ors.VisualCylinder) – a VisualCylinder
  • height (float) – the new height
  • timestep (int) – the time index
interfacemethod setHeightMovingSingleCap(aVisualCylinder, cap2IsMoving, height, timestep)

Sets the height of a VisualCylinder (keeping a cap fixed)

Parameters:
  • aVisualCylinder (ORSModel.ors.VisualCylinder) – a VisualCylinder
  • cap2IsMoving (bool) – if True, the first cap is fixed and the second cap is moved. If False, the second cap is fixed and the first cap is moved.
  • height (float) – the new height
  • timestep (int) – the time index
interfacemethod setRadius(aVisualCylinder, radius, timestep)

Sets the radius of a VisualCylinder

Parameters:
  • aVisualCylinder (ORSModel.ors.VisualCylinder) – a VisualCylinder
  • radius (float) – the new radius
  • timestep (int) – the time index

visualLogger

class OrsHelpers.visualLogger.VisualLogger

Bases: OrsHelpers.abstractLogger.AbstractLogger

Helper related to generic visuals.

visualspherehelper

class OrsHelpers.visualspherehelper.VisualSphereHelper

Bases: object

Helper for manipulation of instances of VisualSphere

interfacemethod createVisualSphereFromBox(aBox)

Creates a new VisualSphere in the limits of the provided box

Parameters:aBox (ORSModel.ors.Box) – a box
Returns:aVisualSphere (ORSModel.ors.VisualSphere) – new VisualSphere
interfacemethod setCenter(aVisualSphere, center, timestep)

Sets the location of the center of a VisualSphere

Parameters:
interfacemethod setRadius(aVisualSphere, radius, timestep)

Sets the radius of a VisualSphere

Parameters:
  • aVisualSphere (ORSModel.ors.VisualSphere) – a VisualSphere
  • radius (float) – the new radius
  • timestep (int) – the time index
interfacemethod setSphere(aVisualSphere, sphere, timestep)

Sets the sphere of a VisualSphere

Parameters:

volumehelper

class OrsHelpers.volumehelper.VolumeHelper

Bases: object

Helper related to the class ORSModel.ors.VisualChannel.

classmethod addWindowLevelingCallbacksOnVisualColorBar(legend=None)
interfacemethod applyDefaultLeveling(dataset)

Applies the default window leveling on a visual associated to a dataset

Parameters:dataset (ORSModel.ors.Channel) – a channel from which the leveling will be obtained
classmethod attachVolumesToTopFrame(IVol, ITopFrame)
classmethod createVolumeForChannel(aChannel0, aChannel1=None, aChannel2=None, aChannel3=None, layout=None)

Creates a volume from a set of channels

Parameters:
Returns:
classmethod detachVisualsFromTopFrame(topFrameGuid)
classmethod detachVolumesFromTopFrame(volGuid, topFrameGuid)
classmethod getSecondLevelingStatus(dataset)

Gets the second leveling enabled state of a visual associated to a dataset.

Parameters:dataset (ORSModel.ors.Channel) – associated channel to the visual
leveling3D_callbacks = {}
leveling_callbacks = {}
classmethod removeWindowLevelingCallbacksOnVisualColorBar(legend=None)
interfacemethod reset2DWindowLevel2Range(dataset)

Resets the range of the second leveling of a visual associated to a dataset

Parameters:dataset (ORSModel.ors.Channel) – associated channel to the visual to set the range on
interfacemethod set2DWindowLevel2Range(dataset, rangeMinInPhysicalUnits, rangeMaxInPhysicalUnits)

Sets the range of the second leveling of a visual associated to a dataset

Parameters:
  • dataset (ORSModel.ors.Channel) – associated channel to the visual to set the range on
  • rangeMinInPhysicalUnits (float) – minimal value of the range
  • rangeMaxInPhysicalUnits (float) – maximal value of the range
interfacemethod setSecondLevelingStatus(dataset, isEnabled)

Enables or disables the second leveling of a visual associated to a dataset.

Parameters:
  • dataset (ORSModel.ors.Channel) – associated channel to the visual
  • isEnabled (bool) – specify if the range should be enabled
static updateLegendRange(aLegend, leveling3D)

vtkhelpers

class OrsHelpers.vtkhelpers.VtkPolyDataToFromOrsMeshHelper

Bases: object

SCALAR_NAME_DELIMITER = '%?\n&#'
classmethod vtkPolyData_From_OrsMesh(inputOrsMesh, currentTimeStep, includeScalar=False, includeNormal=False, vertexXScaleFactor=1.0, vertexYScaleFactor=1.0, vertexZScaleFactor=1.0, progress=None)
classmethod vtkPolyData_To_OrsMesh(inputVtkPolyData, iOutputOrsMesh, currentTimeStep, includeScalar=False, vertexXScaleFactor=1.0, vertexYScaleFactor=1.0, vertexZScaleFactor=1.0, progress=None)

watershedhelper

class OrsHelpers.watershedhelper.WatershedHelper

Bases: object

Helper for performing a watershed (segmentation algorithm).

classmethod watershedFromAChannelLabeled(edgeMap, tStepEdgeMap, labelChannelIn, labelChannelOut, neighboorCount=6, ROIMask=None, IProgress=None, progressBarId=79)
classmethod watershedFromALabeledMultiROI(edgeMap, tStepEdgeMap, LMRInput, LMROutput, neighboorCount=6, ROIMask=None, IProgress=None, progressBarId=79)
classmethod watershedFromAListOfROI(edgeMap, tStepEdgeMap, aListOfROI, tStepROI, neighboorCount=6, ROIMask=None, IProgress=None, progressBarId=79)