You are on page 1of 5

A Software Development of DICOM Image Processing Based on QT, VTK

and ITK
SUN Mengmeng, WU Shuicai*
Collage of Life Science and Bioengineering, Beijing University of Technology, Beijing 100124, China
E-mail˖smm_sunmengmeng@163.com

Abstract:To display and process images in different DICOM formats,this article introduces a new method of integrating ITK,
VTK and QT to process the images in DICOM format, and a software was designed based on the three tools . The results indicate
that this software can read and display DICOM images with different suffixes and can process medical images simply.
Key Words:DICOM,Image Processing, ITK, VTK, QT
1 INTRODUCTION scientific research and software development[4].HAO
Weilin[1]have used them to read and display DICOM
As the development of hospital information system and
images. These toolkits do not provide the
picture archiving and communication system,Digital
GUI(Graphical User Interface), which is not
Imaging and Communications in Medicine (DICOM)
convenient for users. WEN Tiexiang[5] have designed
exists as a standard for handling,storing, printing,
a platform using MFC as GUI, but it didn’t support
and transmitting information in medical imaging. The
cross-platform. Qtis a cross-platform graphical user
DICOM files include not only the information of
interface developed by TrollTech in 1991. It provides
images, but also contain a lot of medical information[1].
the application developers all the functions needed by
Due to the complexity of DICOM format, ordinary
building state-of-the-art graphical user interface. Qt is
program can’t read and display images of DICOM
easy to expand, and allows real component
format. How to read and process an image in DICOM
programming. Qt provides a safety type called
format by programming is important for further image
signals/slots to replace the callback, and this makes
processing and image visualization.
cooperation among the various components of work is
Many companies,such as SIEMENS, Philips and GE,
very simple, the user interface development is very
have designed many softwaresspecialized for their
easily. Qt becomes very popular because of its support
medical equipment to display DICOM images. Those
for cross-platform, object-oriented with rich API. This
softwares are not available to public and only support
paper integrate QT, ITK and VTK to develop a
standard format and internal format in theircompanies.
software of image processing with a practical GUI, and
Moreover, some softwares can only read some DICOM
it can read all kinds of DICOM images with different
images with special suffix.For example, Irfanview can
suffixes. The process of development is simple without
only display images with suffix as *.DCM and *.IMA.
underlying development. Our work is a fundamental
Those above-mentioned softwaresabove are developed
step for further image processing.
from bottom using C++ or some other advanced
programming language. The progress is complicated 2 METHODS
and insufficient for encapsulation and further
2.1 Circumstance and tools
processing.
Visualization Toolkit (VTK,www.vtk.org)[2]and We developed the software in Windows7 operating
Insight Segmentation and Registration Toolkit ( ITK, system based onITK, VTK and Qt.
www.itk.org)[3]are the most notable algorithm toolkits 2.2Integrating ITK, VTK and QT in visual studio
aimed to provide an open algorithm library for 2008
____________________________________
978-1-4673-5887-3/13/$31.00 ©2013 IEEE


2.2.1 Integrate ITK and VTK you want to a single slot, and a signal can be
ITK and VTK are both work in pipeline, so it’s easy to connected to as many slots as you need. It is even
integrate them using the type cast files provided by the possible to connect a signal directly to another signal.
library of themselves. The header files we used are This will emit the second signal immediately
shown as follows: whenever the first is emitted. Signals and slots make
"itkVTKImageToImageFilter.h" up a powerful component programming mechanism as
"itkImageToVTKImageFilter.h". shown in Fig 2.
The flow chart of integrating ITK and VTK is shown
in Fig 1. First, read data using ITK reading function,
second, convert data type supported by ITK to the one
supported by VTK with or without image processing,
and last, display the data using vtkImageViewer in
VTK.

Fig 1. Flow chart of integrating ITK and VTK

2.2.2Integrate VTK and QT


The class used to display 2D image in VTK is Fig 2. Mechanism of signals and slots

vtkImageViewer2 which encapsulates the


