Get started


The espadon package has the mesh.from.bin function to create a  triangle mesh from a binary volume and the display.3D.mesh function to display it  in any frame of reference.

In the example below, the patient folder contains a CT-scan files and  a DICOM rtstruct file in which lung and heart are outlined :

library (espadon)
patient.folder <- choose.dir ()
pat <- load.patient.from.dicom (patient.folder, data = TRUE)

bin.lung <- bin.sum (bin.from.roi (pat$ct[[1]], struct = pat$rtstruct[[1]], = "lungl"),
                     bin.from.roi (pat$ct[[1]], struct = pat$rtstruct[[1]], = "lungr"))
bin.heart <- bin.from.roi (pat$ct[[1]], struct = pat$rtstruct[[1]], = "heart")

mesh.lung <- mesh.from.bin (bin.lung)
mesh.heart <- mesh.from.bin (bin.heart)

display.3D.mesh (mesh.lung, color = "burlywood2", specular = "black", alpha = 0.8)
display.3D.mesh (mesh.heart, color = "red", specular = "black", alpha = 1) 
display of the lung mesh and the heart mesh.

Sometimes, the mesh contains holes. The function can be used to repair the mesh by removing the degenerated triangles.