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.

actionloganonymizer

annotationhelper

class OrsHelpers.annotationhelper.AnnotationHelper

Bases: object

Helper related to the annotations.

interfacemethod setColor(anAnnotation: Annotation, aColor: Color) None

Sets the normal color of an annotation

Parameters:
interfacemethod setIsVisibleForViewFromLayoutGenealogicalName(aName: str, annotation: Annotation, isVisible: bool) None

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: str, annotation: Annotation, isVisible: bool) None

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

Copies a dataset

Parameters:

aDataset (ORSModel.ors.Channel) – the dataset to copy

Returns:

newDataset (ORSModel.ors.Channel) – the copied dataset

interfacemethod copyDatasetNotInitialize(aDataset: Channel) Channel

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: ROI, labeledValue: int = 255, IProgress: Progress = None) Channel

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: MultiROI, IProgress: Progress = None) Channel

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: Channel, multiROI: MultiROI, IProgress: Progress = None) MultiROI

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: Channel) None

Deletes a dataset

Parameters:

aDataset (ORSModel.ors.Channel) – the dataset to delete

interfacemethod linkColorChannels(red: Channel = None, green: Channel = None, blue: Channel = None)

Service that links 3 channels together as RGB

Parameters:
interfacemethod setIsVisibleForViewFromLayoutGenealogicalName(aName: str, dataset: Channel, isVisible: bool) None

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: str, dataset: Channel, isVisible: bool) None

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: str, dataset: Channel, isVisible: bool) None

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, withAbbreviation=True)

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

Parameters:
  • value – ths source value

  • dimensionUnit – the source dimension unit

  • view – the view

Returns:

output – a string representation of the converted value

classmethod getOpenPNMUnitFromDescription(desc: str)

Assign the proper unit based on OpenPNM property description string. :param desc: OpenPNM property description string. :type desc: str :return: The appropriate unit for the given OpenPNM property description :rtype: ORSModel.ors.DimensionUnit

classmethod getPreferredUnitForUnitType(unitType: CxvUniverse_Dimension_Type, implementation=None) DimensionUnit

Returns the preferred unit for the current working context. Checks the current view’s unit first, then falls back to the default preference.

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: MultiROI) None

Deletes a MultiROI

Parameters:

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

interfacemethod deleteROI(aROI: ROI) None

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 distanceMapFromROIGPGPU(inputROI, outChannel=None)

Generate distance map from roi using gpgpu command.

Note: If no valid channel is provided for output, a new channel will be created and published

Parameters:
Returns:

output (bool) – Success of the operation

classmethod generatePathBetweenROIsAlongLandscape(traceBackChannel: Channel, voxelWorldPositionStopPointReach: Vector3)

Create a visual path that connects two ROIs, following a landscape.

Note: Time step objects are not supported.

Parameters:
Returns:

outPath (ORSModel.ors.VisualPath) – the shortest path as a Visual Path

interfacemethod generateROIAndPathBetweenROIsAlongLanscape(aLandscape: Channel, roiStart: ROI, roiEnd: ROI, roiMask: ROI, geometricalBias: float = 0) Tuple[ROI, VisualPath]

Generate a line ROI from roiStart to roiEnd in roiMask through a landscape, corresponding to the Dijkstra shortest path

Note

Time step dataset is not supported

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

Copies a graph

Parameters:

aGraph (ORSModel.ors.Graph) – the graph to copy

Returns:

newGraph (ORSModel.ors.Graph) – the copied graph

interfacemethod copyGraph(aGraph: Graph) Graph

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: str, aGraph: Graph, isVisible: bool) None

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: str, aGraph: Graph, isVisible: bool) None

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

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: str, groupOfPaths: Group, isVisible: bool) None

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: str, anObject: Union[Channel, MultiROI, UnstructuredGrid], aScalarValueTypeTag: str = '') LookupTable

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: str, anObject: Union[Channel, MultiROI, UnstructuredGrid], aScalarValueTypeTag: str = '') LookupTable

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: str, dataset: Channel) Tuple[float, float]

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: str, color: Color) None

Set show text annotation in layout

Parameters:
interfacemethod set2DLUTAsLUTFromGenealogicalName(layoutFullName: str, anObject: Union[Channel, MultiROI, UnstructuredGrid], aSourceLUT: LookupTable, aScalarValueTypeTag: str = '') None

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: str, anObject: Union[Channel, MultiROI, UnstructuredGrid], lutUUID: str, aScalarValueTypeTag: str = '') None

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: str, anObject: Union[Channel, MultiROI, UnstructuredGrid], aSourceLUT: LookupTable, aScalarValueTypeTag: str = '') None

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: str, anObject: Union[Channel, MultiROI, UnstructuredGrid], lutUUID: str, aScalarValueTypeTag: str = '') None

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: str, dataset: Channel, colorRangeMode: CxvColorRange_Mode) None

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: str, dataset: Channel, colorRangeMode: CxvColorRange_Mode) None

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: str, anObject: Union[ROI, MultiROI], thickness: float) None

Set contour thickness of ROI/MultiROI in layout

Parameters:
interfacemethod setCurrentTimeStepFromGenealogicalName(layoutFullName: str, time_step: int) None

Change time step in layout

Parameters:
  • layoutFullName (str) – a genealogical name

  • time_step (int) – new time step

interfacemethod setGamma2DFromGenealogicalName(layoutFullName: str, dataset: Channel, gamma: float) None

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: str, dataset: Channel, gamma: float) None

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: str, isLODEnabled2D: bool) None

Set the enabled LOD flag for 2D views in layout

Parameters:
  • layoutFullName (str) – a genealogical name

  • isLODEnabled2D (bool) – a flag

interfacemethod setLODEnabled3DFromGenealogicalName(layoutFullName: str, isLODEnabled3D: bool) None

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

Parameters:
  • layoutFullName (str) – a genealogical name

  • isLODEnabled3D (bool) – a flag

interfacemethod setOpacity2DFromGenealogicalName(layoutFullName: str, dataset: Channel, value: float) None

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: str, dataset: Channel, value: float) None

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: str, dataset: Channel, opacityMode: CxvOpacity_Mode) None

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: str, dataset: Channel, opacityMode: CxvOpacity_Mode) None

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: str, dataset: Channel, value: bool) None

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: str, dataset: Channel, min: float, max: float) None

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: str, visual: VisualShape, thickness: float) None

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: str, anObject: Union[ROI, MultiROI], showContour: bool) None

Set show contour of ROI/MultiROI in layout

Parameters:
interfacemethod setShowLegendFromGenealogicalName(layoutFullName: str, showLegend: bool, aScalarValueTypeTag: str = '') None

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: str, showScaleBar: bool) None

Set show text annotation in layout

Parameters:
  • layoutFullName (str) – a genealogical name

  • showScaleBar (bool) – a flag

interfacemethod setShowTextAnnotationFromGenealogicalName(layoutFullName: str, showTextAnnotation: bool) None

Set show text annotation in layout

