OrsImageProcessing

Tool to apply a set of filters to datasets

author:ORS Team
contact:http://theobjects.com
email:info@theobjects.com
organization:Object Research Systems (ORS), Inc.
address:760 St-Paul West, suite 101, Montréal, Québec, Canada, H3C 1M4
copyright:Object Research Systems (ORS), Inc. All rights reserved 2020.
date:Dec 22 2016 11:58
dragonflyVersion:
 3.5
UUID:bb7822c0761411e7a1d5448a5b5d70c0

Class Code

class OrsPythonPlugins.OrsImageProcessing.orsimageprocessing.OrsImageProcessing(varname=None, managed=True)
classmethod OrsImageProcessing_openToolbox()
PLUGIN_ORS2DLUT = 'Ors2DLUT'
PLUGIN_ORSBASICMANIPULATE = 'OrsBasicManipulate'
PLUGIN_ORSCONTEXTMENU = 'OrsContextMenu'
PLUGIN_ORSDISPLAYPROPERTIES = 'OrsDisplayProperties'
PLUGIN_ORSHIGHLIGHTMANAGER = 'OrsHighlightManager'
PLUGIN_ORSLEGENDMANIPULATOR = 'OrsLegendManipulator'
PLUGIN_ORSMARKEDSLICESMANIPULATOR = 'OrsMarkedSlicesManipulator'
PLUGIN_ORSOBJECTPROPERTIESLIST = 'OrsObjectPropertiesList'
PLUGIN_ORSPRIMITIVEMANIPULATOR = 'OrsPrimitiveManipulator'
PLUGIN_ORSPROBE = 'OrsProbe'
PLUGIN_ORSSCALEBARMANIPULATOR = 'OrsScaleBarManipulator'
PLUGIN_ORSSTATESELECTOR = 'OrsStateSelector'
PLUGIN_ORSTEXTPRESENTERMANAGER = 'OrsTextPresenterManager'
PLUGIN_ORSWINDOWLEVELING = 'OrsWindowLeveling'
PLUGIN_SCENEVIEWSYNCHRONIZER = 'OrsSceneViewSynchronizer'
UIDescriptors = [<ORSServiceClass.OrsPlugin.uidescriptor.UIDescriptor object>, <ORSServiceClass.OrsPlugin.uidescriptor.UIDescriptor object>]
interfacemethod addOperation(filterCategory, filterName, configuration='', uuid=None)

add an operation to the stack

Parameters:
  • filterCategory (str) – category of the filter
  • filterName (str) – name of the filter
  • configuration (str) – xml configuration of the filter
  • uuid (str) – str
Returns:

output (str) – operationId or empty string if the operation was invalid

interfacemethod addOutputNode(operationId, idx, title)

add a node that will result in a new output channel being generated after an operation

Parameters:
  • operationId (str) – the id of the operation
  • idx (int) – the index of the output channel to saave
  • title (str) – title of the new channel
Returns:

output (ORSModel.ors.Channel) – the new channel

classmethod applyOperationStack(fname, inputDataset, generateOutputDataset)
interfacemethod applySetupDescriptionsToOperation(description, operationID)
Parameters:
  • description (str) – xml description of the operation
  • operationID (str) –
Returns:

output (bool) –

availableOperations = []
availableOperationsDict = {}
cleanup()

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

interfacemethod clearOperations()

clear all operations

closable = True
computeGraph = <networkx.classes.digraph.DiGraph object>
classmethod computeOutput(node, outputRange=None)

Given an operation, calculate the output

Parameters:
  • node – an operation
  • outputRange – the range to calculate
Returns:

output

interfacemethod computeOutputs()

Compute the outputs of the compute graph

Returns:output (str) – status
interfacemethod computeOutputsForSpecificSlices(slices, crop_to_slices)

Compute the outputs of the compute graph for specific slices only. Indexes for slices should be 1 based, i.e. The first slice in z is slice 1.

Parameters:
  • slices (str) – a string formatted slices compatible with pynumparser
  • crop_to_slices (bool) – if True, the output channel will only contain the selected slices. Otherwise, the output will be the same as the input with the selected slices replaced
Returns:

output (str) – status

computePreviews(previews)
This function will compute previews. The previews is a list of tuples containing:
  1. the operationId from which the preview is derived,
  2. the preview Channel GUID to write in
  3. the View GUID that the output channel is being displayed on
Parameters:previews
Return:
interfacemethod connectOperationOutputToOperationInput(outOperation, outIdx, inOperation, inIdx)

set the output from one operation as the input of another operation

Parameters:
  • outOperation (str) – the id of the output operation
  • outIdx (int) – the index of the output channel
  • inOperation (str) – the id of the input operation
  • inIdx (int) – the index of the input channel
Returns:

output (bool) – a boolean if the operation was successful

classmethod copyOutputsToFinalOutputs(isInApply: bool, finalOutputsThatAreToBeKept, status)
classmethod deleteOutputs()
classmethod deleteProgressBar()
disableSceneSynchronization(views)

Disables the scene view synchronization for each view.

Returns a type containing:
1: scene view instance 2: list of status of the zoom sync status 3: list of status of the position sync status
Parameters:views
Return:
classmethod disconnectPredecessorEdge(operationId, previousInput)
displayTextOnView(text: str, view: ORSModel.ors.View)

This is used to show Original and Preview on the display Also, create invisible visualText for channel names

Parameters:
  • text
  • view
