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.

abstractSelectedObjectHelper

class OrsHelpers.abstractSelectedObjectHelper.AbstractSelectedObjectHelper

Bases: object

Helper related to the objects in the selection.

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

Bases: object

Helper for manipulating ORS arrays with Numpy.

static ConvertNumpyToOrsArray(np_array)

Convert numpy.ndarray to Ors array

Parameters:

np_array (numpy.ndarray) – The input numpy array to copy

Returns:

output (OrsArray) – The output OrsArray copy

static ConvertOrsToNumpyArray(ors_array, copy=False)

Convert Ors array to numpy.ndarray

Parameters:
  • ors_array (OrsArray) – The input OrsArray to copy

  • copy (bool) – If true, a copy is returned, otherwise it’s the same data

Returns:

output (numpy.ndarray) – The numpy array

static getEmptyOrsArrayForScalarDataType(scalarDataType, size)

Get a new Ors array of same type of orsArray

Parameters:
  • scalarDataType (int) – The scalar data type of the new array

  • size (int) – size of the new array

Returns:

output (newOrsArray:OrsArray) – The new OrsArray

static getEmptyOrsArrayOfSameType(orsArray, size=None)

Get a new Ors array of same type of orsArray

Parameters:
  • orsArray (OrsArray) – The input OrsArray to copy

  • size (int) – size of the new array

Returns:

output (newOrsArray:OrsArray) – The new OrsArray

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

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 createBinaryDatasetFromROI(aROI, labeledValue=255, IProgress=None)

Creates a new dataset where the value at each pixel is 0 or a given value if that pixel is in the ROI

Parameters:
Returns:

dataset (ORSModel.ors.Channel) – new 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

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

classmethod setIsVisibleIn3D(dataset, view, value)
Parameters:
interfacemethod setIsVisibleIn3DFromGenealogicalName(name, dataset, isVisible)

Sets the visibility of a dataset in 3D 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: 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

discretecolorsequence

class OrsHelpers.discretecolorsequence.DiscreteColorSequence

Bases: object

Iterator on colors.

displayDatasetInLayout

class OrsHelpers.displayDatasetInLayout.DisplayDatasetInLayout

Bases: object

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

displayGraph

class OrsHelpers.displayGraph.DisplayGraph

Bases: object

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

displaymesh

class OrsHelpers.displaymesh.DisplayMesh

Bases: object

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

displayROI

class OrsHelpers.displayROI.DisplayROI

Bases: object

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

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.

distancemaphelper

class OrsHelpers.distancemaphelper.DistanceMapHelper

Bases: object

Helper for computing distance maps.

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

formatHelper

class OrsHelpers.formatHelper.FormatHelper

Bases: object

Helper for formatting (and centralizing).

gpuhelper

class OrsHelpers.gpuhelper.GPUHelper

Bases: object

classmethod getAvailableVideoMemory()
Returns:

output – an OrsVector containing the new x,y,z values

classmethod getTotalVideoMemory()
Returns:

output – an OrsVector containing the new x,y,z values

graphhelper

class OrsHelpers.graphhelper.GraphHelper