Parameters:
  • layoutFullName (str) – a genealogical name

  • showTextAnnotation (bool) – a flag

interfacemethod setUnitFromGenealogicalName(layoutFullName: str, unit_type: CxvUniverse_Dimension_Type, aDimensionUnit: DimensionUnit = None, unitId: CxvUniverse_Dimension = None) 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: str, dataset: Channel, value: bool) None

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: str, dataset: Channel, width: float, center: float) None

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: str, dataset: Channel, width: float, center: float) None

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

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: Managed) None

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: Managed) None

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: Managed) None

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.

classmethod adjust_edge_curvatures(source, curvature_name, epsilon=1e-08)
This function adjusts curvatures along the edges of the surface by replacing

the value with the average value of the curvatures of points in the neighborhood.

Remember to update the vtkCurvatures object before calling this.

Parameters:
  • source – A vtkPolyData object corresponding to the vtkCurvatures object.

  • curvature_name – The name of the curvature, ‘Gauss_Curvature’ or ‘Mean_Curvature’.

  • epsilon – Absolute curvature values less than this will be set to zero.

Returns:

output

interfacemethod computeGaussianCurvatureAsVertexScalarValues(IMeshModel: Mesh, iTIndex: int, slotDescription: str = '') None

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 computeGuassianCurvatureAsVertexScalarValues(IMeshModel: Mesh, iTIndex: int, slotDescription: str = '') None

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

Deprecated since version 2026.1: Use MeshHelper.computeGaussianCurvatureAsVertexScalarValues instead

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: Mesh, iTIndex: int, slotDescription: str = '') None

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: Mesh, iTIndex: int, slotDescription: str = '') None

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 computeSphereBasedThicknessAsVertexScalarValues(IMeshModel, iTIndex, lowerBound, upperBound, 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

  • lowerBound (float) – value of the lower boundary of mesh thickness

  • upperBound (float) – value of the upper boundary of mesh thickness

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

interfacemethod copy(aMesh: Mesh) Mesh

Copies a mesh

Parameters:

aMesh (ORSModel.ors.Mesh) – the mesh to copy

Returns:

newMesh (ORSModel.ors.Mesh) – the copied mesh

interfacemethod copyMesh(aMesh: Mesh) Mesh

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: MultiROI, IProgress: Progress = None) Mesh

Creates a new mesh from a MultiROI

Parameters:
Returns:

aMesh (ORSModel.ors.Mesh) – new mesh

classmethod generateAndPublishInterfacialSurface(aCollectionOfROIsOrMultiROIs, currentTimeStep)

Generates and Publish an interfacial surface between ROIs and multiROIs. This function also ask the user for the wished output mesh type. For now, marching cubes (normal) mesh, cubic mesh and normal sampled are supported.

interfacemethod generateInterfacialCubicMeshFromROIs(referenceROI: Union[ROI, MultiROI], listOfROIs: List[Union[ROI, MultiROI]], iTIndex: int = 0, world: bool = True, aProgress: Progress = None) Tuple[Mesh, int]

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: Union[ROI, MultiROI], listOfROIs: List[Union[ROI, MultiROI]], iTIndex: int = 0, samplingX: int = 1, samplingY: int = 1, samplingZ: int = 1, world: bool = True, aProgress: Progress = None) Tuple[Mesh, int]

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: Mesh, iTIndex: int = 0, progress: Progress = None) int

Find non manifold edges count

Parameters:
Returns:

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

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

Compute thickness by ray-tracing on GPU 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 intersectBoxWithMesh(referenceMesh: Mesh, referenceBox: VisualBox, iTIndex: int = 0, invert: bool = False) None

removes the vertices of the mesh that are inside the given visual box.

Parameters:
  • referenceMesh (ORSModel.ors.Mesh) – object to be cut

  • referenceBox (ORSModel.ors.VisualBox) – object to define the cutting region

  • iTIndex (int) – a time step

  • invert (bool) – False to cut inside, True to cut outside the box

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: str, aMesh: Mesh, isVisible: bool) None

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: str, aMesh: Mesh, isVisible: bool) None

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 setIsVisibleIn3D(aMesh: Mesh, view: View, value: bool = False)
Parameters:
interfacemethod setIsVisibleIn3DFromGenealogicalName(name: str, aMesh: Mesh, isVisible: bool = False) None

Sets the visibility of a mesh in all 3D 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 or OrsLabelContinuousScalarValuesType

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

nodehelper

class OrsHelpers.nodehelper.NodeHelper

Bases: object

Helper related to the class ORSModel.ors.Node.

interfacemethod applyNodeOrder(nodeOrder: List[Node], pluginInstance: OrsPlugin = None, topFrameIndex: int = 0) None

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: VisualOverlay, viewName: str = '') VisualOverlay

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: VisualOverlay, aFontName: str, aFontId: int) None

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: VisualOverlay, aFontSize: int) None

Sets the font size of a text overlay.

Parameters:
interfacemethod setHorizontalTextAlignment(visualOverlay: VisualOverlay, aTextAlignmentH: str) None

Sets the horizontal text alignment of a text overlay.

Parameters:
classmethod setIsVisibleIn2D(visualOverlay, view, value)
Parameters:
interfacemethod setIsVisibleIn2DFromGenealogicalName(name: str, visualOverlay: VisualOverlay, value: bool) None

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: VisualOverlay, aText: str) None

Sets the text of a text overlay.

Parameters:
interfacemethod setTextColor(visualOverlay: VisualOverlay, aColor: str) None

Sets the color of a text overlay.

Parameters:
interfacemethod setTextOpacity(visualOverlay: VisualOverlay, anOpacity: float) None

Sets the opacity of a text overlay.

Parameters:
interfacemethod setVerticalTextAlignment(visualOverlay: VisualOverlay, aTextAlignmentV: str) None

Sets the vertical text alignment of a text overlay.

Parameters:
interfacemethod setViewSize(visualOverlay: VisualOverlay, xSize: int, ySize: int) None

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: Annotation, timeStep: int, position: Vector3, transformationMatrix: Matrix4x4 = None) bool

Adds a control point in an annotation.

Parameters:
Returns:

success (bool) – True if successful, False otherwise

interfacemethod createPrimitive(primitiveClass: Type[Annotation], aLayoutName: str, associatedState: str) Annotation

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: Annotation) bool

Deletes an annotation.

Parameters:

anAnnotation (ORSModel.ors.Annotation) – the annotation object to delete

Returns:

success (bool) – True if successful, False otherwise

interfacemethod deselectControlPoint(anAnnotation: Annotation, controlPointIndex: int, timeStep: int) bool

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: float, aPath: VisualPath, timeStep: int = 0) Mesh

Generates a mesh tube from a path with a fixed radius

Parameters:
Anonymize aPath:

True

Returns:

outMesh (ORSModel.ors.Mesh) – output mesh

interfacemethod generateRulersFromPath(distance: float, aPath: VisualPath, aName: str, timeStep: int = 0)

Generates a set of evenly spaces rulers from a path

