Sunday, September 30, 2012

Visualization, Image Processing and Computation in Biomedicine


Today I googled patient-specific finite element (FE) models for radiofrequency ablation and figured that my article has been published. That made my day!

Article: http://www.dl.begellhouse.com/journals/7e4ff0643eace965,forthcoming,4898.html

Saturday, September 29, 2012

Visible Human Project CT Datasets

Volume rendering of the head data set of visible human project
Take a close look and tell me what you see. The image shows volume rendering of a head CT data set of an application that I created with Python and Togl. I obtained the CT data set from the visible human project website. On the website (see Links) CT data is provided of a complete human male body. This is a great example data for everyone who wants to create their own volume rendering application and needs test data.

Links:
Visible human project - https://mri.radiology.uiowa.edu/visible_human_datasets.html

Wednesday, September 26, 2012

Modeling of radiofrequency tumor ablation


Temperature comparison of perfused (blue) and unperfused (red) RFA simulation model in the liver; RFA energy was switched off after 10 seconds; temperature was measured at electrode’s tip (arrow). Blood perfusion limits the temperature increase in the tissue -> cooling effect
Thermal ablative therapies are used to treat malignant tumors in liver, kidney, lung and bone tissues. During RF ablation treatment, a thin electrode is placed directly into the tumor using ultrasound, computed tomography or magnetic resonance imaging guidance. An RF generator connected to an antenna creates an electromagnetic field in the surrounding tissue which causes heat due to ionic friction. Due to the blood flow e.g. in the liver cooling occurs (heat is dragged away by the blood) an limits the temperature increase. The perfusion effect can be mathematically modeled with the "bio-heat equation" which was first introduced by Pennes in 1948. 

The bio-heat equation is solved with: 
 
ρ is the density (kg·m-3), c is the specific heat (J·kg-1·K-1), k is the thermal conductivity (W·m-1·K-1), J is the electric current density (A·m2), E is the electric field intensity (V·m-1) and QP (W·m-3), is the heat loss due to blood perfusion. The energy generated by the metabolic processes, is usually neglected since it is orders of magnitude lower than QP.
 
Tbl is the temperature of the blood (assumed to be 37 °C), ρbl is the blood density (kg·m-1), cbl is the specific heat of human blood (J·kg-1·K-1), and wbl is the blood perfusion. 

The image in the top shows a RFA model that I created in COMSOL4.0 to compare temperature distribution in perfused and unperfused liver.

Links:
My ablation laboratory - http://www.musc.edu/ablation/
 

Saturday, September 22, 2012

Real-time 3D CAD software control via webcam

Screen shot of CAD software (LIMIT) controlled via webcam
In order to control the CAD software LIMIT via webcam, I created a python plugin allowing viewport manipulation (pan, zoom) via webcam. The webcam detects a specific color (red) on the webcam image and calculates relative position within the webcam window. The relative position is then applied to the CAD viewport's world matrix which is relevant for object position calculation.
A demo video how the webcam control application works can be found here: http://youtu.be/fBLqshR7Mmk/

Links:

Friday, September 21, 2012

Medical imaging

Image of wxpython OpenGL application rendering 2959572 vertices and 986524 triangles real time.
OpenGL is used to process and visualize medical imaging data. The image shows a wxpython application that I wrote do display the triangulated surface structure of meshed CT imaging data. The surface data consist of  2959572 vertices and 986524 triangles. With the use of OpenGL manipulation (pan, zoom, rotate) can be performed real time. For shading I used OpenGL Shading Language (GLSL) which allows you to easily apply lighting effects to your view.

The GLSL shaders can be downloaded here:  https://www.dropbox.com/sh/ip306uavm7jpekg/6FENd-2TUj/GLSL/

Links:
OpenGL - http://www.opengl.org/
GLSL - http://www.opengl.org/documentation/glsl/
wxpython - http://wxpython.org/

Tuesday, September 18, 2012

Servo position control via PC

Image of experimental setup. The PC control panel sends a signal to the micro-controller board and changes the position of the servo
The position of a servo can be controlled with a Micro-Controller (MC) board that recieves singals from the PC. This picture shows an example setup that I created to control the servo position with a PC control panel. When the slider is moved in the control panel, a digital signal is generated and sent to the MC via USB connection. The MC processes the signal and sends an equvalent electronic impulse to the servo. Thus the servo changes position according to the electrical signal. For this example I used Python and the Tkinter (GUI) library to create the control panel and Arduino's sketch tool to program the MC.
A real-time video of the application can be found at: http://www.youtube.com/watch?v=cI-eiEtxchc
The scrip and sketch for the MC data can be found at: https://www.dropbox.com/sh/ip306uavm7jpekg/uiElcgcgWg/Servo%20positioning%20control%20from%20PC

