180 likes | 973 Views
SimITK and SimVTK : ITK and VTK in Simulink. DG Gobbi, P Mousavi, KM Li, J Xiang, A Campigotto, A LaPointe, G Fichtinger, P Abolmaesumi Medical Image Analysis Laboratory (MedIA) http://www.media.queensu.ca School of Computing Queen’s University. Motivation.
E N D
SimITK and SimVTK:ITK and VTK in Simulink DG Gobbi, P Mousavi, KM Li, J Xiang, A Campigotto, A LaPointe, G Fichtinger, P Abolmaesumi Medical Image Analysis Laboratory (MedIA) http://www.media.queensu.ca School of Computing Queen’s University
Motivation Visual programming for ITK and VTK Drag & drop approach to application development Increase understandability & maintainability Instructional value MATLAB is our friend Use MATLAB’s Simulink visual environment Hence, avoid reinventing the wheel Allow mix of MATLAB code and ITK / VTK
Related Work • Visual Programming of VTK and ITK • ITKBoard (CSIRO) • SciRun (Utah) • MeVisLab (MeVis Research GmbH) • caBIG XIP (caBIG, Siemens, Washington U. in St Louis) • ITK and VTK in MATLAB (without Simulink) • MATITK (Chu and Hamarneh) • VTK plus MATLAB – various • Us: Visual ITK/VTK Programming in MATLAB
MATLAB’s Simulink Environment Library Model
Combine ITK Processing and VTK Rendering Output: VTK Window Input: cthead1.png
Method: Wrapping Process Simulink wrappers for ITK, VTK Each Simulink block is an “S-Function” with callbacks S-Function callbacks are C++ code, calls ITK or VTK CMake build process Start with an XML description of each filter (ITK) or Start with class header files (VTK) CMake calls perl script to generate C++ code CMake then calls perl to generate .mdl library file Finally, build libraries with VC++ or gcc
Method: Data Flow for SimITK • SimITK, SimVTK use different architecture • ITK is primarily image based • VTK handles many data set types • SimITK Data Flow • ITK images -> MATLAB arrays (“info” and “data”) • Use shared memory for efficiency • Conversion of ITK parameter data types • ITK uses several specialized types e.g. versor
SimITK Helper Class Input InputPort Conversion Spacing & Origin itkImage Data Conversion Parameters Run ITK Image Filter Parameter Variables Output Conversion OutputPort Spacing & Origin itkImage Data
Method: Data Flow for SimVTK • SimVTK Data Flow • Use MATLAB arrays to pass vtkObject pointers • Define “VTKOBJECT” MATLAB type for safety • When run starts, Simulink builds VTK pipeline on-the-fly • Then, Simulink calls Update or Render at each time step • SimVTK filter parameters • VTK parameter types need no conversion • VTK and MATLAB both use basic C data types
Registration Examples • Registration in ITK • Immediate, interactive feedback • Great way to tune parameters • Easy to swap out components
Intervention Examples • Computer Assisted Intervention in VTK • Incorporate real-time data input • Use “Subsystems” to manage complexity
Discussion • “Diagrams” that actually run as code • Easy to verify that code matches design • Great teaching tool • Understandability improves maintainability • Utility • Simulink models can run as stand-alone exec • Nearly all VTK, ITK classes can be wrapped
Future Work WrapITK To automate ITK build (VTK is already done!) GUI integration Slicer module interface in Simulink KWWidgets (later Qt, maybe FLTK) Community Building Mailing list, website We want to hear from you!