Parameters:
  • distance (float) – distance between each ruler (in meters)

  • aPath (ORSModel.ors.VisualPath) – path

  • aName (str) – a genealogical name

  • timeStep (int) – time step

Anonymize aPath:

True

Returns:

output (ORSModel.ors.VisualRuler) [count=[0, None]] – list of rulers

interfacemethod insertControlPoint(index: int, anAnnotation: Annotation, timeStep: int, position: Vector3, transformationMatrix: Matrix4x4 = None) bool

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: Annotation, controlPointIndex: int, timeStep: int) bool

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: Annotation, controlPointIndex: int, timeStep: int) bool

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: Annotation, controlPointIndex: int, timeStep: int, position: Vector3, transformationMatrix: Matrix4x4 = None) bool

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: str, anAnnotation: Annotation, position: Vector3) bool

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: Annotation, regionShape: CxvRegion_Shape) bool

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: Annotation, timeStep: int, xOffset: float, yOffset: float, zOffset: float) bool

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: ROI, numberOfObject: int, as26Connected: bool, aProgress: Progress = None, perSlice: bool = False) 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

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

interfacemethod processIslands(aROI: ROI, voxelCountThreshold: int, keepLargeObjects: bool, as26Connected: bool, timeIndex: int, aProgress: Progress = None, perSlice: bool = False) 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

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

interfacemethod removeNLargest(aROI: ROI, numberOfObject: int, as26Connected: bool, aProgress: Progress = None, perSlice: bool = False) 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

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

progresscontextmanager

class OrsHelpers.progresscontextmanager.ProgressContextManager(logging=False)

Bases: 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: Progress) None

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() Progress

Creates a Progress object

Returns:

aProgress (ORSModel.ors.Progress) – the created progress object

interfacemethod decrementRangeBy(aProgress: Progress, decrementRangeValue: int) None

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: Progress) None

Deletes a Progress object

Parameters:

aProgress (ORSModel.ors.Progress) – a progress object

interfacemethod incrementRangeBy(aProgress: Progress, incrementRangeValue: int) None

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: Progress) None

Resets the cancelled state

Parameters:

aProgress (ORSModel.ors.Progress) – a Progress object

interfacemethod setExtraText(aProgress: Progress, text: str) None

Sets the extra text

Parameters:
interfacemethod setIsCancellable(aProgress: Progress, isCancellable: bool) None

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: Progress, isCancelled: bool) None

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: Progress, caption: str, range: int, isCancellable: bool) None

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: Progress, progressID: int, range: int, isCancellable: bool) None

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: Progress, caption: str, isCancellable: bool) None

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: Progress, progressID: int, isCancellable: bool) None

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: Progress, progressPosition: int) None

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 addHtmlOfObjectToWord(obj: Managed, viewName: str = '') bool

Generate HTML for a single object and add it to Word.

Parameters:
  • obj (ORSModel.ors.Managed) – The object to add to the report

  • viewName (str) – The genealogical name of the provided view

Returns:

output (bool) – True if successful, False otherwise

interfacemethod addHtmlToWord(htmlContent: str, title: Optional[str] = None) bool

Insert HTML content into the active Word document.

Parameters:
  • htmlContent (str) – The HTML content to insert

  • title (str) – The title of the object (used for section heading)

Returns:

output (bool) – True if successful, False otherwise

static captureMPLAndStartDrag(canvas, title='', parent=None)

Captures a matplotlib canvas to clipboard and initiates drag-drop

The image is saved to a temporary file and: 1. The image data is copied to the clipboard for paste operations 2. For drag operations, only the path to the temporary file is transferred

(using XML format similar to the report panel)

Parameters:
  • canvas (matplotlib.backends.backend_agg.FigureCanvasAgg) – The matplotlib canvas to capture

  • parent (QWidget, optional) – The parent widget for the drag operation, defaults to canvas if None

Returns:

output (list) – List of temporary files created during the operation

interfacemethod captureSnapshot(viewName: str, filename: str, xSize: int, ySize: int) None

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

Anonymize filename:

True

interfacemethod captureSnapshotAsImage(viewName: str, xSize: int, ySize: int) Optional[Image]

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

static cleanupTempFiles(tempFiles)

Cleans up temporary files created during capture

Parameters:

tempFiles (list) – List of temporary file paths to clean up

classmethod extractHtmlFromLLMResponse(llmResponse: str, originalHtml: str = '') tuple[bool, str]

Extracts and validates HTML content from LLM response.

Parameters:
  • llmResponse (str) – The response from the LLM

  • originalHtml (str) – The original HTML content for structural comparison (optional)

Returns:

output (tuple[bool, str]) – Tuple of (isHTMLValid, extracted HTML content or error message)

interfacemethod generateHtmlForObject(obj: Optional[Managed], viewName: str = '') str

Generate HTML for a selected object using the appropriate generator.

Parameters:
  • obj (ORSModel.ors.Managed) – The object to generate HTML for

  • viewName (str) – The genealogical name of the provided view

Returns:

output (str) – HTML content for the object

interfacemethod generateHtmlForViewObjects(viewName: str, imagePath: str) str

Generate HTML for objects in a view using specialized HTML generators.

Parameters:
  • viewName (str) – The genealogical name of the view

  • imagePath (str) – Path to the snapshot image

Returns:

output (str) – Complete HTML document as a string

classmethod generateHtmlTableContent(tableData, columnHeaders) str

Generate HTML table content from pre-formatted data.

interfacemethod generatereportpdf(basePath: str, htmlContent: str, outputFilePath: str) bool

Convert HTML content to PDF and save it to the specified file path using Qt’s QWebEnginePage.

Parameters:
  • basePath (str) – path to the HTML files (images)

  • htmlContent (str) – html content as a string

  • outputFilePath (str) – The file path where the PDF will be saved

Returns:

output (bool) – True if successful, False otherwise

classmethod getHtmlFromLLM(llmService, textPrompt: str, htmlContent: str) tuple[bool, str]

Get modified HTML from LLM based on user prompt.

Parameters:
  • llmService (LlmServiceManager) – LLM service manager instance

  • textPrompt (str) – User’s modification instructions

  • htmlContent (str) – Original HTML content

Returns:
  • output (bool) – success of the operation

  • output2 (str) – Modified HTML content

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: ROI, threshold: float, progress: Progress) ROI

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

Parameters:
Returns:

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

interfacemethod computeInterfacialSurface(referenceROI: Union[ROI, MultiROI], listOfROIs: List[Union[ROI, MultiROI]], iTIndex: int = 0, aProgress: Progress = None) float

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

Copies a MultiROI

Parameters:

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

Returns:

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

interfacemethod copyROI(aROI: ROI) ROI

Copies a ROI

Parameters:

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

Returns:

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

interfacemethod createMultiROIFromStructuredGrid(structuredGridReference: StructuredGrid, MultiROITitle: str) MultiROI

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 createROIFromLowerOtsu(aChannel: Channel, timeStep: int = 0) ROI

