OrsImageProcessing¶
Tool to apply a set of filters to datasets
- author:
Dragonfly Team
- contact:
- email:
- organization:
Comet Technologies Canada Inc.
- address:
460 Ste-Catherine Ouest, suite 600, Montréal, Québec, Canada, H3B 1A7
- copyright:
Comet Technologies Canada Inc. All rights reserved 2023.
- date:
Dec 22 2016 11:58
- dragonflyVersion:
3.5
- UUID:
bb7822c0761411e7a1d5448a5b5d70c0
Class Code¶
- class OrsPythonPlugins.OrsImageProcessing.orsimageprocessing.OrsImageProcessing(*args, **kwargs)¶
- interfacemethod addOperation(filterCategory: str, filterName: str, configuration: str = '', uuid: str = None) str¶
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: str, idx: int, title: str) Channel¶
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
- Anonymize title:
True
- Returns:
output (ORSModel.ors.Channel) – the new channel
- interfacemethod applyOperationStackFromXML(anXML: str, inputDataset: Channel, generateOutputDataset: bool, outputChannelTitle: str = '') bool¶
Apply a filter stack describe by an XML in string format
- Parameters:
anXML (str) – xml description of the operation
inputDataset (ORSModel.ors.Channel) – input dataset to be used for dataset 3D normals evaluation
generateOutputDataset (bool) – create an output dataset
outputChannelTitle (str) – the name of the output channel
- Returns:
output (bool) –
- interfacemethod applySetupDescriptionsToOperation(description: str, operationID: str) bool¶
- Parameters:
description (str) – xml description of the operation
operationID (str) –
- Returns:
output (bool) –
- 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() None¶
clear all operations
- classmethod computeOutput(node, outputRange=None)¶
Given an operation, calculate the output
- Parameters:
node – an operation
outputRange – the range to calculate
- Returns:
output –
- interfacemethod computeOutputs() str¶
Compute the outputs of the compute graph
- Returns:
output (str) – status
- interfacemethod computeOutputsForSpecificSlices(slices: str, crop_to_slices: bool) str¶
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:
the operationId from which the preview is derived,
the preview Channel GUID to write in
the View GUID that the output channel is being displayed on
- Parameters:
previews –
- Return:
- interfacemethod connectOperationOutputToOperationInput(outOperation: str, outIdx: int, inOperation: str, inIdx: int) bool¶
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
- 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:
- displayTextOnView(text: str, view: View)¶
This is used to show Original and Preview on the display Also, create invisible visualText for channel names
- Parameters:
text –
view –
- Return:
- getBoundedPlaneCoordinatesForInputChannel(channelGUID) -> (<class 'bool'>, <class 'list'>, <class 'ORSModel.ors.Camera'>, <class 'ORSModel.ors.View'>, <class 'ORSModel.ors.Rectangle'>)¶
returns the visible range of the input channel guid on the display
- Parameters:
channelGUID –
- Return:
returns true if the channel is displayed in our context
- Return:
list of indexes of the range
- Return:
the current camera of this view
- Return:
the view
- Return:
the rectangle as a box of our view
- classmethod getMainFormClass()¶
Gets the class of the main form
- Returns:
output –
- interfacemethod inputOutputCountChanged(operationId: str, nInputs: int, nOutputs: int) bool¶
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
- 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. IfFalse, no call to show the form is made.
- interfacemethod populateListOfAvailableFilters(refresh: bool = False, hide3DFilters: bool = False) None¶
Populate the list of available filters
- Parameters:
refresh (bool) – should the list be refreshed
hide3DFilters (bool) – for Dragonfly 2D option to hide 3D filters
- interfacemethod removeOperation(operationId: str) bool¶
- Parameters:
operationId (str) – the operation id to remove
- Returns:
output (bool) – true if the operationId existed and is succesfully removed
- interfacemethod setOperationConfiguration(operationId: str, configuration: str) bool¶
- Parameters:
operationId (str) –
configuration (str) – xml configuration obtained from filter.getSetupDescription
- Returns:
output (bool) – if the function was succesful
- interfacemethod setOperationInputChannel(operationId: str, idx: int, channel: Channel) bool¶
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: str, outIdx: int, channel: Channel) bool¶
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: str, structuredGrid: StructuredGrid) bool¶
set the shape and position of the output channel from a structured grid.
- Parameters:
operationId (str) – the operation id
structuredGrid (ORSModel.ors.StructuredGrid) – the shape to copy from
- Returns:
output (bool) – true if operation was succesful, false otherwise
- interfacemethod setOperationOutputType(outOperation: str, outIdx: int, outputType: CxvChannel_Data_Type) bool¶
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 startupDefault(openMainForm=True, operationStackFilename=None, allowImageFileImport=True, objectGUIDList=None)¶
Creates an instance of the plugin class and opens the main form (if required) at the default position.
- Returns:
output (AbstractPlugin) – plugin instance
- interfacemethod validateOperations() str¶
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: