View source: R/BoneDensityFunctions.R
plot_mesh | R Documentation |
plot mesh
plot_mesh(
surface_mesh,
density_color = NULL,
title = NULL,
legend = TRUE,
legend_color_sel = NULL,
legend_maxi = 2000,
legend_mini = 0,
userMat = NULL
)
surface_mesh |
Mesh object |
density_color |
Vector. Colors mapped from density values. |
title |
String. Plot title. |
legend |
Logical. Optional color bar. |
legend_color_sel |
Optional character with color gradient |
legend_maxi |
Numeric. Maximum bone density. |
legend_mini |
Numeric. Minimum bone density. |
userMat |
Optional matrix. Controls graph orientation. |
plot of mesh with color
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)
vertices <- t(surface_mesh$vb)[, c(1:3)]
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 = 5000)
mat_peak <- surface_normal_intersect(surface_mesh, mapped_coords,
normal_dist = 3.0, nifti, rev_y=FALSE)
color_mesh <- color_mesh(surface_mesh, mapped_coords, mat_peak, maxi = 2000,
mini = 0)
plot <- plot_mesh(color_mesh)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.