Sunday, September 16, 2012

Face detection

Face and eye detection with Chuck, Python and OpenCV
Face detection is a specific computer task to locate faces in images and is often used in biometrix. OpenCV  (Open Source Computer Vision a library of programming functions for real time computer vision) uses Haar wavelets to detect faces. With Python it is relatively easy to implement face and eye detection. I created an example script to detect Chuck's face and eyes.

The scrip and according data can be found at: https://www.dropbox.com/sh/ip306uavm7jpekg/2adXHWODU1

Links:

Thursday, September 13, 2012

Tkinter OpenGL application

Screenshot of the Togl application LIMIT. The whole GUI application was written in Python
Togl is a Tk OpenGL widget for GPU rendering. I've read several postings where people ask about Togl and recent 64bit windows versions. People are looking for it due to its compatibility to Python's standard GUI library Tkinter. Most the people responding recommended to switch to a more recent GUI toolkit with OpenGL support such as PyQt or wxpython since Tkinter is too much "old fashion" and Togl is not maintained very well thus kind of dead. I personally disagree that Tkinter is "old fashion" and it almost hurts my feelings because it is such a easy to use library, there are ways to give Tkinter a modern look (e.g. with Tile) and Tkinter with Togl is just a great and powerful visualization tool! Well it is true that Togl for Python might be not a 100% up to date but it is not dead! There is professional software out there that uses Tkinter with Togl for 3D visualization. The image shows a professional OpenGL application entirely written in Python using Tkinter and Togl. This is a software for generating fatigue assessments for mechanical structures. It allows 3D view manipulation and interactions.

Togl 

Wednesday, September 12, 2012

Volume rendering via ray casting

Volume rendering via ray casting of head, chest and feet.
Methods for visualization of three dimensional data are summarized as Volume Rendering (VR). It is a process for visualizing sampled functions of three spatial dimensions by computing 2-D projections of a colored, semitransparent volume. VR is a major application area in medical imaging where data is mostly obtained by Computed Tomography (CT) or Magnetic Resonance Imaging (MRI). There are a number of different methods to perform volume rendering, a common method is Ray Casting (RC) which is a direct volume rendering method; a 3D view results from performing the algorithm on a data set. In this procedure, which transforms data into a 3D projection, rays are traced from the view point into the viewing volume. 

The figure illustrates the principle approach of RC. It shows a volume which has a density D(x,y,z) and is  penetrated by a ray R.
From the light source S an illumination I (x,y,z) can be estimated at each point (x,y,z) along the ray. The intensity gritted along the ray to the eye depends on this value, a reflection function P and the local density D (x,y,z). The dependence on density expresses the fact that a few bright particles will scatter less light in the eye direction than a number of dimmer particles. The density function along the ray can be written as:

 D(x(t),y(t),z(t))=D(t)

The illumination equation from the source as:

I(x(t),y(t),z(t))=I(t)

Furthermore the illumination scattered along R from a point distance t along the ray can be written as: 

I(t)D(t)P(cos∅)

is the angle between R and L, thus the light vector, from the point of interest. To determine I(t) the attenuation of radiation from the light sources and the shadow when passing through the volume to the point of interest must be calculated. This is the same as the computation of how the light scattered at point (x,y,z) is affected in its way along R to the eye. In most algorithms, this calculation is ignored and I(x,y,z) is set to be uniform throughout the volume. In medical imaging, it would be impossible to see into areas surrounded by bone if the bone were considered dense enough to shadow light. On the other hand, in applications where internal shadows are desired, this integral has to be computed. The attenuation due to the density function along a ray can be calculated as: 

exp⁡(-τ∫D(s)ds) |t1,t2 

τ is a constant that transforms density to attenuation. The intensity of the light reaching the eye along direction R due to all the elements along the ray is defined as:

B=∫(exp⁡(-∫D(s)ds))I(t)D(t)P(cos∅)|t1,t2;|t1,t2

The Ray Casting algorithm is usually implemented with a Transfer Function (TF). This is either a linear or parabolic equation which defines the coherence between opacity and color for each density value. With the TF colored an transparent effects can be created on the data set. Many medical image viewer provide an option to define a TF.