21
VTK & VMTK for image processing and visualization Computational Mechanics and Advanced Materials Group

VTK & VMTK for image processing and visualization · VMTK: Vascular Modeling Toolkit C++ classes (VTK and ITK -based algorithms) Python classes (high-level functionality - each class

  • Upload
    others

  • View
    26

  • Download
    0

Embed Size (px)

Citation preview

Page 1: VTK & VMTK for image processing and visualization · VMTK: Vascular Modeling Toolkit C++ classes (VTK and ITK -based algorithms) Python classes (high-level functionality - each class

VTK & VMTK for image processing and visualization

Computational Mechanics and Advanced Materials Group

Page 2: VTK & VMTK for image processing and visualization · VMTK: Vascular Modeling Toolkit C++ classes (VTK and ITK -based algorithms) Python classes (high-level functionality - each class

Outline

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

Page 3: VTK & VMTK for image processing and visualization · VMTK: Vascular Modeling Toolkit C++ classes (VTK and ITK -based algorithms) Python classes (high-level functionality - each class

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

Page 4: VTK & VMTK for image processing and visualization · VMTK: Vascular Modeling Toolkit C++ classes (VTK and ITK -based algorithms) Python classes (high-level functionality - each class

Visualization Pipeline:

Transforms informational data into graphical data

Graphics Pipeline:

Transforms graphical data into images

VTK: pipeline architecture

Page 5: VTK & VMTK for image processing and visualization · VMTK: Vascular Modeling Toolkit C++ classes (VTK and ITK -based algorithms) Python classes (high-level functionality - each class

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

VTK: object-oriented hierarchy

Page 6: VTK & VMTK for image processing and visualization · VMTK: Vascular Modeling Toolkit C++ classes (VTK and ITK -based algorithms) Python classes (high-level functionality - each class

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

Page 7: VTK & VMTK for image processing and visualization · VMTK: Vascular Modeling Toolkit C++ classes (VTK and ITK -based algorithms) Python classes (high-level functionality - each class

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

Page 8: VTK & VMTK for image processing and visualization · VMTK: Vascular Modeling Toolkit C++ classes (VTK and ITK -based algorithms) Python classes (high-level functionality - each class

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

Page 9: VTK & VMTK for image processing and visualization · VMTK: Vascular Modeling Toolkit C++ classes (VTK and ITK -based algorithms) Python classes (high-level functionality - each class

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)

Page 10: VTK & VMTK for image processing and visualization · VMTK: Vascular Modeling Toolkit C++ classes (VTK and ITK -based algorithms) Python classes (high-level functionality - each class

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

Page 11: VTK & VMTK for image processing and visualization · VMTK: Vascular Modeling Toolkit C++ classes (VTK and ITK -based algorithms) Python classes (high-level functionality - each class

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

Page 12: VTK & VMTK for image processing and visualization · VMTK: Vascular Modeling Toolkit C++ classes (VTK and ITK -based algorithms) Python classes (high-level functionality - each class

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

Page 13: VTK & VMTK for image processing and visualization · VMTK: Vascular Modeling Toolkit C++ classes (VTK and ITK -based algorithms) Python classes (high-level functionality - each class

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

Page 14: VTK & VMTK for image processing and visualization · VMTK: Vascular Modeling Toolkit C++ classes (VTK and ITK -based algorithms) Python classes (high-level functionality - each class

4th step: image interaction

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

Page 15: VTK & VMTK for image processing and visualization · VMTK: Vascular Modeling Toolkit C++ classes (VTK and ITK -based algorithms) Python classes (high-level functionality - each class

4th step: result

vtkSliderWidget

Page 16: VTK & VMTK for image processing and visualization · VMTK: Vascular Modeling Toolkit C++ classes (VTK and ITK -based algorithms) Python classes (high-level functionality - each class

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

Page 17: VTK & VMTK for image processing and visualization · VMTK: Vascular Modeling Toolkit C++ classes (VTK and ITK -based algorithms) Python classes (high-level functionality - each class

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

Page 18: VTK & VMTK for image processing and visualization · VMTK: Vascular Modeling Toolkit C++ classes (VTK and ITK -based algorithms) Python classes (high-level functionality - each class

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

Page 19: VTK & VMTK for image processing and visualization · VMTK: Vascular Modeling Toolkit C++ classes (VTK and ITK -based algorithms) Python classes (high-level functionality - each class

VMTK Features

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

Figure 2: Element meshFigure 1: A surface

Page 20: VTK & VMTK for image processing and visualization · VMTK: Vascular Modeling Toolkit C++ classes (VTK and ITK -based algorithms) Python classes (high-level functionality - each class

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....

Page 21: VTK & VMTK for image processing and visualization · VMTK: Vascular Modeling Toolkit C++ classes (VTK and ITK -based algorithms) Python classes (high-level functionality - each class

THANK YOU!!!