OrsFilterArithmetic

Filter for arithmetic operations, using NumPy

author:

Dragonfly Team

contact:

https://dragonfly.comet.tech

email:

support.dragonfly@comet.tech

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:

Oct 13 2015 17:16

dragonflyVersion:

3.0

UUID:

a10dad14ea3211e6a8e5c86000a21918

Class Code

class OrsPythonPlugins.OrsFilterArithmetic.OrsFilterArithmetic.OrsFilterArithmetic(*args, **kwargs)
apply(xMin, yMin, zMin, tMin, xMax, yMax, zMax, tMax)

Starts the computation of the current filter over the specified area

The output datasets should have their data overwritten in the area described by the indexes xMin, yMin, zMin, tMin, xMax, yMax, zMax and tMax and remain unchanged outside this area.

Parameters:
  • xMin (int) – minimal index in X to be computed

  • yMin (int) – minimal index in Y to be computed

  • zMin (int) – minimal index in Z to be computed

  • tMin (int) – minimal index in T to be computed

  • xMax (int) – maximal index in X to be computed

  • yMax (int) – maximal index in Y to be computed

  • zMax (int) – maximal index in Z to be computed

  • tMax (int) – maximal index in T to be computed

getAbbreviatedOutputName(outputIndex)

Gets the abbreviated output name

Parameters:

outputIndex (int) – index of the output of the current filter

Return:

abbreviated output name of the current filter

Rtype:

str

getClassCount()

Gets the count of classes produced by the filter, if this is defined

Return:

filter output class count

Rtype:

int

classmethod getFilterCanBeUsedForFeatureExtraction(aFilterUUID)

Deprecated since version 3.1.

Parameters:

aFilterUUID (str) – the filter UUID

Returns:

output (bool) –

classmethod getFilterExist(aFilterUUID, aFilterVersion=None, plugin=None)

Gets if the filter is found

Parameters:
  • aFilterUUID (str) – the filter UUID

  • aFilterVersion (str) – the filter version

  • plugin (str) – the name of a plugin using filters

Returns:

output (bool) – True if the filter is found; False otherwise.

classmethod getFilterIs2D(aFilterUUID)

Gets if the filter can be applied in 2D

Deprecated since version 3.1.

Parameters:

aFilterUUID (str) – the filter UUID

Returns:

output (bool) – True if the filter can be applied in 2D; False otherwise.

classmethod getFilterIs3D(aFilterUUID)

Gets if the filter can be applied in 3D

Deprecated since version 3.1.

Parameters:

aFilterUUID (str) – the filter UUID

Returns:

output (bool) – True if the filter can be applied in 3D; False otherwise.

getFilterUserDescription()

Gets a readable description of the filter and of his parameters

Return:

readable description

Rtype:

str

classmethod getFilters(plugin=None, reset=False)

Gets the set of filters supported by this plugin.

It is a concatenation of strings, each having this syntax:

'categoryName/filterName/uuid;'

Example:

strToReturn = ''  # Initialization
for aFilter in listOfFilters:
    filterCategory = aFilter._getFilterCategory()
    filterName = aFilter._getFilterName()
    uuid = aFilter._getUUID()
    strToReturn += '{category}/{filterName}/{uuid};'.format(category=filterCategory, filterName=filterName, uuid=uuid)
return strToReturn
Parameters:

plugin (str) – the name of a plugin using filters

Returns:

output (str) – details of filters supported by this plugin

getInputChannel(inputChannelIndex)

Gets an input channel

Parameters:

inputChannelIndex (int) – index of the input of the current filter

Return:

a Channel GUID

Rtype:

str

classmethod getInputChannelCountForFilter(aFilterUUID)

Gets the input channel count for a filter

Parameters:

aFilterUUID (str) – the filter UUID

Returns:

output (int) – the input channel count

getInputChannelLabel(inputChannelIndex)

Gets the label (identification) of an input

Parameters:

inputChannelIndex (int) – index of the input of the current filter

Return:

a label

Rtype:

str

getInputChannelsCount()

Gets how many inputs (datasets) are required

Return:

input count

Rtype:

int

getLengthDependenceX(inputChannelIndex)

Gets the extent required in X to perform computations on a subset of the dataset.

This is the largest number of pixels required in X from the pixel of computation (either side). If all the pixels are required, return -1.

Examples:

  • if only the current pixel is required, this method should return 0;

  • if only the immediate neighbors are required, this method should return 1.

Parameters:

inputChannelIndex (int) – index of the input of the current filter

Return:

extent in pixels

Rtype:

int

getLengthDependenceY(inputChannelIndex)

Gets the extent required in Y to perform computations on a subset of the dataset.

