MeVisLab Scripting Reference
MLPythonModuleWrapper Class Reference

Inherits QObject.

Public Types

enum  HandleInput { Invalidate = ml::PythonModule::Invalidate , AllowDisconnectedInput = ml::PythonModule::AllowDisconnectedInput , AllowInvalidImage = ml::PythonModule::AllowInvalidImage , AllowAny = ml::PythonModule::AllowAny }
 
enum  InputSubImageBoxMode {
  UsePython = ml::PythonModule::UsePython , EmptyBox = ml::PythonModule::EmptyBox , OutputSubImageBox = ml::PythonModule::OutputSubImageBox , InputImageBox = ml::PythonModule::InputImageBox ,
  OutputImageBox = ml::PythonModule::OutputImageBox
}
 

Public Slots

Access to PythonModule.


void setPythonModule (const char *name)
 
void setTouchOutputsOnInputChange (bool flag=true)
 
void setHandleInput (int index, HandleInput handleInputFlag)
 
void setInputSubImageBoxMode (InputSubImageBoxMode mode, int inIndex=-1, int outIndex=-1)
 
void setInputSubImageBoxOffsets (const QList< quint64 > &offset1, const QList< quint64 > &offset2, int inIndex=-1, int outIndex=-1)
 
void setClipInputSubImageBoxToInputImage (bool clip=true, int inIndex=-1, int outIndex=-1)
 
QList< int > getInnerDimensionsForDataType (int mlDataType)
 

Detailed Description

A ML module that supports image processing implemented in Python.

This interface allows to set the input image handling for invalid inputs.

Member Enumeration Documentation

◆ HandleInput

How to handle the inputs if they are either disconnected or contain an invalid image.

Enumerator
Invalidate 

Always invalidate.

AllowDisconnectedInput 

Allow that the input is disconnected.

AllowInvalidImage 

Allow that the input image is invalid (but connected)

AllowAny 

Allow both disconnected inputs and connected invalid images.

◆ InputSubImageBoxMode

How to calculate the input sub image boxes.

Enumerator
UsePython 

call calculateInputSubImageBox in Python

EmptyBox 

use an empty box

OutputSubImageBox 

Use the output sub image box (the box of the output page)

InputImageBox 

Use the complete input image box.

OutputImageBox 

Use the complete output image box.

Member Function Documentation

◆ getInnerDimensionsForDataType

QList<int> MLPythonModuleWrapper::getInnerDimensionsForDataType ( int  mlDataType)
slot

Returns an array with the inner dimensions of the ML datatype (for vec and matrix, otherwise the returned list is empty).

◆ setClipInputSubImageBoxToInputImage

void MLPythonModuleWrapper::setClipInputSubImageBoxToInputImage ( bool  clip = true,
int  inIndex = -1,
int  outIndex = -1 
)
slot

Sets if the input sub image box should be clipped to the input image (only used if InputSubImageBoxMode is not InputSubImageBoxMode::UsePython) If -1 is used for input image index or output image index, the mode is used for all inputs/outputs.

◆ setHandleInput

void MLPythonModuleWrapper::setHandleInput ( int  index,
HandleInput  handleInputFlag 
)
slot

Set how the input image at index should be handled if the input is disconnected or if it is connected but has an invalid image.

If you allow both invalid and disconnected inputs, you can use AllowAny. Note that the default is Invalidate for all outputs. These flags need to be set in the init phase of the module.

◆ setInputSubImageBoxMode

void MLPythonModuleWrapper::setInputSubImageBoxMode ( InputSubImageBoxMode  mode,
int  inIndex = -1,
int  outIndex = -1 
)
slot

Allows to specify how the input sub image box should be calculated.

If -1 is used for input image index or output image index, the mode is used for all inputs/outputs. Default is InputSubImageBoxMode::UsePython. It is much more efficient to not use Python but to specify a different mode.

◆ setInputSubImageBoxOffsets

void MLPythonModuleWrapper::setInputSubImageBoxOffsets ( const QList< quint64 > &  offset1,
const QList< quint64 > &  offset2,
int  inIndex = -1,
int  outIndex = -1 
)
slot

Sets the offsets that should be added to the input sub image box.

(only used if InputSubImageBoxMode is not InputSubImageBoxMode::UsePython nor InputSubImageBoxMode::EmptyBox) If -1 is used for input image index or output image index, the mode is used for all inputs/outputs.

◆ setPythonModule

void MLPythonModuleWrapper::setPythonModule ( const char *  name)
inlineslot

Sets the name of the associated MeVisLab python module, which is found via sys.modules.

◆ setTouchOutputsOnInputChange

void MLPythonModuleWrapper::setTouchOutputsOnInputChange ( bool  flag = true)
inlineslot

Sets that the output images are touched/not touched by the module when any input image changes (the default is true)