Abstract
Construction of a cone-beam computed tomography (CBCT) system for laboratory research usually requires integration of different software and hardware components. As a result, building and operating such a complex system require the expertise of researchers with significantly different backgrounds. Additionally, writing flexible code to control the hardware components of a CBCT system combined with designing a friendly graphical user interface (GUI) can be cumbersome and time consuming. An intuitive and flexible program structure, as well as the program GUI for CBCT acquisition, is presented in this note. The program was developed in National Instrument’s Laboratory Virtual Instrumentation Engineering Workbench (LabVIEW) graphical language and is designed to control a custom-built CBCT system but has been also used in a standard angiographic suite. The hardware components are commercially available to researchers and are in general provided with software drivers which are LabVIEW compatible. The program structure was designed as a sequential chain. Each step in the chain takes care of one or two hardware commands at a time; the execution of the sequence can be modified according to the CBCT system design. We have scanned and reconstructed over 200 specimens using this interface and present three examples which cover different areas of interest encountered in laboratory research. The resulting 3D data are rendered using a commercial workstation. The program described in this paper is available for use or improvement by other researchers.
Key words: Cone-beam micro-CT; graphical user interface; software design, LabVIEW
BACKGROUND
Cone-beam computed tomography (CBCT) imaging is experiencing a widening use in medical imaging applications. Most of this expansion is due to the ease with which it can be incorporated or combined with already existing medical procedures such as radiography for cancer treatment planning and x-ray-guided interventions. Much of the optimization and characterization of CBCT systems or CBCT algorithms are done on laboratory systems or custom-built machines1,2 which are operated using in-lab-developed software. The coding language is subject to different factors such as researcher backgrounds, instrumentation drivers, complexity of the tasks, execution speed, or computational level required (i.e., low-level or high-level). Standard programming software such as the C language, Basic, or Java is well established and offers many coding options to the system programmer. However, the creation of a program which controls a complex system such as a CBCT machine, using standard languages, could require substantial time and expertise for coding. Some of these issues can be addressed using a graphical programming language such as LabVIEW (Laboratory Virtual Instrumentation Engineering Workbench, National Instruments Corp., Austin, TX, USA) which is a development environment offering fast and intuitive coding with compatible drivers for much laboratory equipment. References to usage of LabVIEW for different medical imaging tasks are quite diverse: CT reconstruction,3 real-time measurements,4 simulations for medical imaging systems,5 or libraries for DICOM format handling.6 Some groups have already reported usage of LabVIEW software for control and data acquisition in a CBCT sytem7,8 or phase contrast CT system9 without offering detailed description of the software such as program structure, hardware control, flexibility, and synchronization, etc. In this work, we describe our approach to control such a self-built, flexible CBCT system using a software developed in LabVIEW. The work we present requires IMAQ Vision which is an additional library to the basic LabVIEW software. This library takes care of the acquisition, processing, and analysis of images. The system has been used in various configurations with different x-ray generators.
MATERIALS AND METHODS
Cone-Beam Micro-CT Setup
We built a CB micro-CT machine from commercially available components: an x-ray tube, a rotary stage, and a high-resolution detector. The schematic of the small sample dedicated system configuration is shown in Figure 1 although we have used the system in other portable configurations enabling it to be temporarily set up in a commercial x-ray room using a portable platform10 for larger objects. The dedicated system configuration was designed to be used in the nondestructive study of small specimens, for example, small animals, small organs, and small devices, such as vascular stents.
The x-ray source for the dedicated configuration is an UltraBright, Microfocus X-ray Tube (Oxford Instruments, Scotts Valley, CA, USA). The x-ray tube has a round, stable focal spot on a tungsten target anode. The size of the focal spot varies with the x-ray parameters between 12 and 40 μm. The maximum power is 80 W at 80 kVp with a maximum current of 2 mA at lower voltages, and the beam is filtered by a 254-μm beryllium window. The x-ray tube is cooled using acustom-made aluminum heat sink and a set of fans. As a safety precaution, the temperature is monitored, and the x-ray tube is switched off if its temperature rises above 70°C. The tube is mounted on a custom-made positioning stage, Figure 1, which allows x (along the stage), z (vertical), and angular alignment. The x-ray tube controller can be set in either manual or remote-control mode. In remote-control mode, the x-ray tube is controlled via a serial port with the signals determined by the exposure parameters set by the user in the interface (described below). All the hardware devices are controlled or communicate with the computer using serial ports. Because of the large number of the devices that need to be controlled, we used commercially available USB to serial cable converters to account for all the ports needed.
During one complete scan, the x-ray tube is continuously on. Thus, a shutter system is used to control the x-ray beam exposure to the scanned object and the detector. The shutter consists of a lead sheet, 2 mm thick, which is moved in and out of the x-ray beam using two linear solenoids. The solenoids are controlled by an electronic circuit connected to a serial port.
For the portable configurations, the system is somewhat altered because no shutter is needed, but a trigger pulse from the commercial x-ray system which simply indicates when the x-ray exposure is “on” is used to synchronize the data acquisition and turntable motion.
The scanned object is positioned on a stepper-motor-driven rotary stage (Velmex, Bloomfield, NY, USA) which is used to rotate the object during acquisition. The motor stage is operated using a step-and-shoot approach and has a gear ratio of 72:1 corresponding to an angular increment of 0.0125° per step, and it can rotate with a maximum speed of 50°/s. The x-ray tube, the shutter (for the dedicated configuration), and the rotary stage are coordinated through the serial ports of the computer.
The x-ray detector is a micro-angiographic detector11 developed by our group. The detector is made from a CCD coupled to a CsI phosphor using an approximately two to one minifying fiber optic taper. The field of view has an active matrix of 1,024 × 1,024 pixels with an effective pixel size of about 45 μm. The detector has five ports: power port, image data port, serial port, trigger in, and trigger out. The data port is connected to the LVDS port of a RoadRunner image acquisition board (BitFlow Inc., Woburn, MA, USA) using a data cable (Model CAB-SMD12). The serial port is used to set parameters of the detector such as integration time, camera gain, triggering mode, and binning mode. The BitFlow board is provided with a LabVIEW software which is added to the software “add-ons” library.
LabVIEW Software
The entire CBCT acquisition is controlled using a LabVIEW program. For scientists who are unfamiliar with the software environment, programming in LabVIEW occurs in two windows. The first window is the Block Diagram where the code development takes place; the other window is the Front Panel where the graphical user interface (GUI) is created. The creation of the GUI is similar to the creation of a slide in a PowerPoint presentation; the programmer can select the objects such as controls, devices, plots, or displays from the menu and drop them onto the Front Panel. The position, size, and appearance can be changed using the mouse keys. Before going into the details of the program, it should be mentioned that once the programmer adds a variable or control in one of the windows, the same object is created in the other. However, there exists the possibility to hide the controls or variables in the GUI. In the GUI that we built for the CBCT machine, we displayed only the variables which are related to the CBCT acquisition. This GUI is presented in Figure 2 for the dedicated configuration and has four main parts: stage control, x-ray parameter control, image processing, and display control.
The x-ray tube control panel (upper middle position in the GUI) contains two sliding bars corresponding to the kilovolt peak (kVp) in kilovolt units and the power in watts (W) and a drop-down menu with three options: adjust parameters, keep parameters, and turn-off x-ray tube. The x-ray parameters indicated in the GUI are converted into hexadecimal strings and then sent to the x-ray tube controller via a serial port. The system is set up so that an adjustment of the x-ray parameters can be done while acquiring and viewing a set of test images to allow optimization of the image quality. Once the operator is satisfied with the image quality, the x-ray parameters are set, and the x-ray control is deactivated by selecting a “keep parameters” option in the drop-down menu above the sliding bars.
The stage control parameters are located in the panel in the left upper corner of the GUI. The user can set the stage in computer remote mode by clicking the activate stage button (the default status of the stage is set for manual control). Once the stage is in the computer-controlled mode, the user must set (a) the angle increment in degrees in the box labeled Step, (b) the number of projections to be acquired in the number of images’ box, and, finally, (c) the speed of the stage (degrees per second) which can be set by using the round dial on the right side of the stage control panel.
The acquired image (1,024 × 1,024 pixels, 16-bit unsigned) is displayed automatically upon acquisition in a window in the lower left of the GUI. Most of the image processing, analysis, and display are done using a set of subroutines provided with the LabVIEW IMAQ Vision library. The displayed image is gain- and offset-corrected using previously acquired and stored flat-field images whose file location is indicated in a box above the image. The flat-field images were acquired for every 10th kVp. The dark image used in the correction process is always the same for a given detector, so we chose to specify its location only in the code in the Block Diagram. Various display functions commonly provided by image display programs, such as zoom, pan, and different shapes of ROI’s, can be initiated by clicking on appropriate symbols located at the left side of the “Display” in Figure 2. The displayed gray scale can be adjusted by using the “Window/Level” settings located in the upper right corner of the GUI. The minimum and maximum values are indicated on the sliding bars, and the type of interpolation function is selected from the drop menu labeled “Operator”. These inputs are used to map pixel values to image intensity via a look-up table (LUT) subroutine. The interpolation function can be linear, exponential, logarithmic, inverse, inverse-square, etc. For further monitoring of the acquisition, a line profile from the current image and a histogram of the image are displayed in two plots on the lower right part of the GUI. The location of line profile in the image is specified by the user in the “Line Profile” box. A set of controls for data playback, or viewing of other image stacks, is just below the displayed image. The buttons below the image are designed for image stack navigation. The capability for byte swapping is available by clicking the button in the “Byte Order” box to the left of the dialog box for the path of the “Corrected Image”.
The program flow is illustrated in Figure 3 using a modified Gantt chart. The largest arrow (bottom of the figure) indicates the order in which the commands are executed. The acquisition starts with the activation and initialization (first column) of the hardware components: the x-ray shutter, rotary stage, x-ray tube, and detector (camera); at this point, we also load the files necessary for flat-field correction and initialize the variables used in the program. The initializations are done by sending ASCII codes provided by respective manufacturers to the appropriate serial ports. Different features such as the bin mode with a camera gain or the triggering mode are selected at this point. For this CBCT setup, we use the camera in the same conditions, and the commands and controls are hidden in the GUI. For any change, the user can either change these values in the Block Diagram or make them active in the Front Panel of the GUI. The other various arrows indicate the status of respective hardware at the times between commands.
The acquisition itself occurs in a timed DO-WHILE loop which is indicated by the top black arrow in Figure 3 between the START and CHECK positions (bottom arrow). The commands inside the loop are executed sequentially from left to right. The completion of one loop of the commands between these positions corresponds to the acquisition of one projection. The execution of the loop is conditioned by completion of the scan or by error occurrence. The command sequence is divided into four stages which are indicated on the timeline of Figure 3. In the first stage, the x-ray parameters are adjusted. The condition shown with a rhombus inside the first stage indicates the possibility of skipping the “adjust parameters” step if the “keep parameters” option has been selected. This option saves computer time because the program would otherwise be writing a command string to the x-ray controller to adjust the x-ray parameters for every projection.
Image acquisition occurs in the second stage of the loop. During this stage, two separate processes are done simultaneously, i.e., image acquisition and shutter control. The image acquisition is done using a LabVIEW subroutine provided by the frame grabber manufacturer (BitFlow Inc.). During the acquisition stage, the shutter is opened for a specified period of time and then closed. The exposure time is usually set to 300 ms. Shorter exposures may result in low photon statistics per pixel and poor image quality, whereas longer exposure times may result in increased dark current. The synchronization between acquisition-and-readout and x-ray exposure is vital for accurate and reproducible data because exposure of the pixel array during readout can introduce faulty values in the acquired image. For synchronization, the shutter opens at the same time that the acquisition subroutine is called, and then the shutter starts closing shortly (5 ms) before the exposure time is over. There is a slight variation in the pixel intensity across the image, which is due to the shutter motion. However, the shutter motion is reproducible, and the variation is removed by a standard gain-and-offset correction12 (also known as flat-field correction), which is performed in the third stage.
The resultant image is displayed for evaluation. The operator can then choose to save the files if the quality of the image is satisfactory. The two processes, acquisition and correction, involve 1,024 × 1,024 × 16 bit images and take a total time of about 700 ms.
The fourth stage (Fig. 3) is dedicated to the display of the data acquired and the rotation of the object in preparation for the next exposure sequence. The acquired images are adjusted using the window-level LUT subroutine described previously. The images are displayed automatically on the GUI. A selected profile in the image and a histogram of the image are displayed in real time for estimation of the signal as well as the background values. Simultaneous with these processes, a command is sent to the rotary stage to rotate the object by the angle specified by the operator in the GUI.
For the portable configuration,10 the turntable, high-resolution detector, and control and acquisition computer is brought into one of the two standard angiographic suites we have available (Model Infinix or Model CAS-8000v, Toshiba Medical Systems Corp., Tustin, CA, USA), and a coaxial cable carrying the trigger signal is input to the control computer. The LabVIEW program is simplified to eliminate the need to control the x-ray shutter. The x-ray parameters are set manually on the commercial system’s console, and the delay between pulses must be set to permit sufficient time for the rotary stage to move to the next position. The remainder of the image acquisition, stage control, image processing, and display remain the same as that for the dedicated configuration.
Sample Scanning and Rendering
In this report, we show the scan results obtained for the three sample objects using the dedicated configuration. Although we have built in the capability to change the source-to-image distance (SID) and the source-to-object distance (SOD) using an optical positioning rail on which all components are mounted, the SID was kept constant at 84 cm for the samples demonstrated in this study. The first sample was a mouse thorax approximately 2 cm in diameter, the second was a mouse jaw, and the third was a stented aneurysm specimen; the SOD was 80 cm. The samples were scanned using increments of 1° for a full 360° rotation. The mouse thorax scan, Figure 4a, b, was done postmortem, and the x-ray parameters used were 60 kVp, 1 mA (60 W), and 300 ms exposure per frame. According to the specifications of the x-ray generator for these parameters, the focal spot size was 30 μm.13
The mouse jaw scan of Figure 4c, d was done for a dentistry research project studying the bone loss in the jaws of knockout mice. The length of such a sample was about 8 mm in length and 3 mm in diameter; the soft tissue was removed chemically before the scan. The x-ray parameters were 45 kVp and 1 mA (45 W), the exposure time per frame was 300 ms, and the SOD was 50 cm.
The treated aneurysm specimen in Figure 4e, f was taken from a canine aneurysm model and was used to observe the healing effect caused by the treatment of aneurysms treated with stents of different design.14 The sample was perfused with iodine contrast to visualize the lumen and the aneurysm. The vessel diameter was 4 mm, and the aneurysm dome was 10 mm high. The x-ray parameters used were 60 kVp, 1.1 mA (50 W) and SOD was 45 cm.
The images were reconstructed with a Feldkamp algorithm.15 The reconstructed volumes were (512)3 pixels, with voxel sizes of 45 μm. The reconstructed slices were converted to standard DICOM format and transferred to a Vitrea 2 workstation for the 3D rendering (Vital Images, Minnetonka, MN, USA).
RESULTS
For this hardware configuration and software code, the acquisition of one projection takes about 1.1 s and occurs in the DO WHILE loop between “Start” and “Check” in Figure 3. If the x-ray parameter adjustment is skipped, then the acquisition of one projection takes about 1 s. Initialization takes about 380 ms and occurs only once when the program is started.
The results of the reconstruction are presented in Figure 4. We show typical slices on the left and 3D-rendered volumes on the right for the three different objects: a mouse thorax in the first row, a mouse jaw imaged using high magnification in the middle row, and explanted aneurysm treated with a stent in the last row.
The small x-ray focal spot allows usage of the high magnification without significant increase in geometric unsharpness. For the stented aneurysm sample, the white dots which can be seen in the CT slices are the stainless steel struts of the stent. The diameters of these wires are about 100 μm; in general, such a detailed image of an endovascular stent cannot be achieved with standard clinical x-ray systems.
In over 3 years of use, the setup has run without major software glitches. We trained three undergraduates in less than 2 h to operate the system acquiring extensive amounts of data without any difficulties for both our lab and collaborators. The CBCT system we presented is known to the different groups at our university such as the Dentistry, the Physiology, and the Bioengineering Departments and is used extensively for CT scans of devices or samples that required detailed nondestructive investigations.
DISCUSSIONS
In this work, we reported on our approach to developing the software control of a custom-built cone-beam micro-CT system using LabVIEW including details related to the control of the hardware components, image acquisition and processing, and GUI. We now discuss aspects of this system concerning timing, hardware versatility, limitations, and suggestions for system improvement.
The times displayed in the Gantt chart in Figure 3 are dependent on the tasks the user demands from the system and the hardware components and configuration. In our case, most of the time is used by the Image Acquisition stage due to the relatively large time (about 300 ms) needed for the exposure of the detector. This part takes about 60% of the time needed for one projection acquisition. The exposure time per frame of 300 ms was chosen based on our measured dark field (no x-ray exposure) pixel values for the detector. We found that for exposure times above 300 ms, the pixel values, although still small, were twice the 10 gray-level value obtained at short exposure times (out of a range of gray levels up to 4,096 or 12 bits). The acquisition time can be further reduced if a more powerful x-ray tube is used. In our case, for the dedicated configuration, we chose to trade the x-ray power for a small focal spot (between 12 and 40 μm) which is needed for high magnification micro-CT scans; however, for the portable configuration using the commercial high-power x-ray generators, we use shorter exposure times below 100 ms when scanning larger objects such as head phantoms at technique parameters up to 150 kVp and 1,000 mA.
The flat-field correction that we used applies only if the detector has a linear response with the exposure. We verified that the detector response was linear within a 1% error. Although a few tens of pixels did not respond linearly, we identified the location of those pixels and applied a localized median filter in the corresponding area to avoid ring artifacts in the reconstruction.
The CBCT GUI presented contains only the controls which we considered to be significant for the CT acquisition: x-ray parameter adjustments, acquired projection display, rotary stage control, tools for image display adjustments, and image quality assessment. Most of the hardware controls, such as hardware access ports, execution time control, and hardware initialization, are hidden in the GUI. However, these controls are available in the LabVIEW Block Diagram Panel, and they can be made accessible in the GUI by any operator by unselecting “hidden” option in the properties of the variable.
The software is flexible to changes or additions of different hardware. The RS232 serial control is standard for most laboratory equipment (microfocus x-ray tubes, motorized stages, etc.). To adapt our program to a different hardware, the user must change the strings sent to the serial ports according to the specifications of the equipment provider. Changes to the image acquisition part are also straightforward. The subroutines that we used to control the camera were provided by BitFlow, and they are standard for most of the frame grabbers. However, if the x-ray detector uses a standard connection such as the Camera Link, then the subroutines for image acquisition are provided by the National Instruments with the IMAQ Vision libraries.
CONCLUSIONS
We described a practical way to control a cone-beam micro-CT system using the LabVIEW graphical language for two configurations: one fixed for use with a dedicated x-ray generator, and one portable for use in a commercial angiographic suite. The graphical nature of the language, the simplicity of the GUI design, and the availability of the drivers for a very large number of hardware components and systems make LabVIEW a powerful tool for the design and implementation of a complete micro-CT system with flexible configurations. The program described in this study is available to other researchers upon request.
Acknowledgment
This work was supported in part by NIH grants R01EB002873 and R01NS43924. We would like to thank Profs. Sarah H. Gaffen and Todd Evans of the UB Dentistry Department for the mouse jaw, and to Bruce A. Davidson and Paul R. Knight of the UB Anesthesiology and Microbiology Department for the mouse thorax used in the “Results” section.
References
- 1.Siewerdsen JH, Jaffray DA. Optimization of x-ray imaging geometry (with specific application to flat-panel cone-beam computed tomography) Med Phys. 2000;27:1903–1914. doi: 10.1118/1.1286590. [DOI] [PubMed] [Google Scholar]
- 2.Siewerdsen JH, Jaffray DA. Cone-beam computed tomography with a flat-panel imager: initial performance characterization. Med Phys. 2000;27:1311–1323. doi: 10.1118/1.1286590. [DOI] [PubMed] [Google Scholar]
- 3.Dierick M, Masschaele B, Hoorebeke Van L. Octopus, a fast and user-friendly tomographic reconstruction package developed in LabView®. Meas Sci Technol. 2004;15:1366–1370. doi: 10.1088/0957-0233/15/7/020. [DOI] [Google Scholar]
- 4.Dielenberg R, Halasz P, Hosaka K, Helden D. Vessel motion measurement in real-time using movement detection at multiple regions of interest. J Neurosci Methods. 2006;152:40–47. doi: 10.1016/j.jneumeth.2005.08.005. [DOI] [PubMed] [Google Scholar]
- 5.Kroon H. Overall x-ray system simulation model developed for system design and image quality versus patient dose optimization. Proc SPIE. 2003;5030:445–458. doi: 10.1117/12.479950. [DOI] [Google Scholar]
- 6.Medical Connection. DICOM Objects. LabVIEW examples available at: http://www.medicalconnections.co.uk/html/examples.html. Accessed 30 October 2006
- 7.Badea C, Hedlund LW, Johnson GA. Micro-CT with respiratory and cardiac gating. Med Phys. 2004;31:3324–3329. doi: 10.1118/1.1812604. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 8.Kastis AG, Furenlid RL, Wilson WD, Peterson TE, Barber HB, Barrett HH. Compact CT/SPECT small-animal imaging system. IEEE Trans Nucl Sci. 2004;51:63–67. doi: 10.1109/TNS.2004.823337. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 9.Wanga J, Zhu P, Yuana Q, Huang W, Shu H, Wu Z. Design and construction of an X-ray phase contrast CT system at BSRF. Radiat Phys Chem. 2006;75:1986–1989. doi: 10.1016/j.radphyschem.2005.10.033. [DOI] [Google Scholar]
- 10.Rangwala HS, Chityala RN, Rudin S, Hoffmann KR. A portable tomographic platform for image acquisition and calibration for cone beam computed tomography (CBCT) and region of interest CBCT (ROI-CBCT) on a commercial X-ray C-arm system (abstract) Med Phys. 2006;33:1997–1998. doi: 10.1118/1.2240244. [DOI] [Google Scholar]
- 11.Ganguly A, Rudin S, Bednarek DR, Hoffmann KR, Kyprianou IS. Micro-angiography for neuro-vascular imaging. I. Experimental evaluation and feasibility. Med Phys. 2003;30:3018–3028. doi: 10.1118/1.1617549. [DOI] [PubMed] [Google Scholar]
- 12.Wu Y, Rudin S, Bednarek DR. A prototype micro-angiographic fluoroscope and its application in animal studies. Proc SPIE. 2005;5745:1066–1077. doi: 10.1117/12.589232. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 13.Gubarev M, Ciszak E, Ponomarev I, Gibsone W, Joyb M. First results from a macromolecular crystallography system with a polycapillary collimating optic and a microfocus X-ray generator. J Appl Crystallogr. 2000;33:882–887. doi: 10.1107/S0021889800001837. [DOI] [Google Scholar]
- 14.Hoi Y, Ionita CN, Tranquebar RV, Hoffmann KR, Woodward SH, Taulbee DB, Meng H, Rudin S. Flow modification in canine intracranial aneurysm model by an asymmetric stent: studies using digital subtraction angiography (DSA) and image-based computational fluid dynamics (CFD) analyses. Proc SPIE. 2006;6143:176–185. doi: 10.1117/12.650624. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 15.Feldkamp LA, Davis LC, Kress JW. Practical cone-beam algorithm. J Opt Soc Am A. 1984;1:612–619. doi: 10.1364/JOSAA.1.000612. [DOI] [Google Scholar]