SMILI
Assistant
milxQt
The milxQt sub-library was
developed primarily with display and processing capabilities of images
and surfaces in mind with two easy to use classes, milxQtImage (based
on milxImage requiring only ITK) and milxQtModel (based on milxModel
requiring only VTK) respectively. Both objects are self-capable of
display and processing and manifest as windows when displayed (using
the show() member). For more information, please see the SMILI journal
paper. Since the library uses Qt for the GUI related elements, its
coding style is that of Qt also.
The milxQtModel class utilises a polydata structure (called vtkPolyData
from VTK), which allows displaying of a number of model types including
fields and surfaces. Visualisation of shape models was done by
displaying milxQtModel objects within a unified render window allowing
the display of multiple actors from either milxQtImage or milxQtModel
classes.
The milxQtImage class utilises a milxImage object (via itk::Image from
ITK) for processing and structured grid object (called vtkImageData
from VTK) for display. The
images are always displayed in the correct patient space and have been
thoroughly tested to ensure correctness. Although using both ITK and
VTK objects to represent
images at the same time creates some redundancy, it ensures processing
is done promptly using more stable and well accepted ITK image filters
and displayed efficiently via VTK rendering. We believe this is an
acceptable trade-off to ensure milxQt remains lightweight in terms of
processing rather than memory because the latter is far cheaper than
the former.
The following listing gives an example of the Application Programming
Interface (API) for the milxQtModel object, where in order to
triangulate, decimate, smooth and clean a polygonal surface and display
it in coronal view, one simply issues:
model->clean ( ) ;
model->smoothSinc ( 20 ) ; // windowed sinc 20 iterations
model->decimate ( 0.5 ) ; // 50% decimation
model->colourMapToJet ( ) ;
model->viewToCoronal ( ) ;
either as C++ code (as above) in ones custom application or in Python
syntax to script (or interactively run) the sMILX GUI application. This
additional higher-level Python layer is provided via a application
level Python interface, which is based on the open-source PythonQt
library (pythonqt.sourceforge.net). PythonQt automatically wraps Qt
classes, and thus all the ‘milxQt’ classes, using decorators and makes
them available as Python classes. This feature is available as a
console plugin to the sMILX
application.
The remaining milxQtFile class provides ease of reading and writing
various file formats and other commonly needed file-system
capabilities. This includes wrapping the number of supported file
formats of both ITK and VTK for both milxQtImage and milxQtModel
objects.