Return:
fitToView(view: ORSModel.ors.View)
getAnnotationPublishedCallbackId()
static getAvailableOperationStacks()
getBoundedPlaneCoordinatesForInputChannel(channelGUID) -> (<class 'bool'>, <class 'ORSModel.ors.Rectangle'>, <class 'ORSModel.ors.Camera'>, <class 'ORSModel.ors.View'>)

returns the visible range of the input channel guid on the display

Parameters:
  • channelGUID
  • outputChannel
Return:

returns true if the channel is displayed in our context

Return:

the rectangle as a box of our view

Return:

the current camera of this view

Return:

the view

classmethod getContextName()
getContextualViews() → List[ORSModel.ors.View]
Return:
Rtype:list[ors.Views]
classmethod getIsOperationsStackValid(fname)
classmethod getMainFormClass()

Gets the class of the main form

Returns:output
classmethod getOperationCategoryFromFilterName(filterName)
classmethod getOperationInputChannel(operationId, idx) → str
classmethod getOperationsStackDescription(fname)
classmethod getOperationsStackOutputChannelName(fname)
classmethod getOutputs()
classmethod getPluginInstance(operationId)
classmethod getProgressBarGUID()
getVisualChannelCallbackId()
interfacemethod inputOutputCountChanged(operationId, nInputs, nOutputs)

the number of operations changed for an operation

Parameters:
  • operationId (str) – id of the operation to change
  • nInputs (int) – the new number of inputs
  • nOutputs (int) – the new number of outputs
Returns:

output (bool) – success

keepAlive = False
classmethod loadConfiguration(fileLocation)
loadOperationsStack(fname)
modalContext = True
multiple = False
openWidget(name, dock=None, tab=None, x=-1, y=-1, w=-1, l=-1, order=0, show=True)

Instantiates the widget with the provided name. This is done only if it is not already instantiated.

Parameters:
  • name (str) – name of the widget to instantiate
  • dock (str) – docking location in the main window (left, right, top, bottom, center, floating)
  • tab (str) – name of the tab to dock in
  • x (int) – position of top left corner of window in x. Use -1 for default value.
  • y (int) – position of top left corner of window in y. Use -1 for default value.
  • w (int) – width of window. Use -1 for default value.
  • l (int) – height of window. Use -1 for default value.
  • order (int.) – position of widget in docking location. Use -1 to put at the end.
  • show (bool) – if True, the form is also shown after being instantiated. If the form already exists, a “raise” is done. If False, no call to show the form is made.
interfacemethod populateListOfAvailableFilters(refresh=False)

Populate the list of available filters

Parameters:refresh (bool) – should the list be refreshed
privateObjects = False
progressBarId = None
classmethod reconnectSceneSynchronization(views, sync, zoomSynced, panSynced)
interfacemethod removeOperation(operationId)
Parameters:operationId (str) – the operation id to remove
Returns:output (bool) – true if the operationId existed and is succesfully removed
interfacemethod removeOutputs()
restrictPlugins = True
savable = True
classmethod saveConfiguration(fileLocation)
interfacemethod setOperationConfiguration(operationId, configuration)
Parameters:
  • operationId (str) –
  • configuration (str) – xml configuration obtained from filter.getSetupDescription
Returns:

output (bool) – if the function was succesful

interfacemethod setOperationInputChannel(operationId, idx, channel)

set the input of an operation to a an existing channel

Parameters:
  • operationId (str) – the id of the operation
  • idx (int) – the index of the input channel to set
  • channel (ORSModel.ors.Channel) – the channel
Returns:

output (bool) – status

interfacemethod setOperationOutput(outoperation, outIdx, channel)

set one of the output operations to an existing channel

Parameters:
  • outoperation (str) – the operation id
  • outIdx (int) – output index
  • channel (ORSModel.ors.Channel) – the existing channel
Returns:

output (bool) – if the operation was successful

classmethod setOperationOutputRange(operationId, outIdx, outputRange)

Internal usage

This will set the index of first voxel for the channel and the range to calculate on

Parameters:
  • operationId – the output operation id
  • outIdx – the index of the operation
  • outputRange – the range to calculate [x min, y min, z min, t min, x max, y max, z max, t max] or a bounded plane if the output has a defined shape
Type:

str

Type:

int

Type:

list[str]

Returns:

output (bool) – status

interfacemethod setOperationOutputShapeFromStructruredGrid(operationId, structuredGrid)

set the shape and position of the output channel from a structured grid.

Parameters:
Returns:

output (bool) – true if operation was succesful, false otherwise

interfacemethod setOperationOutputType(outOperation, outIdx, outputType)

set the output type of an operation

Parameters:
  • outOperation (str) – the operation id
  • outIdx (int) – the output index
  • outputType (IntEnum CxvChannel_Data_Type) – the output type, defined by ORSDEF
Returns:

output (bool) – success or not

classmethod setProgressBar()
showInToolbar = True
classmethod startupDefault(openMainForm=True, operationStackFilename=None)

Creates an instance of the plugin class and opens the main form (if required) at the default position.

Returns:output (AbstractPlugin) – plugin instance
title = 'OrsImageProcessing'
classmethod toolsMenu()
updateViewVisualText(text: str, channel=None, views=None)
interfacemethod validateOperations()

Determines if the stack of operations is valid. It will only chec if the parameters of the operation are valid.

Returns a string. If the length of the string is 0, it means it is valid.

Returns:output (str) –
classmethod validateThatAllOperationsLeadingToThisOperationHasInputs(operationId)

validate that allOperations leading to this operation has an input and output :param operationId: :return:

version = '1.0'