Converting DICOM to STL for 3D Printing: A Process, and Software Package Comparison


 Background : Extracting and three-dimensional (3D) printing an organ in a region of interest in DICOM images typically calls for segmentation in support of 3D printing as a first step. Next, the DICOM images are converted to STL data. After primary and secondary processing, including noise removal and hole correction, the STL data can be 3D printed. The quality of the 3D model is directly related to the quality of the STL data. This study focuses and reports on conversion performance for nine software packages. Methods : Multi-detector row CT scanning was performed on a dry human mandible with two 10-mm-diameter bearing balls as a phantom. The DICOM images file was then converted to a STL file using nine different commercial/open-source software packages. Once the STL models were constructed, the data properties and the size and volume of each were measured and differences across the software packages were noted. Additionally, to evaluate differences between the shapes of the STL models by software package, each pair of STL models was superimposed, with observed differences between their shapes characterized as shape error. Further, deformation caused by reduction in the number of triangles was evaluated. Results : The data size and the number of triangles were different across all software packages. The constructed ball STL model expanded in the X-, Y-, and Z-axis directions, with the length in the Z-axis direction (body axis direction) being slightly longer than other directions. There were no significant differences in shape error across software packages for the mandible STL model. No shape change was observed relative to reduction in the number of triangles. Conclusions : Statistically, no significant differences were found across software packages for size and volume. However, different characteristics of each software package were noticeable, such as different effects in the thin cortical bone area, likely due to the partial volume effect, which may reflect differences in image binarization algorithms. Although the shape of the STL model differs slightly depending on the software, our results indicate that shape error in 3D printing for clinical use in oral and maxillofacial surgery remains within acceptable limits.


Abstract
Background : Extracting and three-dimensional (3D) printing an organ in a region of interest in DICOM images typically calls for segmentation in support of 3D printing as a first step. Next, the DICOM images are converted to STL data. After primary and secondary processing, including noise removal and hole correction, the STL data can be 3D printed. The quality of the 3D model is directly related to the quality of the STL data. This study focuses and reports on conversion performance for nine software packages.
Methods : Multi-detector row CT scanning was performed on a dry human mandible with two 10-mmdiameter bearing balls as a phantom. The DICOM images file was then converted to a STL file using nine different commercial/open-source software packages. Once the STL models were constructed, the data properties and the size and volume of each were measured and differences across the software packages were noted. Additionally, to evaluate differences between the shapes of the STL models by software package, each pair of STL models was superimposed, with observed differences between their shapes characterized as shape error. Further, deformation caused by reduction in the number of triangles was evaluated.
Results : The data size and the number of triangles were different across all software packages. The constructed ball STL model expanded in the X-, Y-, and Z-axis directions, with the length in the Z-axis direction (body axis direction) being slightly longer than other directions. There were no significant differences in shape error across software packages for the mandible STL model. No shape change was observed relative to reduction in the number of triangles.
Conclusions : Statistically, no significant differences were found across software packages for size and volume. However, different characteristics of each software package were noticeable, such as different effects in the thin cortical bone area, likely due to the partial volume effect, which may reflect differences in image binarization algorithms. Although the shape of the STL model differs slightly depending on the software, our results indicate that shape error in 3D printing for clinical use in oral and maxillofacial surgery remains within acceptable limits. Background 3 Digital Imaging and COmmunications in Medicine (DICOM) is the leading standard around the world within the medical imaging information field. Three-dimensional (3D) printing from DICOM images has become easier with advancement of technologies such as medical engineering, imaging engineering, and the evolution and decreasing costs of hardware and software. Patient-specific 3D models are now being used in many situations within the oral and maxillofacial surgery fields, including education, surgical planning, and surgical simulation [1][2][3][4].
3D printing of DICOM images works with stacked 2D images that must be converted into a data format required by the 3D printer. For this purpose, DICOM images are now being converted to 3D CAD (Computer-Aided Design) format for intermediate data, on which primary-processing such as region of interest (ROI) setting can be performed. Of the approximately 40 file formats of 3D CAD data that are used as 3D native files and intermediate files, an STL (STereoLithography) file format is the most commonly used for 3D printing. There are also many commercial (fee-based) and open-source (free-of-charge) software packages for converting DICOM images into STL data, all of which can run on a general-purpose personal computer (PC).
In 2018, we reported in 3D Printing in Medicine a "one-stop 3D printing lab" that enables data construction for 3D printing in one facility [5]. In this lab the first step toward 3D printing is converting the DICOM images into STL data and constructing the STL (3D CAD) model. We have found that the shape of the constructed STL model varies slightly from one software package to another. The quality of the STL data affects the 3D printing, and insufficient STL data can lead to the unsuccessful fabrication of 3D models.
We focus on the performance of software packages that convert DICOM images into STL data and report on a comparative analysis across the packages to understand the differences of each and their characteristics. The purpose of this study was to investigate the points to be noted in designing STL data for 3D printing the higher definition of 3D models in the field of oral and maxillofacial surgery.

