mesh.spheric.proj: Adding spherical coordinates to a mesh

View source: R/mesh_spheric_proj.R

mesh.spheric.projR Documentation

Adding spherical coordinates to a mesh

Description

The mesh.spheric.proj function adds latitude and longitude coordinates to a mesh. These features map the mesh surface to a sphere. Latitude and longitude are computed using the heat diffusion approach explained by Brechbühler et al. [1].

Usage

mesh.spheric.proj(mesh, verbose = TRUE)

Arguments

mesh

"mesh" class object.

verbose

Boolean, by default set to FALSE. Allows you to inhibit comments.

Value

returns a "mesh" class object in which $mesh contains Lat and lon evaluated at vertices. The function allows to have a parameterized surface for later computations as curvature or shape index, hence, nor the surface, nor the angles are preserved. In the DICOM frame of reference, latitude goes along Z axis (from feet = -1 to head = +1) and longitude turns counter clockwise (from -1 to +1).

Note

This funtion is time consuming.

References

[1] \insertRefBRECHBUHLER1995154espadon

Examples

# loading of toy-patient objects (decrease dxyz for better result)
step <- 6
patient <- toy.load.patient(modality = c("ct", "rtstruct"), roi.name = "", 
                             dxyz = rep(step, 3))
CT <- patient$ct[[1]]
S <- patient$rtstruct[[1]]

# creation of the patient mesh
bin <- bin.from.roi(CT, struct = S, roi.name = "patient", verbose = FALSE)
m.skin <- mesh.from.bin(bin)

m.proj <- mesh.spheric.proj(m.skin, verbose = FALSE)

if (interactive()) {
  col <- hcl.colors(12, "Blue-Red 3")
  rgl::open3d()
  rgl::shade3d(m.proj$mesh, meshColors = "vertices",
               color = col[round((m.proj$mesh$Lat/2 + 0.5) * 11) + 1],
               specular = "#404040")
  rgl::open3d()         
  rgl::shade3d(m.proj$mesh, meshColors = "vertices",
               color = col[round((m.proj$mesh$Lon/2 + 0.5) * 11) + 1],
               specular = "#404040")
                
}

espadon documentation built on May 8, 2026, 9:07 a.m.