Bases: 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 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 mapDatasetValuesToAnUnstructuredGrid(sourceGraph: Graph, referenceChannel, referenceChannelTIndex, sourceGraphTIndex, slotDescription='', 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

  • slotDescription (str) – description of the measurement to be added

  • 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

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 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.

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

layoutHelper

class OrsHelpers.layoutHelper.LayoutHelper

Bases: object

Helper for manipulating layouts.

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

get2DLUT(aVisual, layout, aScalarValueTypeTag='')

Gets the LUT currently used in the layout for the 2D views. For MultiROI, it gets the LUT used in all views. That LUT can be modified.

get3DLUT(aVisual, layout, aScalarValueTypeTag='')

Gets the LUT currently used in the layout for the 3D views. For MultiROI, it gets the LUT used in all views. That LUT can be modified.

classmethod get2DLUT(layout, anObjectVisual, aScalarValueTypeTag='', logging=False)

Gets the LUT used in 2D for the provided layout and object

interfacemethod get2DLUTFromGenealogicalName(layoutFullName, anObject, aScalarValueTypeTag='')

Gets the LUT used in 2D for the provided layout and object

Parameters:
Returns:

output (ORSModel.ors.LookupTable) – the 2D LUT used in the layout for the provided object

classmethod get2DLUTSource(layout, anObjectVisual, aScalarValueTypeTag='')

Gets the LUT corresponding to the last UUID provided as source LUT of the 2D LUT of an object in layout

Parameters:
Returns:

aLUT (ORSModel.ors.LookupTable) – the LUT corresponding to the last UUID provided as source

classmethod get3DLUT(layout, anObjectVisual, aScalarValueTypeTag='', logging=False)

Gets the LUT used in 3D for the provided layout and object

interfacemethod get3DLUTFromGenealogicalName(layoutFullName, anObject, aScalarValueTypeTag='')

Gets the LUT used in 3D for the provided layout and object

Parameters:
Returns:

output (ORSModel.ors.LookupTable) – the 3D LUT used in the layout for the provided object

classmethod get3DLUTSource(layout, anObjectVisual, aScalarValueTypeTag='')

Gets the LUT corresponding to the last UUID provided as source LUT of the 3D LUT of an object in layout

Parameters:
Returns:

aLUT (ORSModel.ors.LookupTable) – the LUT corresponding to the last UUID provided as source

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

interfacemethod set2DBackgroundColorFromGenealogicalName(layoutFullName, color)

Set show text annotation in layout

Parameters:
interfacemethod set2DLUTAsLUTFromGenealogicalName(layoutFullName, anObject, aSourceLUT, aScalarValueTypeTag='')

Copies the color contents of a source LUT in the 2D LUT of an object in layout. The source LUT UUID of the layout properties is NOT modified.

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

Copies the color contents of a source LUT in the 2D LUT of an object in layout. The source LUT UUID of the layout properties is updated with this new LUT UUID.

Parameters:
interfacemethod set3DLUTAsLUTFromGenealogicalName(layoutFullName, anObject, aSourceLUT, aScalarValueTypeTag='')

Copies the color contents of a source LUT in the 3D LUT of an object in layout. The source LUT UUID of the layout properties is NOT modified.

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

Copies the color contents of a source LUT in the 3D LUT of an object in layout. The source LUT UUID of the layout properties is updated with this new LUT UUID.

Parameters:
interfacemethod setColorRangeMode2DFromGenealogicalName(layoutFullName, dataset, colorRangeMode)

Sets the VisualChannel 2D color range mode in layout

Parameters:
  • layoutFullName (str) – a genealogical name

  • dataset (ORSModel.ors.Channel) – a dataset

  • colorRangeMode (IntEnum CxvColorRange_Mode) – new color range mode

interfacemethod setColorRangeMode3DFromGenealogicalName(layoutFullName, dataset, colorRangeMode)

Sets the VisualChannel 3D color range mode in layout

Parameters:
  • layoutFullName (str) – a genealogical name

  • dataset (ORSModel.ors.Channel) – a dataset

  • colorRangeMode (IntEnum CxvColorRange_Mode) – new color range mode

interfacemethod setContourThicknessFromGenealogicalName(layoutFullName, anObject, thickness)

Set contour thickness of ROI/MultiROI in layout

Parameters:
interfacemethod setCurrentTimeStepFromGenealogicalName(layoutFullName, time_step)

Change time step in layout

Parameters:
  • layoutFullName (str) – a genealogical name

  • time_step (int) – new time step

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

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

interfacemethod setLODEnabled2DFromGenealogicalName(layoutFullName, isLODEnabled2D)

Set the enabled LOD flag for 2D views in layout

Parameters:
  • layoutFullName (str) – a genealogical name

  • isLODEnabled2D (bool) – a flag

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

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

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

interfacemethod setOpacityMode2DFromGenealogicalName(layoutFullName, dataset, opacityMode)

Sets the VisualChannel 2D opacity mode in layout

Parameters:
  • layoutFullName (str) – a genealogical name

  • dataset (ORSModel.ors.Channel) – a dataset

  • opacityMode (IntEnum CxvOpacity_Mode) – new opacity mode

interfacemethod setOpacityMode3DFromGenealogicalName(layoutFullName, dataset, opacityMode)

Sets the VisualChannel 3D opacity mode in layout

Parameters:
  • layoutFullName (str) – a genealogical name

  • dataset (ORSModel.ors.Channel) – a dataset

  • opacityMode (IntEnum CxvOpacity_Mode) – new opacity mode

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

interfacemethod setShapeThicknessFromGenealogicalName(layoutFullName, visual, thickness)

Set contour thickness of a VisualShape in a layout

Parameters:
  • layoutFullName (str) – a genealogical name

  • visual (ORSModel.ors.VisualShape) – a VisualShape

  • thickness (float) – the line thickness of the Shape

interfacemethod setShowContourFromGenealogicalName(layoutFullName, anObject, showContour)

Set show contour of ROI/MultiROI in layout

Parameters:
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

interfacemethod setShowScaleBarFromGenealogicalName(layoutFullName, showScaleBar)

Set show text annotation in layout

Parameters:
  • layoutFullName (str) – a genealogical name

  • showScaleBar (bool) – a flag

interfacemethod setShowTextAnnotationFromGenealogicalName(layoutFullName, showTextAnnotation)

Set show text annotation in layout

Parameters:
  • layoutFullName (str) – a genealogical name

  • showTextAnnotation (bool) – a flag

interfacemethod setUnitFromGenealogicalName(layoutFullName, unit_type, aDimensionUnit=None, unitId=None)

Set unit in layout

Changed in version Using: a DimensionUnit instance instead of a CxvUniverse_Dimension IntEnum

Parameters:
  • layoutFullName (str) – a genealogical name

  • unit_type (IntEnum CxvUniverse_Dimension_Type) – an unit type

  • aDimensionUnit (ORSModel.ors.DimensionUnit) – a DimensionUnit

  • unitId (IntEnum CxvUniverse_Dimension) [deprecated: use aDimensionUnit instead] – an unit id

interfacemethod setUse2DLUTAlphaFromGenealogicalName(layoutFullName, dataset, value)

Set VisualChannel 3D window/level in layout

Deprecated since version 2021.3: Use setOpacityMode2DFromGenealogicalName

Parameters:
  • layoutFullName (str) – a genealogical name

  • dataset (ORSModel.ors.Channel) – a dataset

  • value (bool) – a value

classmethod setWindowLevel2D(layout, anObject, width, center, logging=False)

Sets the dataset 2D window/level in layout

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

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

legendLogic

class OrsHelpers.legendLogic.LegendLogic

Bases: object

Helper related to the class ORSModel.ors.VisualLegend.

ListHelper

class OrsHelpers.ListHelper.ListHelper

Bases: object

Helper for manipulating Python lists and ORS lists.

luthelper

class OrsHelpers.luthelper.LUTHelper

Bases: object

Helper related to the class ORSModel.ors.LookupTable.

classmethod deleteSourceLUT(aSourceLUT)

Deletes a source LUT instance

Parameters:

aSourceLUT (ORSModel.ors.LookupTable) – LUT associated to a Python LUT definition file

classmethod deleteSourceLUTDefinitionFile(aSourceLUT)

Deletes a Python LUT definition file

Parameters:

aSourceLUT (ORSModel.ors.LookupTable) – LUT associated to a Python LUT definition file

Returns:
  • errorMessage (str) – error message, if the deletion cannot be completed. This string is empty if the deletion is successful.

  • lutPathToDelete (file) – LUT path found for the provided source LUT

classmethod generateLUTUUID(aLUT)

Generates a LUT UUID and associate it with the provided LUT

Parameters:

aLUT (ORSModel.ors.LookupTable) – a LUT to associate a UUID to

Returns:

output (str) – new LUT UUID

classmethod getDefaultColorLUT()

Gets the default continuous LUT. It uses the LUT name provided in the preferences. If no LUT can be found with this name, a default LUT name is used (for a LUT provided with the application).

Returns:

output (ORSModel.ors.LookupTable) – a LUT

classmethod getDefaultDiscreteLUT()

Gets the default discrete LUT. It uses the LUT name provided in the preferences. If no LUT can be found with this name, a default LUT name is used (for a LUT provided with the application).

Returns:

output (ORSModel.ors.LookupTable) – a LUT

classmethod getDefaultLUT()

Gets the default LUT (can be continuous or discrete). It uses the LUT name provided in the preferences. If no LUT can be found with this name, a default LUT name is used (for a LUT provided with the application).

Returns:

output (ORSModel.ors.LookupTable) – a LUT

classmethod getFirstLUTWithName(lutName)

Gets the first LUT having the provided name

Parameters:

lutName (str) – LUT name

Returns:

output (ORSModel.ors.LookupTable) – a LUT having the provided name

classmethod getLUTName(aLUT)

Gets the name of the provided LUT

Parameters:

aLUT (ORSModel.ors.LookupTable) – a LUT to obtain the name from

Returns:

output (str) – LUT name

classmethod getLUTUUID(aLUT)

Gets the UUID of the provided LUT

Parameters:

aLUT (ORSModel.ors.LookupTable) – a LUT to obtain the UUID from

Returns:

output (str) – LUT UUID

classmethod getLUTWithUUID(lutUUID)

Gets the LUT having the provided UUID

Parameters:

lutUUID (str) – LUT UUID

Returns:

output (ORSModel.ors.LookupTable) – a LUT having the provided UUID

classmethod isSourceLUTDefinitionFileLocatedInUserExtensionFolder(aSourceLUT)

Gets to know if a source LUT definition file is located in a user extension folder

Parameters:

aSourceLUT (ORSModel.ors.LookupTable) – LUT associated to a Python LUT definition file

Returns:

output (bool) – True if the source LUT definition file is located in a user extension folder

classmethod loadAllLUTFromFile()

Ensures that all LUTs having a definition file are instantiated. If a LUT instance is found with the same UUID as the UUID obtained from the definition file, that definition file will be skipped.

classmethod loadLUTFromFile(lutPath)

Instantiates a LUT from his definition file. As LUTs loaded from file are normally used as source LUTs, this LUT is set as representable and savable.

Parameters:

lutPath (file) – LUT definition file

Returns:

output (ORSModel.ors.LookupTable) – instantiated LUT

classmethod makeLUTAsSourceLUT(aLUT, lutFolder, lutName=None, aBibliography=None)

Creates a Python LUT definition file

Parameters:
  • aLUT (ORSModel.ors.LookupTable) – LUT from which the Python LUT definition will be made

  • lutFolder (folder saving) – folder where to create the definition file

  • lutName (str) – new LUT name. If None, the name of the provided LUT will be used.

  • aBibliography (SocketBibliography) – bibliography to use

Returns:

output (str) – new LUT definition file path

classmethod setLUTName(aLUT, lutName)

Sets the name in the provided LUT

Parameters:

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

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: UnstructuredGridHelper

Helper related to the class ORSModel.ors.Mesh.

interfacemethod computeGuassianCurvatureAsVertexScalarValues(IMeshModel, iTIndex, slotDescription='')

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

  • slotDescription (str) – description of the measurement to be added

interfacemethod computeMeanCurvatureAsVertexScalarValues(IMeshModel, iTIndex, slotDescription='')

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

  • slotDescription (str) – description of the measurement to be added

interfacemethod computeRayTracingThicknessAsVertexScalarValues(IMeshModel, iTIndex, slotDescription='')

Compute thickness by ray-tracing and put the result as a vertex scalar values.

Parameters:
  • IMeshModel (ORSModel.ors.Mesh) – the mesh to analyse the thickness

  • iTIndex (int) – the current time step

  • slotDescription (str) – description of the measurement to be added

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 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 createVisualFromModel(mesh, layout=None, aScalarValueTypeTag='')

Creates the mesh object from the model structured object.

Parameters:
Returns:

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

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 getListOfDisplayRenderingMesh(aMesh)

Deprecated : Use getListOfDisplayRendering instead

Deprecated since version 4.0.

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 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: Mesh, referenceMesh: Mesh, listOfSlotId, referenceTIndex, sourceTIndex, slotDescription='', defaultScalarValue=1)

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

  • slotDescription (str) – description of the measurement to be added

  • 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 mapDatasetValuesToAnUnstructuredGrid(sourceMesh: Mesh, referenceChannel, referenceChannelTIndex, sourceMeshTIndex, slotDescription='', 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

  • slotDescription (str) – description of the measurement to be added

  • 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 kept, 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

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 setScalarValueTypeForColorForAllViews(aMesh: Mesh, aScalarValueType='')

When the mesh uses scalar value for presentation of colors, sets the vertex scalar value or face scalar value to be used determined by aScalarValueType

Parameters:
  • aMesh (Mesh) – a Mesh

  • aScalarValueType (str) – OrsFaceScalarValuesType or OrsVertexScalarValueType

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.

multiroilabelhelper

class OrsHelpers.multiroilabelhelper.MultiROILabelHelper

Bases: object

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

interfacemethod addLabels(multiroi: MultiROI, add_count)

Adds N labels to a Multi-ROI

Parameters:
interfacemethod clearSelectedLabels(multiroi: MultiROI, tIndex: int)

Clears all the selected labels in the Multi-ROI

Parameters:
interfacemethod connectedComponentsOnLabels(multiroi: MultiROI, labels: 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:
interfacemethod extractROIForLabel(multiroi: MultiROI, label: int)

Extracts provided label from a Multi-ROI into a separate ROI.

Parameters:
Returns:

aROI (ORSModel.ors.ROI) – the ROI of the label

classmethod extractSelectedLabelsToROI(roi: ROI, multiroi: MultiROI, tIndex: int)

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

Parameters:
classmethod extractSelectedLabelsToROIs(multiroi: 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: 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: MultiROI, tIndex: int)

Removes all the selected labels from the Multi-ROI

Parameters:
interfacemethod setLabelUseGlobalOpacity(multiroi: MultiROI, label)

The specified label will use the MultiROI global intensity

Parameters:
interfacemethod setSelectedLabelsUseGlobalOpacity(multiroi: MultiROI, tIndex)

The selected labels will use the MultiROI global intensity

Parameters:
interfacemethod swapSelectedLabels(multiroi: MultiROI, tIndex: int)

Swaps the the selected labels in the Multi-ROI. Only 2 labels must be selected. Everything related to the labels are swapped, including scalars.

Parameters:

nodehelper

class OrsHelpers.nodehelper.NodeHelper

Bases: object

Helper related to the class ORSModel.ors.Node.

interfacemethod applyNodeOrder(nodeOrder, pluginInstance=None, topFrameIndex=0)

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

Changed in version -: Argument topFrameIndex has been added

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.

  • topFrameIndex (int) – top frame (or scene) index where the changes should to be applied to

opacityholder

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

Bases: NamedTuple

highlightOpacity: float

Alias for field number 0

highlightOpacityInRange: float

Alias for field number 1

highlightOpacityOutRange: float

Alias for field number 2

roiOpacity: float

Alias for field number 4

roiOpacityInRange: float

Alias for field number 5

roiOpacityOutRange: float

Alias for field number 6

volumeOpacity: float

Alias for field number 3

orsdatasetconvertorhelper

class OrsHelpers.orsdatasetconvertorhelper.OrsDatasetConvertorHelper

Bases: object

orsregistrationhelper

class OrsHelpers.orsregistrationhelper.OrsRegistrationHelper

Bases: object

Helper for performing registration.

orthogonalityhelper

class OrsHelpers.orthogonalityhelper.OrthogonalityHelper

Bases: object

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

interfacemethod setFont(visualOverlay, aFontName, aFontId)

Sets the font of a text overlay.

Parameters:
  • visualOverlay (ORSModel.ors.VisualOverlay) – a VisualOverlay

  • aFontName (str) – the new font name

  • aFontId (int) – the new fontId

interfacemethod setFontSize(visualOverlay, aFontSize)

Sets the font size of a text overlay.

Parameters:
interfacemethod setHorizontalTextAlignment(visualOverlay, aTextAlignmentH)

Sets the horizontal text alignment of a text overlay.

Parameters:
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:
interfacemethod setText(visualOverlay, aText)

Sets the text of a text overlay.

Parameters:
interfacemethod setTextColor(visualOverlay, aColor)

Sets the color of a text overlay.

Parameters:
interfacemethod setTextOpacity(visualOverlay, anOpacity)

Sets the opacity of a text overlay.

Parameters:
interfacemethod setVerticalTextAlignment(visualOverlay, aTextAlignmentV)

Sets the vertical text alignment of a text overlay.

Parameters:
interfacemethod setViewSize(visualOverlay, xSize, ySize)

Sets the view size of a text overlay.

Parameters:
  • visualOverlay (ORSModel.ors.VisualOverlay) – a VisualOverlay

  • xSize (int) – the new x view size

  • ySize (int) – the new y view size

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.

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 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: 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

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 generateMeshTubeFromPath(radius, aPath: VisualPath, timeStep=0)

Generates a mesh tube from a path with a fixed radius

Parameters:
Returns:

outMesh (ORSModel.ors.Mesh) – output mesh

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 setPositionOfFloatingCaptionForGenealogicalName(aViewGenealogicalName, anAnnotation: Annotation, position)

Sets the position of of the floating caption

Parameters:
Returns:

success (bool) – True if successful, False otherwise

classmethod setPositionOfFloatingCaptionForView(aView, anAnnotation: Annotation, position)

Sets the position of of the floating caption

Parameters:
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

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

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

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.

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.

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

interfacemethod copyMultiROI(aMultiROI)

Copies a MultiROI

Parameters:

aMultiROI (ORSModel.ors.MultiROI) – the MultiROI to copy

Returns:

newMultiROI (ORSModel.ors.MultiROI) – the copied MultiROI

interfacemethod copyROI(aROI)

Copies a ROI

Parameters:

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

Returns:

newROI (ORSModel.ors.ROI) – the copied ROI

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 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) [const] – the ROI to get a thickness mesh representation from

  • xSampling (int) – sampling in X

  • ySampling (int) – sampling in Y

  • zSampling (int) – sampling in Z

  • currentTime (int) – time index in the ROI

  • smoothingIterationsCount (int) – smoothing iterations count

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

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

classmethod extractROIFromMultiROIForLabel(sourceMultiROI: MultiROI, labelNumber: int)

Note: labelNumber starts from 1, and 0 represents non labeled region

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 getCurrentScalarValueTypeTag(aMultiROI)

Gets the current scalar value type tag

Parameters:

aMultiROI (ORSModel.ors.MultiROI) – a MultiROI

Returns:

output (str) – scalar value type tag currently shown for the MultiROI

interfacemethod getDenseMultiROIFromMultiROI(multiROI: MultiROI, progress: 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: 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 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 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, aScalarValueTypeTag=None)

Gets the LUT associated with the MultiROI

Parameters:
  • aMultiROI (ORSModel.ors.MultiROI) – a MultiROI to obtain a LUT from

  • forceCreation (bool) – if True, the legend will be created if nonexistent

  • aScalarValueTypeTag (str) – scalar value type tag. If None, the currently used scalar value type tag is used.

Returns:

output (ORSModel.ors.LookupTable) – LUT associated to the MultiROI

classmethod getLegendTitle(aMultiROI)

Gets the suggested titles for the legend, based on the current state of the MultiROI

Parameters:

aMultiROI (ORSModel.ors.MultiROI) – a MultiROI

Returns:
  • titleWithScalarSlotDescription (str) – concatenation of the title of the MultiROI with the description of the current scalar slot (or “label” if the current state is for the labels)

  • titleMultiROI (str) – title of the MultiROI

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 getUseDiscreteLegend(aMultiROI)

Gets to know if the current state of the MultiROI is using a discrete legend

Parameters:

aMultiROI

Returns:

output – True if the MultiROI is currently using a discrete legend (either the one of the labels or the one of the discrete scalars), False otherwise.

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, keepEmptyLabel=False)

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