This is the largest number of pixels required in Y from the pixel of computation (either side). If all the pixels are required, return -1.

Examples:

  • if only the current pixel is required, this method should return 0;

  • if only the immediate neighbors are required, this method should return 1.

Parameters:

inputChannelIndex (int) – index of the input of the current filter

Return:

extent in pixels

Rtype:

int

getLengthDependenceZ(inputChannelIndex)

Gets the extent required in Z to perform computations on a subset of the dataset.

This is the largest number of pixels required in Z from the pixel of computation (either side). If all the pixels are required, return -1.

Examples:

  • if only the current pixel is required, this method should return 0. This is usually the case for 2D filters, working slice by slice;

  • if only the immediate neighbors are required, this method should return 1.

Parameters:

inputChannelIndex (int) – index of the input of the current filter

Return:

extent in pixels

Rtype:

int

classmethod getMainFormClass()

Gets the class of the main form

Returns:

output

getMinimalXSizeOfChannelForKernel()

Gets the minimal X size of the input channels for the filter to work properly.

Return:

the minimal X size of the input channels

Rtype:

int

getMinimalYSizeOfChannelForKernel()

Gets the minimal Y size of the input channels for the filter to work properly.

Return:

the minimal Y size of the input channels

Rtype:

int

getMinimalZSizeOfChannelForKernel()

Gets the minimal Z size of the input channels for the filter to work properly.

Return:

the minimal Z size of the input channels

Rtype:

int

getOutputChannel(outputChannelIndex)

Gets an output channel

Parameters:

outputChannelIndex (int) – index of the output of the current filter

Return:

a Channel GUID

Rtype:

str

classmethod getOutputChannelCountForFilter(aFilterUUID)

Gets the output channel count for a filter

Parameters:

aFilterUUID (str) – the filter UUID

Returns:

output (int) – the output channel count

getOutputChannelLabel(outputChannelIndex)

Gets the label (identification) of an output

Parameters:

outputChannelIndex (int) – index of the output of the current filter

Return:

a label

Rtype:

str

getOutputChannelsCount()

Gets how many outputs (datasets) are required

Return:

output count

Rtype:

int

getOutputSlicesCount()

Gets the count of slices returned for a single slice analysis.

This is for filters producing multiple output values for each input pixel, contained into a single output channel.

An example of use for this is with the Segmentation Trainer, where different features have to be computed for each pixel.

Return:

count of slices returned for single slice analysis

Rtype:

int

getSetupDescription()

Gets an xml formatted description of the filter and of his parameters

Return:

xml formatted description

Rtype:

str

getSuggestedOutputDataType(outputChannelIndex)

Gets the suggested data type of a filter output

Parameters:

outputChannelIndex (int) – index of the output of the current filter

Return:

suggested data type (from types of class COMWrapper.ORS_def.CxvChannel_Data_Type)

Rtype:

int

classmethod getVersionOfFilter(aFilterUUID)

Gets the version number of a filter

Parameters:

aFilterUUID (str) – the filter UUID

Returns:

output (str) – version of the filter

setFilter(filterUUID, plugin=None)

Sets the current filter

Parameters:
  • filterUUID (str) – the filter UUID

  • plugin (str) – the name of a plugin using filters

setIndexFirstVoxelInputChannel(inputChannelIndex, x, y, z, t)

Tells the filter what is the first voxel represented in memory of an input channel.

Parameters:
  • inputChannelIndex (int) – index of the input of the current filter

  • x (int) – X index of the first voxel represented in memory

  • y (int) – Y index of the first voxel represented in memory

  • z (int) – Z index of the first voxel represented in memory

  • t (int) – T index of the first voxel represented in memory

setIndexFirstVoxelOutputChannel(outputChannelIndex, x, y, z, t)

Tells the filter what is the first voxel represented in memory of an output channel.

Parameters:
  • outputChannelIndex (int) – index of the output of the current filter

  • x (int) – X index of the first voxel represented in memory

  • y (int) – Y index of the first voxel represented in memory

  • z (int) – Z index of the first voxel represented in memory

  • t (int) – T index of the first voxel represented in memory

setInputChannel(inputChannelId, inputChannelIndex)

Sets an input channel

Parameters:
  • inputChannelId (str) – input channel GUID

  • inputChannelIndex (int) – index of the input of the current filter

setOutputChannel(outputChannelId, outputChannelIndex)

Sets an output channel

Parameters:
  • outputChannelId (str) – output channel GUID

  • outputChannelIndex (int) – index of the output of the current filter

setupFromDescription(description, fromPython=False)

Sets the filter and his parameters from a formatted xml description

Parameters:
  • description (str) – xml formatted description

  • fromPython – True if the xml description needs no modification before being parsed; False if the call comes from C++.