PythonImage

MLModule
status stable
author Florian Link
package MeVisLab/Standard
dll MLPythonImageProcessing
definition PythonImage.def
keywords numpy, ndarray, tile, global

Purpose

The module PythonImage allows to set a numpy.ndarray as the output ML image of the module using Python scripting.

Usage

The typical usage is to do get the module via ctx.module() and call getInterface on it to get access to its scripting API.

The returned interface supports:

setImage(image, minMaxValues, voxelSize = None, pageSize = None, voxelToWorldMatrix = None)

to set the image and:

unsetImage()

to unset the image again.

Details

Here is an example that generates a test pattern:

interface = ctx.module("PythonImage").call("getInterface")

tile = np.ndarray((64,128,256), np.float32)

# fill tile with some data...
for z in xrange(0,64):
  zFactor = math.cos(z/64. * math.pi)
  for y in xrange(0, 128):
    yFactor = math.sin(y/32. * math.pi)
    for x in xrange(0, 256):
      tile[z,y,x] = math.cos(x/32. * math.pi) * yFactor * zFactor

interface.setImage(tile, minMaxValues = (-1, 1))

Tips

Have a look at the PythonImageExample example module for a typical usage inside a MacroModule.

Output Fields

output0

name: output0, type: Image

The output image that is copied from the internal numpy.ndarray.

Parameter Fields

Field Index

cancelTask: Trigger taskVerboseLogging: Bool
progress: Float  
startTask: Trigger  
startTaskSynchronous: Trigger  
status: String  
taskCanceled: Trigger  
taskFinished: Trigger  
taskRunning: Bool  

Hidden Fields

startTask

name: startTask, type: Trigger

startTaskSynchronous

name: startTaskSynchronous, type: Trigger

cancelTask

name: cancelTask, type: Trigger

taskFinished

name: taskFinished, type: Trigger

taskCanceled

name: taskCanceled, type: Trigger

taskRunning

name: taskRunning, type: Bool, persistent: no

taskVerboseLogging

name: taskVerboseLogging, type: Bool, persistent: no

progress

name: progress, type: Float, persistent: no

status

name: status, type: String, persistent: no