Learn R Programming

BoneDensityMapping (version 0.1.4)

bone_scan_check: Check if surface model is fully contained within scan volume

Description

Check if surface model is fully contained within scan volume

Usage

bone_scan_check(surface_mesh, nifti, return_limits = FALSE)

Value

If any vertices lie outside the scan volume, it raises an error.

Arguments

surface_mesh

mesh object (class mesh3d) or numeric matrix/dataframe of vertex coordinates (cols: X, Y, Z)

nifti

NIfTI image object representing CT scan.

return_limits

Logical. If TRUE returns a summary of the bounding boxes of the scan and mesh

Author

Scott Telfer scott.telfer@gmail.com

Examples

Run this code
# \donttest{
  # Download CT scan
  url <- "https://github.com/Telfer/BoneDensityMapping/releases/download/v1.0.2/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)
  bone_scan_check(surface_mesh, nifti, return_limits = TRUE)
# }

Run the code above in your browser using DataLab