Visualization of the medical imaging data in 3D space using portable format

: Medical imaging is a set of specific examination procedures taking advantage of physical effects for determination of changes that occurred in patient’s body. It’s a domain of biomedical engineering to define the methods of acquiring, analyzing and visualizing medical images in the way useful for diagnostic, therapeutic, educational or research purposes. This work describes an effective method of automatic creation of 3D objects from the DICOM images. At the beginning DICOM images are read. Then tissues are segmented with a simple thresholding algorithm and filtered. After filtering preliminary 3D model is created. Afterwards obtained geometry is smoothed and decimated to relax the model and reduce the size of data. Such prepared model is embedded into PDF file with use of additional scripts. As the result of this work software called DICOM2PDF3D, combining described above stages of building 3D model in a single procedure, was developed. With use of 3D PDF additional measurements of created geometry were made. Measurements confirmed values obtained from standard preoperative evaluation. The presented solution allows creating and opening three-dimensional visualizations on every desktop computer even by inexperienced users. Created 3D PDF can be used for preoperative evaluation as an assistance for standard procedures.


Introduction
Medical imaging emerged in 1895, when German scientist, professor of physics, Wilhelm C. Roentgen accidentally discovered phenomenon of the X radiation. First device, acclaimed as computer tomography (CT) was developed in 1967 by Goldfrey Newbold Hounsfield, initiating a new era in a domain of medical imaging. During 70 years between discovering the X radiation and developing the first CT many scientists such as William Crookes, Gastone Plante, Karol Mayer, Thomas Edison, Alan Turing, John Neper or Blaise Pascal were working on various problems that allowed Hounsfield creation of the device.
Over the last few dozen years a quick development of medical imaging techniques took place, new technologies allowing better diagnostics emerged: MRI (Magnetic resonance imaging), USG (Ultrasonography), PET (Positron emission tomography), SPECT (Single photon emission computed tomography), OCT (Optical coherence tomography).
Medical images, used for diagnostics, must be characterized by a set of specific properties, making them useful for clinical purposes, including image technical quality (image standard, resolution, contrast, noise level, geometrical deformation level, artifact level), image medical usefulness (proper observation area, tissue specific character observation, organ anatomical and functional observation, real-time changes observation, image completeness) and availability (specialized laboratory, unique equipment, materials, software, specialized personnel qualifications).
Although the CT/MRI laboratory gives a possibility of watching on the screen 3D visualizations, outside of the laboratory flat images are still the only alternative. A good example of such a problem could be visualization and treatment of adolescent idiopathic scoliosis. Naturally spine is composed of multiple curvatures noticeable in sagittal projection: cervical lordosis, thoracic kyphosis, sacral kyphosis and lumbar lordosis, in adolescent idiopathic scoliosis additional vertebrae rotation appears in horizontal plane and lateral deviation in coronal plane. Those deformations make scoliosis a complex three dimensional problem. For this reason, physicians should prefer using 3D visualization for preoperative evaluation and in severe cases surgery. During the surgery special implants are fixed to the vertebral column to correct deformations. Currently position of implants is determined on the basis of CT and MR image sets, usually with use of simple software attached to the data. Such solution allows examining flat images only and forces physicians to use oblique cross-sections for better evaluation what require a lot of time and effort. What is more, incorrect measurements can lead to serious injuries because of inappropriate positioning of transpedicular screws. Wrong angle of driving can make the screw to penetrate vertebral canal and pressure the spinal cord causing paresis. For this reason, developing an accurate and fast method for 3D preoperative evaluation is crucial.
Another good example of mentioned problem could be the use of bone functional adaptation phenomenon in mechanical design [1]. Optimization is an iterative process in which used parameters often depends on the actual configuration of an analyzed instance. Fast and accessible 3d visualization of subsequent simulation steps is crucial for obtaining best results. In this case visualization becomes an important part of a simulation process, giving a possibility of further development.
Currently the market offers few applications allowing creation of 3D models of an analyzed instance but they are mainly very expensive and complicated to use, what generates additional funds required for special training. Standard procedure of creating 3D model from DICOM images with use of those applications consists of multiple stages manually performed by the user. At the beginning the data need to be read, the tissue segmented and additional mask created. After filtration geometry is created and in some cases additional processing is required for better visualization [2,3]. Software presented in the article is based on the other open-source projects and performs all mentioned-above actions automatically with user defined properties ( Figure 1). Such solution removes the great majority of labor, which in typical applications usually lies on the user, reducing the time and funds. What is more, currently available applications creates visualizations openable only on computer equipped with special software while presented solution gives a possibility of opening them on every desktop computer equipped with free Adobe Reader software or even so popular these days iPad. As an output file format 3D PDF was chosen for easy sharing and forwarding the results. Such solution was currently implemented only in commercial projects among which almost none is connected with the medical branch.
The article shows that there is a simple way of using 3D visualizations in every-day medical practice, especially that nowadays 3D PDF is widely used and supported by the most common PDF softwarefree Adobe Reader. Some procedures could be made much faster, by preparing dedicated software instead of using external modules/libraries, but this way was a lot easier to show the idea.

