VTK & VMTK for image processing and visualization · VMTK: Vascular Modeling Toolkit C++ classes...

Post on 12-Mar-2020

14 views 0 download

transcript

VTK & VMTK for image processing and visualization

Computational Mechanics and Advanced Materials Group

Outline

● Presenting VTK● VTK Data Type● Usage● Implementation: An Example● Briefly on VMTK● Working progress

Characteristics: Characteristics: ● Born in 1993

● “De facto” standard tools for image analysis

● Object-oriented C++ library (something that applications use)

● Free, open source

● Rich functionality for image/surface processing and visualization

● Interpreted wrappings (Python, Tcl)

Keys to successfully using VTK:Keys to successfully using VTK:● Understanding it’s pipeline architecture

● Understanding the structure of the object-oriented hierarchy

Visualization Toolkit

Visualization Pipeline:

Transforms informational data into graphical data

Graphics Pipeline:

Transforms graphical data into images

VTK: pipeline architecture

With the exception of some auxiliary classes all VTK classes derive from vtkObject

VTK: object-oriented hierarchy

VTK: object typeVtkDataObject:VtkDataObject:

● represents data of various types

● Consist of: geometry (point coordinates) topology (points or cells) data attributes (scalars, vectors,...)

● Provides access to data

VtkProcessObject:VtkProcessObject:

● filters operating on data objects to produce new data objects

● represent visualization algorithms

Arrays of Numbers(one per point or cell)vtkDataArray

Data Set

Points (vtkPoints)Define Geometry

Point Attributes (vtkPointData)Point Properties (e.g. intensity)

Cells (vtkCellArray)Define Topology

Cell Attributes (vtkPointData)Cell Properties (e.g. normal)

VTK: data representation

Structure + Data Attribute = vtkDataSet

vtkImageData is the basic VTK class for storing images. It is defined by 4 key elements:

● Dimensions - these define the size of the image

● Origin - position in 3D space of point 0 0 0

● Spacing - voxel dimensions

● Scalar Type - type of the image ( float, short, etc)

An 4x4x4 image has 4x4x4=64 points and 3x3x3=27 cubic cells (both are implicitly defined)

VTK: vtkImageData

What can VTK do for me?

● 2 up to 4D data processing/rendering

● Image processing

● Text analysis and information visualization

● Charting/plotting

● Application support (GUI support, Widget)

VTK: application example

What we have: DICOM Images (Breast X-rays)

What we want: GUI for medical reporting

Tools:● Scripting language: python● Library: TKinter, VTK ● Lots of patients

Work flow:● 1st step: selecting patient● 2nd step: reading and writing● 3rd step: rendering● 4th step: image interaction● 5th step: medical reporting

1st step: selecting patient

Tkinter: GUIProgramming toolkit for Python. It is the most commonly used one.

Use to:

● Create a ListBox of the patients

● Associate every patients with their related X-rays

● Double click on the patient name to start up the visualization process

2nd step: reading & writing

reader=vtk.vtkDICOMImageReader()reader.SetFileName(pathpz_dcm[i])reader.Update() writer=vtk.vtkXMLImageDataWriter()writer.SetInput(reader.GetOutput())writer.SetFileName(pathpz[i])writer.Write()

Extracting and saving DICOMImage informations in a data type (vtkImageData), manageable with VTK

3rd step: rendering

actor_image1=image_viewer1.GetImageActor()

Renderer=vtk.vtkRenderer()Renderer.AddActor(actor_image1)

iren=vtk.vtkRenderWindowInteractor()renderWindow=vtk.vtkRenderWindow()iren.SetRenderWindow(renderWindow)renderWindow.AddRenderer(Renderer)

iren.Initialize()renderWindow.SetWindowName('Paziente1')renderWindow.Render()

iren.Start()

Props/Actors: these ‘know’ how to generate the visible representation of data.

Renderer: object to convert geometry, a specification for lights, and a camera view into an image.

Render Window: the Render Window is the piece of screen real estate in which the virtual camera image is displayed.

Render Window Interactor: allows interaction with the graphics

4th step: image interaction

Adding a vtkImageSlider to provide control on image contrast, manipulating WindowLevel and WindowWindow

4th step: result

vtkSliderWidget

5th step: medical reportingDisplaying medical images giving the possibility to cut and save a region of interest if needed.(vtkBoxWidget --> orthogonal hexahedron 3D widget)

VMTK: Vascular Modeling Toolkit

● C++ classes (VTK and ITK -based algorithms)

● Python classes (high-level functionality - each class is a script)

● PypeS - Python pipeable scripts, a framework which enables vmtk scripts to interact with each other

The Vascular Modeling Toolkit is a collection of libraries and tools for 3D reconstruction, geometric analysis, mesh generation and surface data analysis for image-based modeling of blood vessels.

Figure: Centerline extraction and branchsplitting

VMTK Features● Segmentation of vascular segments (or

other anatomical structures) from medical images.

● Geometric analysis and surface data processing of 3D models of blood vessels (and tubular objects in general).

Figure: Centerline extraction and branchsplitting

vmtklevelsetsegmentation -ifile image_volume_voi.vti -ofile level_sets.vti

vmtkcenterlines -ifile foo.vtp -ofile foo_centerlines.vtp

VMTK Features

Scripts, I/O tools and simple algorithms to easily work with images and meshes.

Figure 2: Element meshFigure 1: A surface

Working Progress

● Extract MetaData from DICOMImage to set WindowLevel and WindowWindow equals to the value predent in the original image

● Create a customized widget

● Link widget and image to have the selected part of the image cropped and saved

● Manipulate VMTK for our purpose

● More....

THANK YOU!!!