2.4Read and display DICOM images
objectsincluding vtkRenderWindow, vtkRenderer,
vtkCamera and vtkActor, and the class needn’t to be 2.4.1 Read DICOM files using ITK
initialized. In ITK library, the function of reading DICOM files is
The widget provided by Qt to connect to VTK is provided in GDCM library and we use class named
QVTKWidget, and we can use it by adding the header GDCMImageIO to connect GDCM library[3].
file “QVTKWidget.h”. This widget gets Render The first thing required to read an image from a file is
Window from vtkImageViewer2 using its function to include the header file "itkImageFileReader.h".
SetRenderWindow() and encapsulates the VTK Then, the image type should be defined by specifying
window in the widget supported by Qt. the type used to represent pixels and the dimensions of
the image as follows.
2.3Interface design
typedefunsigned char PixelType;
Qt[6] is rich in API, which make the development of constunsignedintDimension =2;
GUI very easy and simple. Qt provides all kinds of typedefitk::Image<PixelType, dimension >ImageType;
widgets and buttons in Qt Designer. Qt provides a Using the image type, it is possible to instantiate the
higher-level interface module called signals/slots. image reader class. The image type is used as a
Signals and slots are used for communication between template parameter to define how the data will be
objects. The signals and slots mechanism is a central represented once it is loaded into memory as follows.
feature of Qt and probably the part that differs most ReaderType::Pointer reader = ReaderType::New();
from the features provided by other frameworks. A reader->SetFileName( filename );
signal is emitted when a particular event occurs. Qt's Generally, some DICOM images need to be adjusted
widgets have many predefined signals, but we can through window width and level so that more clearly
always subclass widgets to add our own signals to human organic structures can be achieved without the
them. A slot is a function that is called in response to a information of environment such as the air. DICOM
particular signal. You can connect as many signals as header files contain the window width and level


information. After adjusting the image through the b.Set the title of each row.
above method, some disturbances of environment can c.Write the information of tag into the first row of
be removed. QTableView. The settings of other rows are similar.
DICOM images store 16-bits per sample (65,535 d. Set the title and size of QTableView and make the
levels) usually, sothe gray value ranges of DICOM widget not editable.
images should be normalized to 0 to 255 because of
2.6 Image processing
the restrictions of the recognition ability of the human
eyes and the performance of the display device[7]. The functions we used this part in ITK are shown in
We used itkIntensityWindowingImageFilter here to Table 1.
map the gray value to an appropriate boundary before Table 1.Functions in image processing
displaying the image.
Module Functions
2.4.2 Display Image
Median filter itkMedianImageFilter
Class named vtkConnectorType was used to input
Curvature filter itkMinMaxCurvatureFlowImageFilter
image data read by ITK. Coordinated system in ITK is
Edges detection itkCannyEdgeDetectionImageFilter
different from VTK, so we used class vtkImageFlip to
Image corrosion itkGrayscaleErodeImageFilter
invert Y axis. After that the data was input
Image dilation itkGrayscaleFunctionDilateImageFilter
vtkImageViewer2.
2.6.1 Image Smoothing
2.5 DICOM header information
Image smoothing is helpful for enhancing and
2.5.1 Get DICOM header information characterizing fundamental image constituents, i.e.,
A single DICOM file contains both aheader (which salient edges, and in the meantime for diminishing
stores information about the patient's name, the type of insignificant details. Image smoothing can make
scan, image dimensions), as well as all of the image adjacent pixels look more similar[8].
data (which can contain information in three This paper used two smoothing methods, median filter
dimensions). The first 794 bytes are used for a and a curvature driven image denoisingalgorithm. The
DICOM format header, which describes the image median filter in ITK is itkMedianImageFilter and the
dimensions and retains other text information about other is itkMinMaxCurvatureFlowImageFilter.
the scan. The size of this header varies depending on 2.6.2 Edge detection
how much header information is stored. The image Edge detection is the name for a set of mathematical
data follows the header information (the header and methods which aim at identifying points in a digital
the image data are stored in the same file).DICOM image at which the image brightness changes sharply
dataset is composed by a series of data elements or, more formally, has discontinuities. The points at
according to the label (tag) order from small to large. which image brightness changes sharply are typically
Data elements include tag, labelID, length of the value organized into a set of curved line segments termed
and the range of the value. edges. Edges detection is a fundamental tool in image
We get the DICOM header information though setting processing, machine vision and computer vision,
the function as follows. particularly in the areas of feature detection and
GDCMImageIO ->GetMetaDataDictionary(); feature extraction. There are a lot of edge detection
2.5.2 Display the DICOM header information kernels, such as Canny, Sobel, Roberts and Prewitt.
The widget in Qt we used to display the header This paper takesCanny kernel as an example to
information is QTableView. We show the information introduce the edge detection. The filter we used in ITK
in three rows: tag, labelID and value. is itkCannyEdgeDetectionImageFilter.
There are Settings about QTableView as follows: 2.6.3 Image morphology
a.Set the ItemModle. Image corrosion and dilation is an important basis of