Materials and Method
The following description presents the developed visualization method. The first stage of automatic creation of 3D models from the DICOM images ( Figure 2) [4] takes place in the DeVide (Delft Visualization and Image processing Development Environment) software [5]. It's a multiplatform software framework that gives users a possibility of freely modification by adding their own code and in that way creation of specialized software. At the beginning DICOM images are read by the DICOMReader -one of the DeVide's modules. It is based on the GDCM (Grassroots DICOM) library that is multiplatform C++ library created for handling medical images and it's available in most Python, C++, C#, Java and PHP distributions. Obtained data is firstly smoothed by the Gaussian filter to reduce the eventual noise. Then tissues are segmented with simple thresholding algorithm, whole process is made by doubleThreshold module with the user specified properties. As a result an additional mask is applied to the data to determine the grayscale values representing specific tissues. This solution is fine for the segmentation of bone structures from the CT image sets, but for soft tissues or MRI images additional techniques are required. Other most common algorithms used for segmentation are: watershedding, region growing, level set, deformable models and hybrid algorithms.
After the segmentation a morphological filter called Closing is used. Morphological transformations allow performing complex image modifications on the basis of shape and layout analysis. Binary images are processed as a set, while grayscale images, such as DICOM, as a function. Morphological filters are characterized by following general algorithm: firstly on the surface of an image structural element is moved. During this operation, assuming that central point of structural element overlaps the examined pixel, mentioned pixel and other pixels that surround him are analyzed. Afterwards in every analyzed position of structural element a verification test is carried out. If pixel configuration is compatible with the exemplary structural element, certain operations, depending on the specific algorithm, are performed. As the result of these operations new image is created. To achieve the main goal of the Closing morphological filter the dilatation process is accomplished at first, before the erosion. Generally the dilatation is used for closing of small holes inside an analyzed area. The process consists of rolling a circle on the outer boundaries of an analyzed shape, where subsequent positions of the center of the circle determine the new boundaries of an object. Erosion is an opposite process, in which edges of an object are removed. The process consists of rolling a circle on the inner side of the boundaries of an analyzed shape, and it can only take place when the circle fully fits inside an analyzed area. In this process, such as in the dilatation, subsequent positions of the center of the circle determine the new boundaries of an object. The Closing morphological filter results in filling small holes inside analyzed shape, which dimension depends on the size of structural element. In extreme situations there is a possibility of joining elements that are close to each other.
After filtering preliminary 3D model is created (Figure 3a). The process also takes place in the DeVide software and is made by Contour module. On the basis of created mask on the boundaries of selected areas geometrical model is built. The surfaces are created by extracting isosurface from volume data and joined into one uniform structure. analysis is made to determine other vertices and polygons connected with it. On the basis of the obtained data connection matrix is created for every node and then iterative stage begins. Coordinates of every node are modified by interpolation functions using Hamming window. The whole process was described in details by Gabriel Taubin in "Optimal surface smoothing as filter design" [6].
The next stage consists of reducing dimensionality for better performance. Number of elements is reduced to speed up the calculations and facilitate the work. The process is performed by vtkQuadricDecimation module that is based on Schroeder's decimation algorithm [7]. Its main task is to decrease a number of polygons simultaneously preserving the original topology and geometry of the model (Figure 3c). First stage consists of characterizing a local geometry/topology of a node, considering if the node would become a candidate for removing and with what criteria would it be done. Afterwards criteria of decimation are being defined, determining if a loop of polygons surrounding the node can be removed and replaced with a lower number of surfaces. Decision is made on the basis of one of the two factors: distance between the node and the base plane or distance between the node and the main edge of the object. Last stage of Schroeder's algorithm consists of creating surfaces in the place of removed polygons. For every hole algorithm creates noncrossing surfaces as triangles. Filling takes place with use of the Recursive Loop Splitting algorithm that divides the hole into two halves going along the division line, which is defined by two noncontiguous vertices. Every hole is divided multiple times until there will be only three vertices for every surface. Finally all obtained holes are filled with triangles. After reducing dimensionality model is exported into STL file format by STLwrt module.
The next stage consists of preparing the model for exporting into the PDF 3D file format. The process is performed by MeshLab [8] software. Afterwards additional scripts are created for nesting the 3D geometry in PDF file with use of LaTeX [9] software. At the beginning 3D geometry is imported into the MeshLab software. It is required for changing the file format from .stl to .u3d (Universal 3D) [10], one of the two formats supported by PDF files. While exporting the 3D model MeshLab automatically creates file with preliminary LaTeX code, which will be used in the further processing for determination of individual properties. After that proper code for embedding 3D model in LaTeX is generated. Firstly .tex file created by MeshLab is read. Basic parameters like coordinates of 3D geometry or its size are recalculated and used for generating new .tex file containing page layout, scene properties, attachments and camera options of future PDF. Then additional file containing parameters of basic views is created. On the basis of coordinates taken from the proper .tex file and size of the 3D geometry subsequent camera properties are calculated for: Front, Back, Right, Left, Top and Bottom view and saved into the .vws file. That is because the model is fixed in the three-dimensional space and the relative movement is reached by moving the camera around the geometry. There are also specified such parameters as radius of orbit, centrum of orbit, camera's aperture angle or initial camera position (Figure 4). Normally perspective camera is used but there is also a possibility to change it with orthogonal version in case, by adding additional code.
Embedding 3D model into PDF file is performed by LaTeX software. To do so all files prepared in previous stages need to be used: .u3d file containing information about 3D geometry (vertices, polygons and faces) and its coordinates, .vws file containing information about basic views and their parameters and .tex file containing information about page layout and attachments. As the result of the compilation a fully interactive 3D PDF is created ( Figure 5).  Presented method was used as a part of preoperative evaluation of adolescent idiopathic scoliosis. With use of free Adobe Reader and created 3D PDF a wide variety of measurements, necessary for proper operation-procedure planning, were made. The spine was analyzed to evaluate the pedicles tilt angles (in relation to longitudinal axis of vertebra), their width and distances between apical vertebra and central sacral line. Evaluated parameters are the most important measurements used for proper insertion of transpedicular screws into vertebra. During the surgery physician need to drive them threw the vertebral pedicle to the vertebral corpus avoiding entering the spinal canal and injuring the spinal cord. Afterwards on the basis of post-operative CT examination additional 3D PDF was created to analyze results of the surgery. Usage of the measuring tools will be presented on the example of vertebral pedicles tilt angles and widths of a real patient requiring surgery.