Generate a ROI from the lower Otsu of a Channel at a given timestep

Parameters:
  • aChannel (ORSModel.ors.Channel) – The channel to compute the Otsu from

  • timeStep (int) – The index of time

Returns:

output (ORSModel.ors.ROI) – the output ROI that is the result of the lower Otsu

interfacemethod createROIFromStructuredGrid(structuredGridReference: StructuredGrid, ROITitle: str, ROIColor: Color) ROI

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

Parameters:
Anonymize ROITitle:

True

Returns:

aROI (ORSModel.ors.ROI) – new ROI

interfacemethod createROIFromUpperOtsu(aChannel: Channel, timeStep: int = 0) ROI

Generate a ROI from the upper Otsu of a Channel at a given time step

Parameters:
  • aChannel (ORSModel.ors.Channel) – The channel to compute the Otsu from

  • timeStep (int) – The index of time

Returns:

output (ORSModel.ors.ROI) – the output ROI that is the result of the Upper Otsu

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) MultiROI

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: List[ROI], progress: Progress) MultiROI

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: Union[ROI, MultiROI]) Tuple[float, float]

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

interfacemethod getOptimalMeshSamplingForROI(aROIorMultiROI, currentTime)

Computes optimal x/y/z sampling from a ROI or Multi-ROI to create an optimal mesh afterwards

Parameters:
Returns:
  • xSampling (int) – sampling in X

  • ySampling (int) – sampling in Y

  • zSampling (int) – sampling in Z

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

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

Parameters:
Returns:

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

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

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

Parameters:
Returns:

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

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: List[Union[ROI, MultiROI]], destinationROI: Union[ROI, MultiROI], clearDestination: bool = False, keepEmptyLabels: bool = False) None

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: Union[ROI, MultiROI], listOfRoiAndMRoiIntersecting: List[Union[ROI, MultiROI]], iTIndex: int, oRoiorMRoi: Union[ROI, MultiROI] = None, keepEmptyLabel: bool = False) None

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

Parameters:
interfacemethod loadROIsFromFile(filename: str) List[ROI]

Loads all ROIs found in an ORSObject file

Parameters:

filename (file) – fully qualified file name

Anonymize filename:

True

Returns:

newROIs (ORSModel.ors.ROI) [count=[0, None]] – list of new ROIs

interfacemethod maskROIWithShape(roi: ROI, shape: Shape3D, timestep: int) None

Masks the given ROI with a Shape

Parameters:
interfacemethod maskROIWithVisualShape(roi: ROI, visualShape: VisualShape3D, timestep: int) None

Masks the given ROI with a VisualShape

Parameters:
interfacemethod removeEmptyLabelsAndRenumber(aMultiROI: MultiROI) None

Removes the empty labels and renumber the remaining ones

Parameters:

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

interfacemethod removeEmptyLabelsAndRenumberOnSize(aMultiROI: MultiROI, bAscending: bool) None

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: Union[ROI, MultiROI], listOfRoiAndMRoiIntersecting: List[Union[ROI, MultiROI]], iTIndex: int, oRoiorMRoi: Union[ROI, MultiROI] = None, keepEmptyLabel: bool = False) None

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

Parameters:
classmethod roiConnectedComponentBySliceIterator(aROI: ROI, tIndex: int, considerDiagonal: bool, box=None, zMin: int = 0, zMax: int = inf)
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: ROI, aColor: Color, highlightOpacityInRange: float = None) 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: str, aROI: Union[ROI, MultiROI], isVisible: bool) None

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: str, aROI: Union[ROI, MultiROI], isVisible: bool) None

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: Union[ROI, MultiROI], secondROI: Union[ROI, MultiROI], destinationROI: Union[ROI, MultiROI], clearDestination: bool = False, keepEmptyLabels: bool = False) None

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: List[Union[ROI, MultiROI]], destinationROI: Union[ROI, MultiROI], keepEmptyLabels: bool = False) None

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: VisualShape, name: str, aColor: Color) None

Sets the color of a VisualShape

Parameters:
classmethod setDensity(visualShape, view, density, logging=True)

Sets the density of a VisualShape

Parameters:
interfacemethod setDensityFromGenealogicalName(visualShape: VisualShape, name: str, density: float) None

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: str, visualShape: VisualShape, isVisible: bool) None

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: VisualShape, name: str, thickness: float) None

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

interfacemethod changeAdvancedStructuredGridProperties(structuredGrid: StructuredGrid, xPosition: float, yPosition: float, zPosition: float, orientationAxis1X: float, orientationAxis1Y: float, orientationAxis1Z: float, orientationAxis2X: float, orientationAxis2Y: float, orientationAxis2Z: float, orientationAxis3X: float, orientationAxis3Y: float, orientationAxis3Z: float) None

Changes the structured grid advanced properties.

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

  • xPosition (float) – new position in the X direction

  • yPosition (float) – new position in the Y direction

  • zPosition (float) – new position in the Z direction

  • orientationAxis1X (float) – new X component for the direction 1

  • orientationAxis1Y (float) – new Y component for the direction 1

  • orientationAxis1Z (float) – new Z component for the direction 1

  • orientationAxis2X (float) – new X component for the direction 2

  • orientationAxis2Y (float) – new Y component for the direction 2

  • orientationAxis2Z (float) – new Z component for the direction 2

  • orientationAxis3X (float) – new X component for the direction 3

  • orientationAxis3Y (float) – new Y component for the direction 3

  • orientationAxis3Z (float) – new Z component for the direction 3

interfacemethod createVisualBoxFromStructuredGrid(structuredGrid: StructuredGrid) VisualBox

Extract the box of a Structured Grid Object.

Parameters:

structuredGrid (ORSModel.ors.StructuredGrid) – the structured grid to extract the box from

Returns:

aVisualBox (ORSModel.ors.VisualBox) – new VisualBox

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: str, channel: Channel) None

Resets the visual box of a Channel

Parameters:
interfacemethod resetVisualBoxOfROIFromLayoutGenealogicalName(aName: str, aROIOrMultiROI: Union[ROI, MultiROI]) None

Resets the visual box of a ROI or of a MultiROI

Parameters:
interfacemethod setBox(aStructuredGrid: StructuredGrid, aBox: Box) None

Sets box of StructuredGrid

Parameters:
interfacemethod setClipBoxVisibilityOfChannelFromLayoutGenealogicalName(aName: str, channel: Channel, isVisible: bool) None

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: str, aROIOrMultiROI: Union[ROI, MultiROI], isVisible: bool) None

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: str, aStructuredGrid: StructuredGrid, keepClipBox: bool) None

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: str, channel: Channel, aBox: Box) None

Sets the visual box of a Channel

Parameters:
interfacemethod setVisualBoxOfROIFromLayoutGenealogicalName(aName: str, aROIOrMultiROI: Union[ROI, MultiROI], aBox: Box) None

Sets the visual box of a ROI or of a MultiROI

Parameters:

surfaceunwraphelper

class OrsHelpers.surfaceunwraphelper.SurfaceUnwrapHelper