Methods
In this study, forms of software that convert DICOM images into STL file format data (or that offer a conversion function) are referred to as "software packages", and a 3D surface model (virtual 3D model) constructed from STL data is referred to as "an STL model".
Multi-detector row CT (MDCT) scanning was performed on a dry human mandible with two 10-mmdiameter aluminum bearing balls attached to the left and right mental regions as phantoms. A gap of about 1 mm was maintained between the mandible and ball to aid segmentation in PC. The DICOM images have been converted to a binary STL file using one of these packages. First, the size and volume of each STL model were measured. Besides, all mandible STL models were compared to gauge whether there were differences in the shapes of constructed STL models that could be correlated with differences in software, and if so, which areas were affected. Finally, shape changes due to reduction in the number of triangles were noted.

1.
DICOM to STL data conversion Table 1 shows details of the nine software packages available for this purpose that can be run on a PC. ROI and threshold were set for each software package to construct the STL model. The threshold for binarization was set to 350 as a voxel value (brightness value) corresponding to a CT value across all software packages. For packages that support a parameter for resolution, it was set to "maximum". Some software packages were able to reduce the data size when converting to STL data; for these, "no data size reduction (or minimum)", "no smoothing" was selected. The STL data was exported in binary format. ImageJ, by default, does not have an STL convert/export function, so a plugin tool (3D Viewer, https://imagej.nih.gov/ij/plugins/3d-viewer) was installed. 2.

3D coordinate system and measurement
Figure 1 shows the coordinate system in 3D space, and measurement of the length of the STL models in the X-, Y-, and Z-axis directions using the polygon editing software POLYGONALmeister Ver. 4 (PMV4, UEL Corp., Tokyo, Japan) [6]. The coordinate system used in this study was based on the DICOM standard: the positive X-axis points toward the phantom's left side, the positive Y-axis points toward the phantom's posterior and the positive Z-axis points from inferior to superior direction.

Superimposition and shape error evaluation
To determine shape error (shape differences between two models that are signed differences), CAD comparison and inspection software SpGauge 2014.1 (SpG, Aronicos Co., Ltd., Shizuoka, Japan) was used for performing superimposition and measurement. For the superimposition, one of two STL models was moved using the best-fit surface-based registration algorithm of SpG, with the operation repeated until the movement amount with the other STL model approached as close to 0.00 mm as possible. Mean, maximum, and minimum shape errors were recorded, with expansion indicated as positive and contraction indicated as negative. In the color mapping, positive errors are displayed in warm colors and negative errors are displayed in cool colors.

Statistical analysis
Correlation between the mandible STL model and the ball STL model was determined using Spearman's rank correlation coefficient applied to the difference between lengths in each of the X-, Y-, and Z-axis directions, and also differences in volume. Comparisons between ball STL models were performed by one-way ANOVA followed by Tukey's multiple comparison test. After superimposition, the shape error of mandible STL models was evaluated using the Kruskal-Wallis test, and multiple comparisons via the Steel-Dwass test. Statistical analysis was performed using open-source statistical analysis software R Ver 3.6.1 [7], with a statistical significance level set at 5%.

6
The data size of each STL model and the number of triangles in it for each software package were shown in Table 2. For the ball STL model, lengths in the X-, Y-, and Z-axis directions exceeded 10 mm, with length of the Z-axis direction longer than those of the X-, and Y-axis directions, with significant differences between lengths of the ball STL model across software packages (Fig. 2). One software package (MCS) showed larger values for lengths of X-and Y-axis directions compared with the other eight software packages (Fig. 3). A negligible to low correlation was observed between the ball STL model and the mandible STL model for the lengths of the X-, Y-, and Z-axis directions. With regard to volume, a high correlation was found between the ball STL model and the mandible STL model (Table 3). One software package (IN3) showed a larger value than the other eight packages (Fig. 4).
Evaluation after superimposition of the STL models found slight variations for each software package, with a mean shape error of 0.11 mm, maximum shape error of + 1.69 mm, minimum shape error of -1.55 mm, median shape error 0.08 mm and 95% confidence interval, 0.08 to 0.135. No significant differences were found for shape error across software packages (Fig. 5).

Discussion
Difficulty of 3D printing in oral and maxillofacial surgery Because our 3D printing system uses a fused deposition modeling (FDM) desktop 3D printer, which is suitable for fabricating solid 3D models, our fabric target is teeth and jawbones. Our system makes it possible to fabricate "inexpensive" 3D models for oral and maxillofacial surgery. 3D models are particularly useful because curved surfaces and minute areas are difficult to understand via a PC display [5]. However, knowledge about 3D printing is sparse, especially with regard to how to create "necessary and sufficient" data rather than utilization of case reports of 3D models. We therefore needed to learn 3D printing through trial and error.
We divided our workflow into three steps, each of which requires a different file format.
Step 1 involves acquiring a 3D volume image of the patient as a DICOM images file.
Step 2 entails segmenting the anatomical structure from surrounding structures and converting/exporting the segmented virtual 3D model in STL data format. Segmentation of hard and soft tissue is relatively easy. However, in many cases it is difficult to construct an STL model for two reasons. One reason is that thin hard tissue (e.g. bone surrounding the nasal cavity, orbital floor), and narrow tissue gaps (e.g. upper and lower joint cavity between the temporal bone and the mandible) are not clearly reproduced in the STL model. Secondly, many artifacts (e.g. metal artifacts and/or beam-hardening from dental prostheses) reduce the readability of the images and prevent segmentation.
Step 3 concerns 3D printing the physical 3D model, which requires use of G-code generation software [8] to produce G-code as 3D printable data. Each step of the entire process-segmentation of DICOM images, processing of STL data, generation of G-code data, and performance of the 3D printer itself-affects the accuracy of the final 3D model. Constructing STL data is the most important operation in fabricating the 3D model.

Characteristics of DICOM to STL conversion software
Additive manufacturing using desktop 3D printers requires 3D CAD data to represent the 3D shape.
The STL file format system manages this by using a collection of small triangles or polygons. A curved surface is formed by thinning the triangles that compose the 3D model. Software forms used in this study include software equipped as a function of a medical image viewer, software developed in the field of CAD engineering, and software developed as a function of 3D printing software used in the industrial field; they therefore come from a range of different backgrounds.
Appearances of the constructed STL models differed across software packages. Most notably, the cortical bone of the top and/or lateral pole of the mandibular condyle was thin, so the reproducibility of this part was different across all software packages (Fig. 6). When "faithfully" fabricating according to this STL model, the steps would appear as holes (defects). Moreover, in some software packages, the surface of each STL model was rough.
Although the ball STL model was constructed by MDCT scanning of a 10-mm-diameter bearing ball, all software packages rendered it expanded in all directions. The average ball length in all directions was 10.52 mm, but the length in the Z-axis direction was slightly longer than in the X-and Y-axis directions. This is likely because of differences in voxel size of DICOM images (X-, Y-, Z-axis direction lengths were 0.468, 0.468, and 0.500 mm, respectively), and may also have been affected by the partial volume effect that occurred on the border between the ball surface and the air. The diameter of the ball in the STL model was calculated from the mean value of the volume (605.23 ± 42.38 mm 3 ) as 10.49 mm. The shape error for this entity was equivalent to the size of one voxel, and was reproduced by each software package.
It is difficult to quantitatively assess the STL conversion performance of each software package independently. To solve this problem, this study superimposed pairs of STL models (constructed with different software packages) on each other; the difference between each pair was visualized and measured as a shape error. Although differences between shapes of the constructed STL models were visible on the shape error image, no significant statistical differences were found across all mandible STL models. Figure 7 shows images captured by superimposition and visualization of S3D and MIT, which had the minimum shape error. Figure 8 shows images of MCS and VE3 having a maximum shape error. The reason the shape errors could be seen by the software packages, though only slightly, was that the binarization algorithms differ across software packages. There are various binarization methods [9]. The shape differences appeared because of differences in image processing near threshold values, such as the thin cortical bone or strongly curved surface. The color map of Fig. 8 is colored as a green to yellow area, with mean distances of around 0.30 mm. This is smaller than one voxel size. Regarding the roughness of the surface of the STL model, it was thought that the influence of the unevenness was small in measuring. Therefore, it was considered that the shape error was not affected. Therefore, it can be assumed that this kind of error is acceptable in fabricating 3D models for clinical use in oral and maxillofacial surgery [10][11][12].
STL data represent a 3D shape as a collection of small triangles. The number of triangles depends on the size, shape and internal structure of the object. More complex features and higher resolution lead to an increase in the number of triangles in the converted/exported STL data. Processing a large number of triangles draws heavily on the processing power of a PC; the calculation is time-consuming and can affect subsequent operations. Reduction in the number of triangles directly leads to a reduction in data size. However, a reduction in the number of triangles may also cause a change in shape [13]. Therefore, the mandible STL model was superimposed before and after the reduction in the number of triangles to evaluate the dimensional change, and the shape error was observed. To reduce the number of triangles to 200,000, i.e. the number of triangles recommended in the report [14], the "simplify data by specifying the number of triangles" function of PMV4 was used [15]. was somewhat rough when displayed on the monitor, the resultant shape error of that STL model relative to the models with the largest and the mean numbers of triangles was almost 0 mm.
Considering that the minimum laminating pitch of the FDM desktop 3D printer we use is 0.05 mm, this supports the inference that the recommended number of triangles was both necessary and sufficient for 3D printing.

Limitations and prospects
The shape errors are inevitable because of the spatial resolution limits of MDCT. However, when using 3D models in fields that require more detailed operations, such as microscopic surgery, other modality options should be considered, such as the use of limited cone-beam CT, which expected that produces a better high-definition STL model. In this study, a MDCT scanner was used to convert DICOM images to STL data under the condition of fixed voxel value binarization threshold. In addition to differences between patients, physics-based factors such as irradiation dose and other differences in MDCT models and scanning parameters may also affect the difficulty of constructing STL models [16,17]. Setting a threshold for 3D printing requires medical knowledge, especially tomographic image anatomy, as well as knowledge of modalities of imaging principles. For example, in surgical simulation, it is necessary to reproduce not only the 2D shape but also the 3D shape of the lesion.
Detection of the lesion depends on the skills of a radiologist who has comprehensive knowledge of anatomy, disease, and surgical techniques. At present, it is common practice to fabricate 3D models cooperate with to the purpose of use in consultation with a technician. To become more familiar, it will be important to train radiologists in combinations of medicine, 3D printing technology, digital engineering, and image engineering. To that end, it may be advisable to introduce 3D printing technology at the undergraduate level of medical/dental education.

Conclusions
We evaluated nine commercial/open-source software packages that convert DICOM images into STL data. Our evaluation included superimposing STL models constructed by different software packages over each other, to visualize and measure shape error. However, the slight differences we found were negligible and can be considered acceptable for clinical use of 3D models in oral and maxillofacial surgery. In designing data for 3D printing of fine and/or thin structures such as mandibular condyle shown in this study, it is important to pay close attention to setting the threshold for ROI and binarizing DICOM images when converting. In conclusion, when using STL data conversion software, it is important to understand the features and characteristics of the software package to carefully align its use with the intended purpose.

Ethics approval and consent to participate
The study protocol was reviewed and approved by the institutional review boards of the participating institutions.

Consent for publication
The authors grant the publisher the sole and exclusive license of the full copyright in the contribution, which licenses the publisher hereby accepts. Consequently, the publisher shall have the exclusive right throughout the world to publish the contribution in all languages, in whole or in part, including, without limitation, any abridgment and substantial part thereof, in book form and in any other form including, without limitation, digital, electronic and visual reproduction, electronic storage and retrieval systems, including internet and intranet delivery and all other forms of electronic publication now known or hereinafter invented.
The authors guarantee that the contribution to the work has not been previously published elsewhere, or that if it has been published in whole or in part, any permission necessary to publish it in the work      Shape error (signed differences) measurement after superimposing pairs of STL models, using SpG. The black square indicates mean value, the upper limit indicates maximum value, and the lower limit indicates minimum value.  Comparison of STL models between S3D (a) and MIT (b) where the shape error between the two STL models was the minimum value. Visualization of shape error (signed differences) after superimposition is shown on the right (c). Almost all of the STL model was green. The mean error between the two STL models was 0.00 mm (maximum +0.16 mm, minimum Comparison of the STL model of MCS (d) and of VE3 (e) which evidenced the largest shape error between any two STL models. Visualization of shape error (signed differences) after superimposition is shown on the right (f). The whole mandible is depicted as green to yellow (shape error range of about 0.0 mm -0.5 mm), with occasional orange to red parts. The mean shape error was 0.27 mm (maximum +0.80 mm, minimum -0.81 mm).

Figure 9
Visualization of the STL model constructed with IN3, which had the largest volume and number of triangles, the STL model with the reduced number of triangles, and the shape error (signed distances) after superposition. When the original number of 1,247,962 (a) triangles was reduced to 200,000 (b), the surface of the STL model appeared to be slightly rough. In the color map, the entire area was green (c). The mean shape error was 0.02 mm.