| status | stable |
| author | Florian Link |
| package | MeVisLab/Standard |
| dll | MLPythonImageProcessing |
| definition | PythonImage.def |
| keywords | numpy, ndarray, tile, global |
The module PythonImage allows to set a numpy.ndarray as the output ML image of the module using Python scripting.
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.
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))
Have a look at the PythonImageExample example module for a typical usage inside a MacroModule.
| cancelTask: Trigger | taskVerboseLogging: Bool |
| progress: Float | |
| startTask: Trigger | |
| startTaskSynchronous: Trigger | |
| status: String | |
| taskCanceled: Trigger | |
| taskFinished: Trigger | |
| taskRunning: Bool |