Bases: object

classmethod extract2DProjectionChannelFromShape(shape3D: Shape3D, sourceDataset: Channel, timeStep: int = 0) Channel

Extract 2D Channel from the surface of the Shape3D

Parameters:
Returns:

outDataset (ORSModel.ors.Channel) – the projection channel

interfacemethod extract2DProjectionChannelFromVisualShape(aVisualShape3D: VisualShape3D, sourceDataset: Channel, timeStep: int = 0) Channel

Extract 2D Channel from the surface of the VisualShape3D

Parameters:
Returns:

outDataset (ORSModel.ors.Channel) – the projection channel

interfacemethod extract2DProjectionMultiROIFromShape(shape3D: Shape3D, sourceDataset: MultiROI, timeStep) MultiROI

Extract 2D MultiROI from the surface of the Shape3D

Parameters:
Returns:

outDataset (ORSModel.ors.MultiROI) – the projection MultiROI

interfacemethod extract2DProjectionMultiROIFromVisualShape(aVisualShape3D: VisualShape3D, sourceDataset: MultiROI, timeStep: int = 0) MultiROI

Extract 2D MultiROI from the surface of the VisualShape3D

Parameters:
Returns:

outDataset (ORSModel.ors.MultiROI) – the projection MultiROI

interfacemethod extract2DProjectionROIFromShape(shape3D: Shape3D, sourceDataset: ROI, timeStep: int = 0) ROI

Extract 2D ROI from the surface of the Shape3D

Parameters:
Returns:

outDataset (ORSModel.ors.ROI) – the projection roi

interfacemethod extract2DProjectionROIFromVisualShape(aVisualShape3D: VisualShape3D, sourceDataset: ROI, timeStep: int = 0) ROI

Extract 2D ROI from the surface of the VisualShape3D

Parameters:
Returns:

outDataset (ORSModel.ors.ROI) – the projection ROI

classmethod extract3DProjectionChannelFromCylinderOrSphere(sourceDataset: Channel, cylinderOrSphere: Shape3D, timeStep: int = 0, minRadius: float = 0, maxRadius: float = 0, radiusIncrement: float = 0, aProgress: Progress = None)

Creates a 3D volume of unwrapped projections from a dataset onto a cylinder or sphere at multiple radii.

Parameters:
  • sourceDataset (ORSModel.ors.Channel) – source dataset

  • cylinderOrSphere (ORSModel.ors.Shape3D) – a cylinder or a sphere

  • timeStep (int) – a timestep

  • minRadius (float) – minimum radius to extract

  • maxRadius (float) – maximum radius to extract

  • radiusIncrement (float) – increment between radii

  • aProgress (ORSModel.ors.Progress) – progress bar

Returns:

outputChannel (ORSModel.ors.Channel) – created 3D Channel

classmethod extract3DProjectionChannelFromRBFRectangle(sourceDataset: Channel, rbfRectangle: RBFRectangle, timeStep: int = 0, rangeInMeters: float = 0, incrementInMeters: float = 0, aProgress: Progress = None)

Creates a 3D volume of unwrapped projections from a dataset onto a RBF Rectangle at multiple layers.

Parameters:
Returns:

outputChannel (ORSModel.ors.Channel) – created 3D Channel

interfacemethod extract3DProjectionChannelFromVisualCylinderOrSphere(sourceDataset: Channel, visualShape: VisualShape3D, timeStep: int = 0, minRadius: float = 0, maxRadius: float = 0, radiusIncrement: float = 0, aProgress: Progress = None) Channel

Extracts a 3D volume representing unwrapped projections of a dataset onto a cylindrical or spherical shape.

Parameters:
  • sourceDataset (ORSModel.ors.Channel) – source dataset

  • visualShape (ORSModel.ors.VisualShape3D) – a visualCylinder or a VisualSphere

  • timeStep (int) – a timeStep

  • minRadius (float) – minimum radius to extract in meters

  • maxRadius (float) – maximum radius to extract in meters

  • radiusIncrement (float) – increment between radii in meters

  • aProgress (ORSModel.ors.Progress) – progress bar

Returns:

outputChannel (ORSModel.ors.Channel) – created 3D Channel

interfacemethod extract3DProjectionChannelFromVisualRBFRectangle(sourceDataset: Channel, visualShape: VisualRBFRectangle, timeStep: int = 0, rangeInMeters: float = 0, incrementInMeters: float = 0, aProgress: Progress = None) Channel

Extracts a 3D volume representing unwrapped projections of a dataset onto a RBF Rectangle shape.

Parameters:
Returns:

outputChannel (ORSModel.ors.Channel) – created 3D Channel

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='Vertex Scalar Values')

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: str, mesh: Mesh) None

Resets the visual box of a Mesh

Deprecated since version 4.0.

Parameters:
interfacemethod resetVisualBoxOfUnstrucuredGridFromLayoutGenealogicalName(aName: str, anUnstructuredGrid: UnstructuredGrid, iTIndex: int = 0) None

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: str, mesh: Mesh, isVisible: bool) None

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: str, anUnstructuredGrid: UnstructuredGrid, isVisible: bool) None

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: str, anUnstructuredGrid: UnstructuredGrid, keepClipBox: bool) None

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: str, mesh: Mesh, aBox: Box) None

Sets the visual box of a Mesh

Deprecated since version 4.0.

Parameters:
interfacemethod setVisualBoxOfUnstructuredGridFromLayoutGenealogicalName(aName: str, anUnstructuredGrid: UnstructuredGrid, aBox: Box) None

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

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

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: str, aVectorField: VectorField, isVisible: bool) None

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: str, aVectorField: VectorField, isVisible: bool) None

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: VectorField, showArrowHead: bool, viewName: str) None

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: VectorField, useDirectionAsColor: bool, viewName: str) None

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

The visual vector field should exist.

Parameters:
  • vectorField (ORSModel.ors.VectorField) – a vectorField

  • useDirectionAsColor (bool) – True to color the vectors using their direction, False to use a LUT

  • viewName (str) – a genealogical name of a scene layout

viewhelper

class OrsHelpers.viewhelper.ViewHelper

Bases: object

Helper related to the class ORSModel.ors.View.

classmethod getIsViewInImagePlane(view: View)

Check if the view is in Image plane mode.

Parameters:

view (View) – The view to check

Returns:

output (bool) – True if the view is in image plane mode, False otherwise

classmethod getIsViewInOneForOnePixelRatio(view: View)

Check if the view is at 1:1 pixel ratio by comparing the spacing of the view with the spacing of the selected dataset. Only one direction needs to be at 1:1 ratio to consider the view at 1:1 pixel ratio.

Parameters:

view (View) – The view to check

Returns:

output (bool) – True if the view is at 1:1 pixel ratio in at least one direction, False otherwise

classmethod getIsViewInXYPlane(view: View)

Check if the view is in XY plane mode.

Parameters:

view (View) – The view to check

Returns:

output (bool) – True if the view is in XY plane mode, False otherwise

