List

Inheritance diagram

Inheritance diagram of ORSModel.ors.List, ORSModel.ors.ORSBaseClass

Classes

List

class ORSModel.ors.List

Bases: ORSBaseClass

A list of Managed instances.

See also

Managed, Node A list of Managed instances.

Several methods in the SDK return lists of objects. Some typecasts are necessary to convert Object instances to their correct type

because all services of List take or return only Managed instances.

add(self, pObject: ORSModel.ors.Managed)

Adds an object to the list.

Parameters:

pObject (ORSModel.ors.Managed) – an object (an Object)

appendAllObjects(self, pList: ORSModel.ors.List)

Note

All objects are taken from the appended list, whether or not they are already in the receiver list.

Parameters:

pList (ORSModel.ors.List) –

appendNonPresentObjects(self, pList: ORSModel.ors.List)

Note

Only the objects not already in the receiver are taken from the appended list.

Parameters:

pList (ORSModel.ors.List) –

getAllElementsOfClass(self, pProgId: str) ORSModel.ors.List

Note

Use static class names to search for objects (e.g. ORS::ReferenceFrame::getClassNameStatic())).

Parameters:

pProgId (str) – the class name of the class to test against (a string)

Returns:

output (ORSModel.ors.List) – a list (a List)

getClassNameStatic() str
Returns:

output (str) –

getCount(self) int

Returns the count of objects in the list.

Returns:

output (int) – object count (an uint32_t)

getIncludes(self, pObject: ORSModel.ors.Managed) bool

Verifies if an object is present in the list.

Parameters:

pObject (ORSModel.ors.Managed) – an object (an Object)

Returns:

output (bool) – true if object is in the list, false otherwise

getIndexOf(self, pObject: ORSModel.ors.Managed) int

Returns the index of an object in the list or -1 if not found.

Parameters:

pObject (ORSModel.ors.Managed) –

Returns:

output (int) –

getIntersectionWith(self, pList: ORSModel.ors.List) ORSModel.ors.List

Returns the intersection of the list with another list.

Note

Objects duplicated in both lists only appear once in the intersected list.

Parameters:

pList (ORSModel.ors.List) – a list (a List)

Returns:

output (ORSModel.ors.List) – a new list (a List)

getObjectAt(self, pos: int) ORSModel.ors.Managed

Gets an object from the list at the specified index.

Note

Index starts at zero (zero-based).

Note

When the type of the object is known, you can pre-type it as it will automatically typecast to the correct type, for example: Channel chan = someList.getObjectAt(0). If the object at index 0 is not a channel, chan will be none.

Parameters:

pos (int) – an index (an uint32_t)

Returns:

output (ORSModel.ors.Managed) – an object (a Managed)

getPythonRepresentation(self) str

Returns the python representation of the list.

Returns:

output (str) – std::wstring

getSubtractionFrom(self, pList: ORSModel.ors.List) ORSModel.ors.List

Note

The subtraction results in a list of objects only in the receiver (union of both lists is removed from the list, or A - (A U B)).

Parameters:

pList (ORSModel.ors.List) –

Returns:

output (ORSModel.ors.List) –

getUnionWith(self, pList: ORSModel.ors.List) ORSModel.ors.List

Returns the union of the list with another list.

Note

Objects duplicated in both lists only appear once in the unionized list.

Parameters:

pList (ORSModel.ors.List) – a list (a List)

Returns:

output (ORSModel.ors.List) – a new list (a List)

isNone(self) bool

Checks if the object is none.

Returns:

output (bool) –

isNotNone(self) bool

Checks if the object is not none.

Returns:

output (bool) –

loadEmptyObjectsFromFile(self, sFilename: str, classNames: List[str])

Note

This is meant to quickly analyze an object or session file to know what types of objects are within. An empty object of the correct class will be created for every object defined in the file.

Note

Once you’re done with the list, you need to send deleteObject() to all objects within.

Note

The filter list should be a list of class names to filter on, for example, to load only ROI and MultiROI objects, one would specify ROI::getClassNameStatic() and MultiROI::getClassNameStatic().

Parameters:
  • sFilename (str) – an input filename (a string)

  • classNames (List[str]) – list of class names (see note)

loadFromFile(self, sFilename: str, preserveIdentity: bool, progress: ORSModel.ors.Progress)

Note

This illustrates the meaning of the “preserve identity” argument: if you load a file that has the same object twice in a row, if you preserve identity you’ll obtain 1 object, if you don’t preserve identity you’ll obtain 2 objects (both having the same internal state).

Parameters:
  • sFilename (str) – true to preserve identity, false otherwise (see note)

  • preserveIdentity (bool) – an optional progress object

  • progress (ORSModel.ors.Progress) –

loadFromFileFiltered(self, sFilename: str, preserveIdentity: bool, classNames: List[str], progress: ORSModel.ors.Progress)

Note

This illustrates the meaning of the “preserve identity” argument: if you load a file that has the same object twice in a row, if you preserve identity you’ll obtain 1 object, if you don’t preserve identity you’ll obtain 2 objects (both having the same internal state).

Note

The filter list should be a list of class names to filter on, for example, to load only ROI and MultiROI objects, one would specify ROI::getClassNameStatic() and MultiROI::getClassNameStatic().

Parameters:
  • sFilename (str) – an input filename (a string)

  • preserveIdentity (bool) – true to preserve identity, false otherwise (see note)

  • classNames (List[str]) – list of class names (see note)

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

loadSpecificObjectsFromFile(self, sFilename: str, preserveIdentity: bool, guids: List[str], progress: ORSModel.ors.Progress)

Note

This illustrates the meaning of the “preserve identity” argument: if you load a file that has the same object twice in a row, if you preserve identity you’ll obtain 1 object, if you don’t preserve identity you’ll obtain 2 objects (both having the same internal state).

Parameters:
  • sFilename (str) – an input filename (a string)

  • preserveIdentity (bool) – true to preserve identity, false otherwise (see note)

  • guids (List[str]) – list of GUIDs to load

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

none() List
Returns:

output (List) –

remove(self, pObject: ORSModel.ors.Managed) bool

Removes an object from the list.

Parameters:

pObject (ORSModel.ors.Managed) – an object (an Object)

Returns:

output (bool) – true if object was removed, false otherwise (it wasn’t in the list)

saveToFile(self, sFilename: str, iCompressionEngine: int = 1) int

Saves all the objects in the list to a file.

Parameters:
  • sFilename (str) – an output filename (a string)

  • iCompressionEngine (int) – the input compression engine (0: None, 1: ZSTD)

Returns:

output (int) – a result (an int, 0 for no error, otherwise an error code)

saveToFileToLegacyFormat(self, sFilename: str, iCompressionEngine: int = 1) int

Saves all the objects in the list to a file in the legacy (2022.2) format.

Parameters:
  • sFilename (str) – an output filename (a string)

  • iCompressionEngine (int) – the input compression engine (0: None, 1: ZSTD)

Returns:

output (int) – a result (an int, 0 for no error, otherwise an error code)

ORSBaseClass

class ORSModel.ors.ORSBaseClass

An abstract class from which all objects issued from the ORS Core Library inherit.

getPythonTraceBack() List[str]

Set the python traceback for a call from python.

Returns:

output (List[str]) –

isManaged(self) bool
Returns:

output (bool) –

isNone(self) bool
Returns:

output (bool) –

setPythonTraceBack(tb: List[str])

Set the python traceback for a call from python.

Parameters:

tb (List[str]) –