Parameters:
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

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, keepEmptyLabel=False)

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

Parameters:
classmethod roiConnectedComponentBySliceIterator(aROI: 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

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 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, aScalarValueTypeTag=None, logging=True)

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

classmethod squarify(source_multiROI: ROI, label_range: Optional[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, forceUpdate=False, forceCreation=True)

Updates the legend of the current state of the MultiROI

classmethod updateMultiROIColor(aMultiROI)

Updates the colors of the MultiROI for the current scalar slot

classmethod updateMultiROISpecificLabelColor(aMultiROI, label)

Updates the colors of the MultiROI for the current scalar slot for a given label

SaversHelper

class OrsHelpers.SaversHelper.SaversHelper

Bases: object

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

sequentialcolorgenerator

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

Bases: object

Generator of colors.

sessionHelper

class OrsHelpers.sessionHelper.SessionHelper

Bases: object

Helper to manage sessions.

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 getIsVisibleIn2D(visualShape, view)
Parameters:
Returns:

output (bool) – the 2D VisualShape visibility

classmethod getIsVisibleIn3D(visualShape, view)
Parameters:
Returns:

output (bool) – the 3D VisualShape visibility

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 setDensity(visualShape, view, density, logging=True)

Sets the density of a VisualShape

Parameters:
interfacemethod setDensityFromGenealogicalName(visualShape, name, density)

Sets the density of a VisualShape

Parameters:
  • visualShape (ORSModel.ors.VisualShape) – a VisualShape

  • name (str) – a genealogical name

  • density (float) – the new density

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 thickness 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 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 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 setKeepClipBoxWhenObjectIsHidden(structuredGrid, keepClipBox, view=None)

Sets if the visibility of the clip box should be associated to the visibility of the structured grid in the layout of the view

Parameters:
  • structuredGrid (ORSModel.ors.StructuredGrid) – the associated structured grid

  • keepClipBox (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: 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:
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.

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.

interfacemethod setKeepClipBoxWhenObjectIsHiddenFromLayoutGenealogicalName(aName, aStructuredGrid, keepClipBox)

Sets the visual box visibility of a Structured grid if it is hidden

Parameters:
  • aName (str) – a genealogical name

  • aStructuredGrid (ORSModel.ors.StructuredGrid) – a structured grid

  • keepClipBox (bool) – if True, the clip box will remain visible even when the object is hidden; if False, the clip box will be hidden when the object is hidden.

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 copy(anUnstructuredGrid)

Copies an UnstructuredGrid

Parameters:

anUnstructuredGrid (ORSModel.ors.UnstructuredGrid) – the UnstructuredGrid to copy

Returns:

newUnstructuredGrid (ORSModel.ors.UnstructuredGrid) – the copied UnstructuredGrid

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 getIsVisibleIn2D(anUnstructuredGrid, view)
Parameters:
Returns:

output (bool) – the 2D UnstructuredGrid visibility

classmethod getIsVisibleIn3D(anUnstructuredGrid, view)
Parameters:
Returns:

output (bool) – the 3D ROI visibility

classmethod mapAListOfScalarSlotFromAMultiROIToAnUnstructuredGrid(sourceUnstructuredGrid: UnstructuredGrid, referenceMultiROI: MultiROI, listOfSlotId, referenceMultiROITIndex, sourceUnstructuredGridITIndex, slotDescription='', 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

  • slotDescription (str) – description of the measurement to be added

  • 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: UnstructuredGrid, referenceDataset, referenceDatasetTIndex, sourceUnstructuredGridTIndex, slotDescription='', 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

  • slotDescription (str) – description of the measurement to be added

  • 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 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 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 setKeepClipBoxWhenObjectIsHidden(unstructuredGrid, keepClipBox, view=None)

Sets if the visibility of the clip box should be associated to the visibility of the structured grid in the layout of the view

Parameters:
  • unstructuredGrid (ORSModel.ors.UnstructuredGrid) – the associated unstructured grid

  • keepClipBox (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 setLUT(aModel, aLUT, aView=None, aScalarValueTypeTag='Vertex Scalar Values')

Set LUT for a View. If view is None, the LUT will be set for all views

classmethod setVisualBox(unstructuredGrid, aBox, view=None)

Resets the visual box of an unstructured grid.

Parameters:

unstructuredGridLogger

class OrsHelpers.unstructuredGridLogger.UnstructuredGridLogger

Bases: AbstractLogger

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

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.

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.

interfacemethod setKeepClipBoxWhenObjectIsHiddenFromLayoutGenealogicalName(aName, anUnstructuredGrid, keepClipBox)

Sets the visual box visibility of a Structured grid if it is hidden

Parameters:
  • aName (str) – a genealogical name

  • anUnstructuredGrid (ORSModel.ors.UnstructuredGrid) – a structured grid

  • keepClipBox (bool) – if True, the clip box will remain visible even when the object is hidden; if False, the clip box will be hidden when the object is 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:
interfacemethod setVisualBoxOfUnstructuredGridFromLayoutGenealogicalName(aName, anUnstructuredGrid, aBox)

Sets the visual box of an unstructured grid

Parameters:

vectorfieldhelper

class OrsHelpers.vectorfieldhelper.VectorFieldHelper

Bases: 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 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 mapDatasetValuesToAnUnstructuredGrid(sourceVectorField: VectorField, referenceChannel, referenceChannelTIndex, sourceGraphTIndex, slotDescription='', defaulfScalarValue=1.0, scalarValueTypeTag='Vertex Scalar Values')

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

Parameters:
  • sourceVectorField (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

  • slotDescription (str) – description of the measurement to be added

  • 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, 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

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

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.

viewLayoutHelper

class OrsHelpers.viewLayoutHelper.DisplayLayoutHelper

Bases: object

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

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.

viewLogger

class OrsHelpers.viewLogger.ViewLogger

Bases: AbstractLogger

Helper related to the class ORSModel.ors.View.

interfacemethod fitBoundedPlaneInViewFromLayoutGenealogicalName(aName, rectangle)

Fit Rectangle in View

Parameters:
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:
interfacemethod setProjectionMode2DFromLayoutGenealogicalName(aName, projectionMode)

Set view mode

Parameters:
  • aName (str) – a genealogical name

  • projectionMode (IntEnum CxvVolumeProjection_Mode) – a viewMode

interfacemethod setViewModeFromLayoutGenealogicalName(aName, viewMode)

Set view mode

Parameters:
  • aName (str) – a genealogical name

  • viewMode (IntEnum CxvView_Mode) – a viewMode

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

interfacemethod setViewOrientedPlaneWithBoxFromLayoutGenealogicalName(aName, orientedPlane, box)

Sets the view orientation from box

Parameters:
interfacemethod setViewOrthoZoomFactorFromLayoutGenealogicalName(aName, zoomFactor)

Sets the view ortho zoom factor

Parameters:
  • aName (str) – a genealogical name

  • zoomFactor (float) – a zoom factor

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

interfacemethod setViewSlabThicknessFromLayoutGenealogicalName(aName, thickness)

Sets the view plane position from genealogical name

Parameters:
  • aName (str) – a genealogical name

  • thickness (float) – a thickness in meter

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: DatasetPresenterLogger

Helper related to the visual state of Channels.

visualColorBarLogger

class OrsHelpers.visualColorBarLogger.VisualColorBarLogger

Bases: VisualLogger

Helper related to the visual state of ColorBars.

interfacemethod setCanBeVisibleForViewFromLayoutGenealogicalName(aName, parentNode, value)

Sets the visibility of a Visual color bar

Parameters:
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: 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:

visualsurfacecontrolpointshelper

class OrsHelpers.visualsurfacecontrolpointshelper.VisualSurfaceControlPointsHelper

Bases: object

Helper for manipulation of instances of sub classes ofVisualSurfaceControlPoints

interfacemethod createVisualBezierPatchFromRectangle(aRectangle, uControlPointCount=5, vControlPointCount=5, timeSize=1)

Creates a new VisualBezierPatch in the limits of the provided Rectangle with the given density of control points

Parameters:
  • aRectangle (ORSModel.ors.Rectangle) – a Rectangle

  • uControlPointCount (int) – an int with minimum value of 2

  • vControlPointCount (int) – an int with minimum value of 2

  • timeSize (int) – a timeSize

Returns:

aVisualBezierPatch (ORSModel.ors.VisualBezierPatch) – a new VisualBezierPatch

interfacemethod createVisualRBFRectangleFromRectangle(aRectangle, uControlPointCount=5, vControlPointCount=5, timeSize=1)

Creates a new VisualBezierPatch in the limits of the provided Rectangle with the given density of control points

Parameters:
  • aRectangle (ORSModel.ors.Rectangle) – a rectangle

  • uControlPointCount (int) – an int with minimum value of 2

  • vControlPointCount (int) – an int with minimum value of 2

  • timeSize (int) – a timeSize

Returns:

aVisualRBFRectangle (ORSModel.ors.VisualRBFRectangle) – a new VisualRBFRectangle

interfacemethod fillControlPointsFromRectangle(aSurfaceControlPoints: SurfaceControlPoints, aRectangle, uControlPointCount=5, vControlPointCount=5)

Sets the controlPoints from rectangle

Parameters:
interfacemethod redistributeControlPoints(aVisualSurfaceControlPoints, uControlPointCount=5, vControlPointCount=5, timestep=0)

This method is used to uniformly redistribute the control points

Parameters:
  • aVisualSurfaceControlPoints (ORSModel.ors.VisualSurfaceControlPoints) – a VisualSurfaceControlPoints

  • uControlPointCount (int) – control point on U axis

  • vControlPointCount (int) – control point in V axis

  • timestep (int) – the time index

interfacemethod setVisualSurfaceControlPointsControlPointAtIndex(aVisualSurfaceControlPoints: VisualSurfaceControlPoints, aControlPointIndex, aControlPoint, timestep=0)

Sets the controlPoint from rectangle

Parameters:

visual_plane

class OrsHelpers.visual_plane.VisualPlaneHelper

Bases: object

interfacemethod bindPlaneToView(plane: VisualPlane, view_layout_name: str, bind: bool)

Binds a visual plane to a view

Parameters:

volumehelper

class OrsHelpers.volumehelper.VolumeHelper

Bases: object

Helper related to the class ORSModel.ors.VisualChannel.

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 createVolumeForChannel(aChannel0, aChannel1=None, aChannel2=None, aChannel3=None, layout=None)

Creates a volume from a set of channels

Parameters:
Returns:
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

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

vtkhelpers

class OrsHelpers.vtkhelpers.VtkPolyDataToFromOrsMeshHelper

Bases: object

watershedhelper

class OrsHelpers.watershedhelper.WatershedHelper

Bases: object

Helper for performing a watershed (segmentation algorithm).