classmethod getIsViewInXZPlane(view: View)

Check if the view is in XZ plane mode.

Parameters:

view (View) – The view to check

Returns:

output (bool) – True if the view is in XZ plane mode, False otherwise

classmethod getIsViewInYZPlane(view: View)

Check if the view is in YZ plane mode.

Parameters:

view (View) – The view to check

Returns:

output (bool) – True if the view is in YZ plane mode, False otherwise

interfacemethod setPitch(pitch: float, inDegrees: bool, viewName: str, box: Box) None

set the pitch value

Parameters:
  • pitch (float) –

  • inDegrees (bool) – True if it’s in degrees, false in radians

  • viewName (str) – The genealogical name of the concerned View

  • box (ORSModel.ors.Box) – Best box from selection

interfacemethod setRoll(roll: float, inDegrees: bool, viewName: str, box: Box) None

set roll

Parameters:
  • roll (float) –

  • inDegrees (bool) – True if it’s in degrees, false in radians

  • viewName (str) – The genealogical name of the concerned View

  • box (ORSModel.ors.Box) – Best box from selection

interfacemethod setSlice(slice: int, viewName: str, aCineBox: Box) None

set slice number

Parameters:
  • slice (int) –

  • viewName (str) – The genealogical name of the concerned view

  • aCineBox (ORSModel.ors.Box) – Cine Box of the current view

interfacemethod setTimeStep(timestep: int, viewName: str) None

Set timestep

Parameters:
  • timestep (int) –

  • viewName (str) – The genealogical name of the concerned View

interfacemethod setUseMedianIn3DFromGenealogicalName(viewGenealogicalName: str, value: bool = False) None

Set the 3D setting state of the Median for a given view

Parameters:
  • viewGenealogicalName (str) – a view name

  • value (bool) – To use the Median effect or not

interfacemethod setViewInOneForOnePixelRatio(viewName: str) None

This method modifies the orthoZoomFactor of the view so that pixels in View correspond to pixels in the dataset. The method takes the top selected dataset and falls back to the top unselected dataset in case none are selected.

Parameters:

viewName (str) – a genealogical name of the View in which the selected object(s) are displayed

interfacemethod setYaw(yaw: float, inDegrees: bool, viewName: str, box: Box) None

set the yaw value

Parameters:
  • yaw (float) –

  • inDegrees (bool) – True if it’s in degrees, false in radians

  • viewName (str) – The genealogical name of the concerned View

  • box (ORSModel.ors.Box) – Best box for selection

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: str, rectangle: Rectangle) None

Fit Rectangle in View

Parameters:
interfacemethod fitBoxInViewFromLayoutGenealogicalName(aName: str, box: Box) None

Fit box in View

Parameters:
interfacemethod lookAtCenterOfMassOfROI(aROI: ROI, timeStep: int = 0) None

Move all the views to have the center of mass of the ROI in the middle of the views.

Parameters:
interfacemethod lookAtCenterOfMassOfSelectedLabelsOfMultiROI(aMultiROI: MultiROI, timeStep: int = 0) None

Move all the views to have the center of mass of the selected labels of a multi-ROI in the middle of the views.

Parameters:
interfacemethod setCameraFromLayoutGenealogicalName(aName: str, camera: Camera) None

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

Parameters:
interfacemethod setProjectionMode2DFromLayoutGenealogicalName(aName: str, projectionMode: CxvVolumeProjection_Mode) None

Set view mode

Parameters:
  • aName (str) – a genealogical name

  • projectionMode (IntEnum CxvVolumeProjection_Mode) – a viewMode

interfacemethod setViewModeFromLayoutGenealogicalName(aName: str, viewMode: CxvView_Mode) None

Set view mode

Parameters:
  • aName (str) – a genealogical name

  • viewMode (IntEnum CxvView_Mode) – a viewMode

interfacemethod setViewOrientedPlaneFromLayoutGenealogicalName(aName: str, orientedPlane: OrientedPlane, thickness: float) None

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: str, orientedPlane: OrientedPlane, box: Box) None

Sets the view orientation from box

Parameters:
interfacemethod setViewOrthoZoomFactorFromLayoutGenealogicalName(aName: str, zoomFactor: float) None

Sets the view ortho zoom factor

Parameters:
  • aName (str) – a genealogical name

  • zoomFactor (float) – a zoom factor

interfacemethod setViewPlanePositionFromLayoutGenealogicalName(aName: str, point: Vector3, center: bool) None

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: str, thickness: float) None

Sets the view plane position from genealogical name

Parameters:
  • aName (str) – a genealogical name

  • thickness (float) – a thickness in meter

interfacemethod setViewSliceIndexOfBoxFromLayoutGenealogicalName(aName: str, box: Box, sliceIndex: float) None

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

viewsplitterhelper

class OrsHelpers.viewsplitterhelper.ViewSplitterHelper

Bases: object

Helper for manipulation of instances of ViewSplitter

interfacemethod createViewSplitter() ViewSplitter

Creates a new ViewSplitter

Returns:

aViewSplitter (ORSModel.ors.ViewSplitter) – new ViewSplitter

visualboxhelper

class OrsHelpers.visualboxhelper.VisualBoxHelper

Bases: object

Helper for manipulation of instances of VisualBox

interfacemethod alignBoxWithDirection(aVisualBox: VisualBox, aDirection: Vector3, timestep: int) None

Aligns the direction0 of the VisualBox with the provided direction

Parameters:
interfacemethod createVisualBoxFromBoundingBox(aDataset: ORSModel.ors.UnstructuredGrid | ORSModel.ors.ROI | ORSModel.ors.MultiROI, timeStep: int = 0) VisualBox

Create the bounding box of an ROI or multi-ROI or Unstructured Grid (Graph, Mesh, Vector Field) Object.

Parameters:
Returns:

aVisualBox (ORSModel.ors.VisualBox) – new VisualBox

interfacemethod createVisualBoxFromBox(aBox: Box) VisualBox

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 createVisualBoxFromClipBox(aDataset: ORSModel.ors.StructuredGrid | ORSModel.ors.UnstructuredGrid, timeStep: int = 0) VisualBox

Extract the clip box of a Structured or Unstructured Grid Object.

Parameters:
Returns:

aVisualBox (ORSModel.ors.VisualBox) – new VisualBox

classmethod createVisualBoxesFromList(boxList: Optional[list[ORSModel.ors.Box]] = None)

Creates visual boxes from a list of boxes.

interfacemethod moveFaceSoThatDirectionHasSize(aVisualBox: VisualBox, movingFaceIndex: int, newSize: float, timestep: int) None

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: VisualBox, rotationAxis: Vector3, movingFaceIndex: int, pointToAlignMovingFaceCenter: Vector3, timestep: int) None

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: VisualBox, box: Box, timestep: int) None

Sets the box of a VisualBox

Parameters:
interfacemethod setCenter(aVisualBox: VisualBox, center: Vector3, timestep: int) None

Sets the location of the center of a VisualBox

