View source: R/BoneDensityFunctions.R
color_mesh | R Documentation |
Takes a density vector mapped to standardized coordinates and maps it to a surface mesh for visualization.
color_mesh(
surface_mesh,
template_pts,
density_vector,
maxi = NULL,
mini = NULL,
export_path,
color_sel
)
surface_mesh |
Mesh object |
template_pts |
Matrix |
density_vector |
Vector |
maxi |
Numeric |
mini |
Numeric |
export_path |
Character |
color_sel |
String |
mesh3d object with added color dimension
Scott Telfer scott.telfer@gmail.com
# Download CT scan
url <- "https://github.com/Telfer/BoneDensityMapping/releases/download/v1.0.1/test_CT_hip.nii.gz"
scan_filepath <- tempfile(fileext = ".nii.gz")
download.file(url, scan_filepath, mode = "wb")
nifti <- import_scan(scan_filepath)
url2 <- "https://github.com/Telfer/BoneDensityMapping/releases/download/v1.0.2/test_CT_femur.stl"
bone_filepath <- tempfile(fileext = ".stl")
download.file(url2, bone_filepath, mode = "wb")
surface_mesh <- import_mesh(bone_filepath)
landmark_path <- system.file("extdata", "test_femur.mrk.json",
package = "BoneDensityMapping")
landmarks <- import_lmks(landmark_path)
mapped_coords <- surface_points_template(surface_mesh, landmarks,
no_surface_sliders = 1000)
dens <- voxel_point_intersect(mapped_coords, nifti,
ct_eqn = "linear",
ct_params = c(68.4, 1.106))
colored_mesh <- color_mesh(surface_mesh, mapped_coords, dens)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.