morphological image processing. Corrosion can suffix. They are all CT images. The results are
remove the image noise and certain structure of an shown in Fig 5.
image,and dilation can fill the gap and empty of the
image.
This paper used itkGrayscaleErodeImageFilter for
corrosionand itkGrayscaleFunctionDilateImageFilter
for dilation in ITK.

3EXPERIMENTAL RESULTS
3.1 Interface of the software (a) (b)

The interface of the software is shown in Fig 4 and Fig Fig 5. DICOM images with different suffixes: (a) Image with suffix

5 shows the menu bar of the interface. as *IMA; (b) DICOM image without suffix.

3.3 Display DICOM header information

Original image is shown in Fig 6 and its DICOM


header information is shown in Fig 7.

Fig 3. Interface of the software.

Fig 6.Original image.

(a) (b)

Fig 7.DICOM header information of original image.

3.4 Image smoothing

We used two methods to smooth the original image


(c) (d)
and the results are shown in Fig 8. Median filter can
Fig 4. Menu bar of the interface: (a)File menu; (b)Image process
blur the edge of the image, but the edge can be well
menu; (c)Image smoothing menu; (d)Image information menu.
retained at the same time of denoising by using
3.2 Display DICOM image with different suffixes itkMinMaxCurvatureFlowImageFilter.

We tested two kinds of DICOM formats image: one


image with suffix as *IMA and the other without


convenient to add further functions.
This software can only show and process 2D images,
so we will add functionsabout 3D images to the
software in the future study. This paper only
fulfillssome simple image processing and this is the
foundationof further processing. We can add image
registration and image segmentation to the software,
(a) (b) which are the hot points at present.
Fig 8. Images after smoothing: (a) Image after median filtering;
REFERENCES
(b)Image after using MinMaxCurvatureFlowImageFilter.
[1] HAO Weilin, DU Jianjun, LIU Youjun. The image
3.5 Image morphology
displaying and information obtaining of DICOM files
Images after morphological transformation are shown based on ITK and VTK[J]. Beijing Biomedical
in Fig 9. We can find that image erosion can remove Engineering, 27(2): 151-155.
the information of scanner and image dilation can fill [2] GUO Shengwen. Realization of Integrated Medical
the holes in the image. Image Visualization System[J]. Chinese Journal of
MedicalPhysics, 23 (5): 333-336.
[3] Ibanez, L.,Schroeder, W.,Ng, L., etc. The ITK software
guide: the insight segmentation and registration
toolkit[J]. Kitware Inc, 2003, 5.
[4] Tian, J.,Xue, J.,Dai, Y., etc. A novel software platform
for medical image processing and analyzing[J].
. Information Technology in Biomedicine, IEEE
(a) (b) Transactions on, 2008, 12 (6): 800-812.
Fig 9.Images after morphological transformation: (a) Image after [5] WEN Tiexiang,YANG Feng.Integration of Medical
dilation; (b) Image after erosion. Image Processing System Based on ITK, VTK and
MFC[J]. Information of Medical Equipment, 2007, 22
3.6 Edges detection using Canny kernel
(5): 1-3.
Image after edges detection using Canny kernel is [6] Blanchette, J.,Summerfield, M. C++ GUI programming
shown in Fig 10. with Qt 4[M]. Prentice Hall.
[7] Han, F.,Yang, J.,Liu, Y., Hong Zhao. Research on
Preprocessing Algorithm for PET-CT Image
Registration[A], In Optoelectronics and Image
Processing (ICOIP), 2010 International Conference
on[C], 2010: 266-269.
[8] Gonzalez, R. C.,Woods, R. E.,Eddins, S. L. Digital
image processing using MATLAB[M]. Gatesmark
Fig 10. Image after edges detection using Canny kernel.
Publishing Knoxville: 2009.

4 CONCLUSION AND EXPECTION


This paper developed a simple software based ITK,
VTK and Qt which can provide a practical and
cross-platform GUI for users. This software can
display and process DICOM images with different
suffixes. The process of development is easy and it’s



You might also like