Parameters:
interfacemethod setDirection0Size(aVisualBox: VisualBox, direction0Size: float, timestep: int) None

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: VisualBox, direction1Size: float, timestep: int) None

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: VisualBox, direction2Size: float, timestep: int) None

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: VisualBox, faceIndex: int, faceCenter: Vector3, timestep: int) None

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: VisualCapsule, aDirection: Vector3, timestep: int) None

Aligns the main axis of the VisualCapsule with the provided direction

Parameters:
interfacemethod createVisualCapsuleFromBox(aBox: Box) VisualCapsule

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: VisualCapsule, cap1Center: Vector3, timestep: int) None

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

Parameters:
interfacemethod setCap2Center(aVisualCapsule: VisualCapsule, cap2Center: Vector3, timestep: int) None

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

Parameters:
interfacemethod setCapsule(aVisualCapsule: VisualCapsule, capsule: Capsule, timestep: int) None

Sets the capsule of a VisualCapsule

Parameters:
interfacemethod setCenter(aVisualCapsule: VisualCapsule, center: Vector3, timestep: int) None

Sets the location of the center of a VisualCapsule

Parameters:
interfacemethod setHeight(aVisualCapsule: VisualCapsule, height: float, timestep: int) None

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: VisualCapsule, cap2IsMoving: bool, height: float, timestep: int) None

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: VisualCapsule, radius: float, timestep: int) None

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: str, parentNode: Union[Channel, MultiROI, Mesh], value: bool) None

Sets the visibility of a Visual color bar

Parameters:
interfacemethod setLookupTableForViewFromLayoutGenealogicalName(aName: str, parentNode: Union[Channel, MultiROI, Mesh], lutUUID: str) None

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: VisualCylinder, aDirection: Vector3, timestep: int) None

Aligns the main axis of the VisualCylinder with the provided direction

Parameters:
interfacemethod createVisualCylinderFromBox(aBox: Box) VisualCylinder

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: VisualCylinder, cap1Center: Vector3, timestep: int) None

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

Parameters:
interfacemethod setCap2Center(aVisualCylinder: VisualCylinder, cap2Center: Vector3, timestep: int) None

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

Parameters:
interfacemethod setCenter(aVisualCylinder: VisualCylinder, center: Vector3, timestep: int) None

Sets the location of the center of a VisualCylinder

Parameters:
interfacemethod setCylinder(aVisualCylinder: VisualCylinder, cylinder: Cylinder, timestep: int) None

Sets the cylinder of a VisualCylinder

Parameters:
interfacemethod setHeight(aVisualCylinder: VisualCylinder, height: float, timestep: int) None

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: VisualCylinder, cap2IsMoving: bool, height: float, timestep: int) None

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: VisualCylinder, radius: float, timestep: int) None

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.

visualrectanglehelper

class OrsHelpers.visualrectanglehelper.VisualRectangleHelper

Bases: object

Helper for manipulation of instances of VisualRectangle

interfacemethod alignRectangleWithDirection(aVisualRectangle: VisualRectangle, aDirection: Vector3, timestep: int) None

Aligns the main axis of the VisualRectangle with the provided direction

Parameters:
interfacemethod createVisualRectangleFromBox(aBox: Box) VisualRectangle

Creates a new VisualRectangle in the limits of the provided box

Parameters:

aBox (ORSModel.ors.Box) – a box

Returns:

aVisualRectangle (ORSModel.ors.VisualRectangle) – new VisualRectangle

interfacemethod setCenter(aVisualRectangle: VisualRectangle, center: Vector3, timestep: int) None

Sets the location of the center of a VisualRectangle

Parameters:
interfacemethod setRectangle(aVisualRectangle: VisualRectangle, rectangle: Rectangle, timestep: int) None

Sets the rectangle of a VisualRectangle

Parameters:

visualspherehelper

class OrsHelpers.visualspherehelper.VisualSphereHelper

Bases: object

Helper for manipulation of instances of VisualSphere

interfacemethod createVisualSphereFromBox(aBox: Box) VisualSphere

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: VisualSphere, center: Vector3, timestep: int) None

Sets the location of the center of a VisualSphere

Parameters:
interfacemethod setRadius(aVisualSphere: VisualSphere, radius: float, timestep: int) None

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: VisualSphere, sphere: Sphere, timestep: int) None

Sets the sphere of a VisualSphere

Parameters:

visualsurfacecontrolpointshelper

class OrsHelpers.visualsurfacecontrolpointshelper.VisualSurfaceControlPointsHelper

Bases: object

Helper for manipulation of instances of sub classes ofVisualSurfaceControlPoints

interfacemethod createBoundingRectangleFromPointsAndPlane(points: List[Vector3], plane: Plane, center: Vector3, margin: float = 0.0) ORSModel.ors.Rectangle | None

Creates a bounding rectangle from a list of points and a fitted plane. Uses the margin of control points to define the boundary of the rectangle.

Parameters:
Returns:

rect (ORSModel.ors.Rectangle) – bounding Rectangle

interfacemethod createVisualBezierPatchFromRectangle(aRectangle: Rectangle, uControlPointCount: int = 5, vControlPointCount: int = 5, timeSize: int = 1) VisualBezierPatch

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 createVisualRBFRectangleFromPointAnnotation(aVisualPoints: VisualPoints, timeStep: int = 0) ORSModel.ors.VisualRBFRectangle | None

Creates a VisualRBFRectangle using points from VisualPoints as control points. Automatically fits a plane to the points and creates a bounding rectangle.

Parameters:
  • aVisualPoints (ORSModel.ors.VisualPoints) – a VisualPoints annotation containing the control points

  • timeStep (int) – the time step to use

Returns:

aVisualRBFRectangle (ORSModel.ors.VisualRBFRectangle) – created VisualRBFRectangle

interfacemethod createVisualRBFRectangleFromRectangle(aRectangle: Rectangle, uControlPointCount: int = 5, vControlPointCount: int = 5, timeSize: int = 1) VisualRBFRectangle

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 fillControlPointsFromPointAnnotation(aRBFRectangle: RBFRectangle, aVisualPoints: VisualPoints, aRectangle: Rectangle, timeStep: int = 0) None

Sets the control points from the VisualPoints annotation

Parameters:
interfacemethod fillControlPointsFromRectangle(aSurfaceControlPoints: SurfaceControlPoints, aRectangle: Rectangle, uControlPointCount: int = 5, vControlPointCount: int = 5) None

Sets the controlPoints from rectangle

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

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: int, aControlPoint: Vector3, timestep: int = 0) None

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) None

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: Channel) None

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 convertWindowLeveling(workingObject: Channel, currentWidthRaw2D, currentCenterRaw2D, currentWidthRaw3D, currentCenterRaw3D, layout)

Convert and apply the window leveling values from raw to physical units for both 2D and 3D visualizations.

