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

View source: R/BoneDensityFunctions.R

bone_scan_checkR Documentation

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)

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

Value

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

Author(s)

Scott Telfer scott.telfer@gmail.com

Examples


  # 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)


BoneDensityMapping documentation built on Aug. 8, 2025, 6:46 p.m.