1.1.0
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.
Changes
- Improved reading performance for large structure sets.
- Changed the way the visualization image list is ordered, the most recently added item is now always at the bottom of the list.
- Changed the title of images in the visualizer to display the image name as title, the name of the output is now displayed below the title.
- Python plugin API changed, please see below.
- Added new metadata structure to images.
- Added passing of image metadata to plugin nodes.
- Added new image metadata viewer.
- Added functionality to connect several nodes to one input at the same time.
- Added NIfTI export.
- Added support for NIfTI metadata .json files.
- Added save warnings when closing the application or process tab.
- Added import of Open Slide images (microscopy).
- Added MR emulator.
- Added run button.
- Added save warnings when closing.
- Added simplified license sign-up.
- Added split panel between image sets and view-port items to improve scaling.
- Added create image node.
- Added new FFT nodes.
- Added basic support for reading ‘Parametric Map’ type DICOM images containing float pixel data.
Bug Fixes
- Fixed NIfTI import node not being able to parse certain orientations correctly.
- Fixed bug related to missing metadata in some images.
- Fixed license use for multiple users using the same machine.
- Fixed EUD normalization error.
- Fixed multiple inputs on plugin nodes.
- Fixed 2D/2D registration requiring 3D images.
- Fixed bug when batching MIQA database images with name ‘No Description’.
- Fixed saving bug in plugin editor where the asterisk indicating changes wasn't removed when saving.
- Fixed bool values in plugins to be either True or False, not 1 and 0.
- Fixed generation of the InputPaths variable in plugins.
General Changes
- Updated SimpleITK to 1.2.0.
- Updated UI layout.
Plugins
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
Changes
- Changed the constructor to only require shape and dtype parameters. All other parameters are optional.
- Changed
shape
,voxel_size
andposition
are now given as a list or a tuple. - Changed
to_itk_image()
to take one optional argument, frame, which selects the frame to send to SimpleITK. By default frame=0. - Changed
clone_empty()
to take one optional argument dtype, which can be used to change the data type of the cloned image. - Renamed method
toItkImage()
toto_itk_image()
. - Renamed method
writemhd()
tomtk.utils.write_mhd()
and moved it to mtk.utils. - Renamed
readmhd()
totk.utils.read_mhd()
and moved it to mtk.utils. - Removed
create()
,create4d()
,create3d()
,create2d()
. Please use the Image4D class constructor instead.
Additions
- Added
transpose(self, *axes)
. Returns a copy of the image with the axes transposed. Use this if you want to change the order of the image dimensions according to the optional input axes. - Added method
T()
. This methods reverses the order of the axes. - Support for metadata has been added. A metadata structure is exported to the python environment in a TypedList, where each element contains the metadata for each frame of the image.
Class mtk.utils
read_csv(filename, delimiter=";")
: Reads a csv file from disk.write_csv(data, filename, delimiter=";")
: Writes a csv file to disk.read_metadata(path)
: Read image metadata from an .xml file given in path.from_itk_image(itkimage)
: Convert a SimpleITK image to an Image4D class.valid_variable(variable_name)
: Checks if a variable name is valid in MICE/Python.valid_type(value)
: Checks if a variable has a valid type.TypedList(list)
: Creates a list datatype with strong typing. This datatype is used in the metadata representation.Struct(object)
: Creates a structure datatype from a dictionary. This datatype is used in the metadata representation.
Code Example
# Image4D constructor
image = mtk.image.Image4D([10, 10, 10, 3], name='Empty', dtype='bool')
# Show overview of image properties
image
print(image)
# Get shape, voxel size and position of image
image.shape
image.voxel_size
image.position
# 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
mhd_image.metadata[0].PatientName
Copyright © 2022, NONPI Medical AB