# \donttest{
# 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)
# }
Run the code above in your browser using DataLab