Parameters:
  • workingObject (ORSModel.ors.Channel) – Source channel for which window leveling values are to be applied.

  • currentWidthRaw2D (float) – Current window width in raw units for 2D visualization.

  • currentCenterRaw2D (float) – Current window center in raw units for 2D visualization.

  • currentWidthRaw3D (float) – Current window width in raw units for 3D visualization.

  • currentCenterRaw3D (float) – Current window center in raw units for 3D visualization.

  • layout (ORSModel.ors.Layout) – The layout associated with the workingObject for which the window leveling values are set.

classmethod createVolumeForChannel(aChannel0, aChannel1=None, aChannel2=None, aChannel3=None, layout=None)

Creates a volume from a set of channels

Parameters:
Returns:
classmethod getCurrentWindowLeveling(workingObject: Channel)

Convert the current window leveling of a Channel for both 2D and 3D to raw units and find the Layout

Parameters:

workingObject (ORSModel.ors.Channel) – Source channel from which window leveling and layout details are extracted

Returns:
  • currentWidthRaw2D (float) – Current window width in raw units for 2D visualization.

  • currentCenterRaw2D (float) – Current window center in raw units for 2D visualization.

  • currentWidthRaw3D (float) – Current window width in raw units for 3D visualization.

  • currentCenterRaw3D (float) – Current window center in raw units for 3D visualization.

  • layout (ORSModel.ors.Layout) – The layout associated with the workingObject for which the window leveling values are set.

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: Channel) None

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: Channel, rangeMinInPhysicalUnits: float, rangeMaxInPhysicalUnits: float) None

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 set3DIsovalueFromGenealogicalName(workingObject: Channel, viewGenealogicalName: str, value: float = 50) None

Set the 3D setting Isovalue for a given view

Parameters:
  • workingObject (ORSModel.ors.Channel) – a Channel on which the Isovalue setting is applied

  • viewGenealogicalName (str) – a view name

  • value (float) – the value of Isovalue (0-100)

interfacemethod set3DSolidityFactorFromGenealogicalName(workingObject: Channel, viewGenealogicalName: str, value: float = 1500) None

Set the 3D setting Solidity for a given view

Parameters:
  • workingObject (ORSModel.ors.Channel) – a Channel on which the solidity is applied

  • viewGenealogicalName (str) – a view name

  • value (float) – the value of solidity (between 1 - 3000)

interfacemethod setDiffuseFactorFromGenealogicalName(workingObject: Channel, viewGenealogicalName: str, value: float = 50) None

Set the 3D setting Diffuse for a given view

Parameters:
  • workingObject (ORSModel.ors.Channel) – a Channel on which the diffuse setting is applied

  • viewGenealogicalName (str) – a view name

  • value (float) – the value of diffuse (0-100)

interfacemethod setEdgeContrastFactorFromGenealogicalName(workingObject: Channel, viewGenealogicalName: str, value: float = 50) None

Set the 3D setting Edge Contrast for a given view

Parameters:
  • workingObject (ORSModel.ors.Channel) – a Channel on which the Edge Contrast setting is applied

  • viewGenealogicalName (str) – a view name

  • value (float) – the value of Edge Contrast (0-100)

interfacemethod setSecondLevelingStatus(dataset: Channel, isEnabled: bool) None

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

interfacemethod setShininessFromGenealogicalName(workingObject: Channel, viewGenealogicalName: str, value: float = 150) None

Set the 3D setting Shininess for a given view

Parameters:
  • workingObject (ORSModel.ors.Channel) – a Channel on which the Shininess setting is applied

  • viewGenealogicalName (str) – a view name

  • value (float) – the value of Shininess (0-300)

interfacemethod setSpecularFactorFromGenealogicalName(workingObject: Channel, viewGenealogicalName: str, value: float = 50) None

Set the 3D setting Specular for a given view

Parameters:
  • workingObject (ORSModel.ors.Channel) – a Channel on which the Specular setting is applied

  • viewGenealogicalName (str) – a view name

  • value (float) – the value of Specular (0-100)

interfacemethod setUseDenoiseIn3DFromGenealogicalName(workingObject: Channel, viewGenealogicalName: str, value: bool = False) None

Set the 3D setting state of the Denoise for a given view

Parameters:
  • workingObject (ORSModel.ors.Channel) – a Channel on which the Denoise setting is applied

  • viewGenealogicalName (str) – a view name

  • value (bool) – To use the Denoise effect or not

interfacemethod setUseEdgeContrastFromGenealogicalName(workingObject: Channel, viewGenealogicalName: str, value: bool = False) None

Set the 3D setting state of the Edge Contrast for a given view

Parameters:
  • workingObject (ORSModel.ors.Channel) – a Channel on which the Edge Contrast setting is applied

  • viewGenealogicalName (str) – a view name

  • value (bool) – To use the Edge Contrast effect or not

interfacemethod setUseFilteredGradientIn3DFromGenealogicalName(workingObject: Channel, viewGenealogicalName: str, value: bool = False) None

Set the 3D setting state of the Filtered Gradient for a given view

Parameters:
  • workingObject (ORSModel.ors.Channel) – a Channel on which the Filtered Gradient setting is applied

  • viewGenealogicalName (str) – a view name

  • value (bool) – To use the Filtered Gradient effect or not

interfacemethod setUseHighQualityIn3DFromGenealogicalName(workingObject: Channel, viewGenealogicalName: str, value: bool = False) None

Set the 3D setting state of the High Quality for a given view

Parameters:
  • workingObject (ORSModel.ors.Channel) – a Channel on which the High Quality setting is applied

  • viewGenealogicalName (str) – a view name

  • value (bool) – To use the High Quality effect or not

interfacemethod setUseSpecularBoostIn3DFromGenealogicalName(workingObject: Channel, viewGenealogicalName: str, value: bool = False) None

Set the 3D setting state of the Specular Boost for a given view

Parameters:
  • workingObject (ORSModel.ors.Channel) – a Channel on which the Specular Boost setting is applied

  • viewGenealogicalName (str) – a view name

  • value (bool) – To use the Specular Boost effect or not

interfacemethod setUseToneMappingIn3DFromGenealogicalName(workingObject: Channel, viewGenealogicalName: str, value: bool = False) None

Set the 3D setting state of the Tone Mapping for a given view

Parameters:
  • workingObject (ORSModel.ors.Channel) – a Channel on which the Tone Mapping setting is applied

  • viewGenealogicalName (str) – a view name

  • value (bool) – To use the Tone Mapping effect or not

interfacemethod setUseUnsharpIn3DFromGenealogicalName(workingObject: Channel, viewGenealogicalName: str, value: bool = False) None

Set the 3D setting state of the Unsharp for a given view

Parameters:
  • workingObject (ORSModel.ors.Channel) – a Channel on which the Unsharp setting is applied

  • viewGenealogicalName (str) – a view name

  • value (bool) – To use the Unsharp effect or not

vtkhelpers

class OrsHelpers.vtkhelpers.VtkPolyDataToFromOrsMeshHelper

Bases: object

watershedhelper

class OrsHelpers.watershedhelper.WatershedHelper

Bases: object

Helper for performing a watershed (segmentation algorithm).