October 22, 2019

In this version support for the old licensing system has been removed and keys generated in the old system will not work. If you are using and old key you need to create a new license account here to get a new free lite license. If you have a premium license in the old licensing system please contact us to receive your new license key.


Bug Fixes

General Changes


We have made substantial changes to the Python plugin API, so if you want to use your old plugins you will probably have to update the code. We have also added import and export of image metadata to all images sent to and from python and MATLAB plugins.

Python API Changes

The code now adheres to PEP8, which means that many methods and property names have changed slightly. A new module has been added, mtk.utils, which contains many of the methods and functions previously found in Image4D.

Class mtk.image.Image4D



Class mtk.utils

Code Example

# Image4D constructor
image = mtk.image.Image4D([10, 10, 10, 3], name='Empty', dtype='bool')

# Show overview of image properties

# Get shape, voxel size and position of image

# ITK conversion
itk_image = image.to_itk_image()
itk_image_frame = image.to_itk_image(frame=2)
image_from_itk = mtk.utils.from_itk_image(itk_image_frame, dtype='float')

Create some metadata. A metadata structure, defined in mtk.utils.Struct 
is compatible with a DICOM struct, but more flexible. Structs can contain fields, 
Structs, and TypedLists. A TypedList is a list with strong typing, where each 
element in must be of the same type. The metadata structure is stored in a 
TypedList, where each frame has its own Struct. 

# Create a metadata struct, with fields common to all frames
metadata_struct = mtk.utils.Struct(dict(PatientID='10',PatientName='Dummy'))

# Add a field to the metadata
metadata_struct.Age = 77

# Clone metadata_struct in a TypedList
metadata_list = mtk.utils.TypedList([metadata_struct]*3)

# Create a tag called "Frame", that is different in each frame
for i, _ in enumerate(metadata_list):
    metadata_list[i].Frame = i

# Store metadata in the Image4D object     
image.metadata = metadata_list

# Cloning
mask = image.clone_empty(dtype='bool')

# Write to MHD. The metadata is written to an XML file. 
mtk.utils.write_mhd("c:\\temp\\mhdimage.mhd", image)
mhd_image = mtk.utils.read_mhd("c:\\temp\\mhdimage.mhd")

# Verify that the metadata is intact