# 3D Visualization in Digital Medicine Using XR Technology
## 3 Results
### 3D Voxel-Based Visualization  
To be able to display the 3D imaging of the selected digitized medical serial section in the virtual reality, we have developed a formula, which is suitable not only pathological samples but also using any DICOM-based medical image file as input. With this solution, we can display the digital serial sections to the doctor in their original 3D form. We set up mathematical relationships to be able to determine the appropriate coordinates of the current vertices of each voxel in the 3-dimensional space. The following equation gives the 3D coordinates of the first vertex of the first voxel of a series section reconstructed in 3 dimensions on the \(x,y\) and \(z\) plane. \[V_{p}=\left[\left(\left(x+V_{o}\big{[}1\quad 1\big{]}\right)\ast V_{s}[1] \right)\,\left(\left(y+V_{0}\big{[}2\quad 1\big{]}\right)\ast V_{s}[2]\right)\, \left(\left(z+V_{0}\big{[}3\quad 1\big{]}\right)\ast V_{s}[3]\right)\right] \tag{1}\]  
The notations in the equation mean the following:  
* \(V_{p}\): A 3-element matrix with 1 row and 3 columns. These individual values represent the 3D position of a given vertex of a given voxel. Figure 1: **(a)** The structure of our solution. **(b)** The result of our 3D VR visualization with CT samples. **(c)** The result of our 3D VR visualization with SPECT samples. **(d)** The result of our 3D VR visualization with digital pathology samples. * \(x\): The given width coordinate of the medical image. * \(y\): The given height coordinate of the medical image file. * \(z\): The index of the medical image to be displayed within the serial section. * \(V_{o}\): A matrix with 3 rows and 8 columns, which can be used to algorithmically determine the vertices of the voxels. The Vo matrix looks like this: \( \begin{bmatrix}0&1&0&0&0&1&1\\ 0&0&1&0&1&0&1&1\\ 0&0&0&1&1&1&0&1\end{bmatrix} \)
* \(V_{s}\): The matrix determining the size of the voxels. This can be used to specify the size of the serial section to be displayed within virtual reality. The \(V_{s}\) matrix structure is as follows: \( \begin{bmatrix}1&1&1\end{bmatrix} \)  
By expanding Equation (1), we can represent an entire serial section in voxel-based 3D, and determine the 3D coordinates of all vertices of all voxels. In this case, the number of elements in the series section, also known as the number of samples in the serial section, must be taken into account during the calculation. This is represented by the following equation:  
\[V_{x,y,z,l}=\left[\left(\left(x+V_{o} \begin{bmatrix}1&l\end{bmatrix} \right)*V _{s} \begin{bmatrix}1\end{bmatrix} \right)\,\left(\left(y+V_{o} \begin{bmatrix}2& l\end{bmatrix} \right)*V_{s} \begin{bmatrix}2\end{bmatrix} \right)\,\left( \left(z+V_{o} \begin{bmatrix}3&l\end{bmatrix} \right)*V_{s} \begin{bmatrix}3 \end{bmatrix} \right)\right] \tag{2}\]  
In the case of the equation, the following restrictions apply to the variables \(x,y,z,l\):  
* \(x\in[1\;W]\),
* \(y\in[1\;H]\),
* \(z\in[1\;D]\),
* \(l\in[1\;8]\),  
where:  
* W: Width of digitized pathology sample in pixel. * H: The height of the digitized pathological sample in pixel. * D: The number of samples in the digitized pathological serial section. In this case, the applied variables \(V_{s}\), and \(V_{o}\) are the same as their counterparts used in Equation (1). As Figure 2 shows, by using the voxel-based solution, we were able to reconstruct the digitized pathological tissue sample in a 3D virtual reality environment. Using Equation (2) after performing the calculations related to the display, we got too low values for the frame per second concerns them. From the point of view of the usability of our solution, we considered it important to optimize it, because the frame per second is reduced even further if the user wants to display a serial section consisting of several samples, or if the user's hardware has limited computing resources. The result of the optimization can be seen in Section 3.3. Figure 2: An example for the final result of the 3D voxelization of a DICOM medical image file, visualized in virtual reality.