Results
As the result of this work software called DICOM2PDF3D, combining described above stages of building 3D model in a single procedure, was developed.
Its interface allows creation of 3D objects in a simple way with a possibility to determine the area of imaging, level of smoothing and elements reduction. What is more software gives an opportunity to use one of the built-in settings for easy visualization of basic tissues. The final result of the DICOM2PDF3D actions is the common PDF file containing a 3D geometry openable on every computer equipped with free Adobe Reader, as it was assumed.
With use of 3D PDF additional measurements of created geometry were made (Table 1). At the beginning area of interest was defined by making cross section of examined vertebra. The position and orientation of cutting plane was determined in cross section properties to make the measurements more accurate. Afterwards vertebrae pedicles tilt angles and widths were measured ( Figure 6). Presented method was applied to each vertebra. 3D measurements confirmed values obtained from CT data that were used during the surgery. That makes the method valuable for use during the preoperative evaluation and worth further development.   Accuracy of obtained 3D models was validated. Created geometry was compared with other models produced with 3DSlicer and OsiriX software (Figure 8) (Table 2).  The accuracy of created 3D models is similar to one obtained from 3Dslicer or OsiriX software. The shape difference is smaller than 0,5% and only appears because of different segmentation techniques, what makes it negligible for the visualization, surgery planning or treatment monitoring. DICOM2PDF3D exports results into PDF3D file format, reducing their weight to about 5% of standard STL model weight created in 3DSlicer or OsiriX. Additionally PDF file can be easily opened on every computer and mobile device without sophisticated software. Such features allow easy sharing for additional consultations all over the world.

Discussion
This work describes an effective method of automatic creation of 3D objects from the DICOM images. It is worth to note that the DICOM2PDF3D is made on a basis of other open-source projects, without taking advantage of any commercial software. What is more there is no need to go through any special training or to use a computer tomography laboratory. The presented solution allows creating three-dimensional visualizations on every desktop computer even by inexperienced users. According to previously made assumptions, size of the output data created DICOM2PDF3D is incomparably lower than size of data created with other medical imaging techniques. PDF files, containing the 3D geometry, may be sent as an e-mail attachment having size of megabytes. In comparison, standard image sets obtained from computer tomography or magnetic resonance examinations usually have several hundred megabytes. PDF files are openable on every computer equipped with free Adobe Reader software, what makes exchanging the information between hospitals much easier. It also allows small institutions, without their own CT laboratory, to take advantage of high-tech diagnostic methods, increasing the quality of treatment.
In the presented example after determining vertebrae pedicles tilt angles and widths crucial for the surgery decisions were made. Certain vertebrae were chosen for placing screws to achieve the best results. What is more screws diameters, lengths and screwing angles were defined to obtain the best strength properties simultaneously avoiding injuring the spinal cord.

Conclusion
Developed software presents an efficient way of using 3D visualizations in every day medical practice, however it is not flawless. In the future instead of combining multiple existing procedures, a dedicated software will be prepared to make the calculations faster. Another disadvantage of presented solution is used segmentation method, which is limited and usable almost only for bone extraction from computed tomography images. Additional segmentation methods will be implemented to increase the practical application of presented solution. This work and its further development are funded under the grant, which progress will be presented soon.
To sum up, DICOM2PDF3D allows every user, including physicians and patients, creating, watching and sharing 3D visualizations of medical examinations, anywhere, on any computer and anytime. It is also worth to mention that developed software is not only usable with actual data, but can also be used with archival examinations.