dicomtk.ai (0.2.0) is the AI, radiomics, and clinical NLP satellite package for dicomtk. It provides a non-weakening 5-stage ellmer agent loop, a native Model Context Protocol (MCP) server, pluggable segmentation backends (IHE AIR), clinical report de-identification, DuckDB foundation-embedding search, an IBSI Phase-1 standardized 3D radiomics engine, train/test-safe ComBat harmonisation, and MONAI MAISI-style 3D synthetic CT + multi-organ mask generation.
install.packages(
"dicomtk.ai",
repos = c(
"https://lauyeehow1986-hub.r-universe.dev",
"https://cloud.r-project.org"
)
)
Or install from GitHub:
remotes::install_github("lauyeehow1986-hub/dicomtk.ai")
dicomtk.ai
ellmer)library(dicomtk.ai)
# The non-weakening guardrail prevents an LLM from disabling PS3.15 de-id,
# lowering pixel-cleaning confidence, or skipping attestation verification.
profile <- enforce_non_weakening_profile(
requested = list(jurisdiction = "HIPAA", verify_attestation = TRUE),
baseline = list(jurisdiction = "HIPAA", verify_attestation = TRUE)
)
# 5-stage pipeline: ai_agent_plan() -> ai_agent_dry_run() -> ai_agent_approve() -> ai_agent_execute() -> ai_agent_verify()
IHE AIR Exportlist_ai_backends()
# seg_res <- ai_segment(vol, backend = "offline_demo")
# air_bundle <- ai_export_results(seg_res, format = "ihe_air")
report <- "Patient John Tan (NRIC S8512345A) underwent CT Thorax on 2026-04-12. Impression: 12mm RUL nodule."
deid_rep <- ai_deid_report(report)
deid_rep$redacted_text
# Extract weak clinical labels & harmonize acquisition protocol names to RadLex
ai_extract_labels(deid_rep$redacted_text)
ai_harmonize_protocol("CT CHEST W/O IV CONT")
idx <- ai_embedding_index()
ai_index_add(idx, study_id = "STUDY_001", embedding = rnorm(64))
ai_search_similar(idx, query_embedding = rnorm(64), top_k = 5L)
ai_index_close(idx)
# Verify against the built-in IBSI Phase-1 digital phantom
phantom <- ibsi_digital_phantom()
feats <- ai_extract_radiomics(phantom$volume, phantom$mask, discretization = "none")
set.seed(42)
train_feat <- matrix(rnorm(120 * 10), nrow = 120)
train_batch <- rep(c("SCANNER_A", "SCANNER_B"), each = 60)
# Fit ComBat ONLY on training data, then apply to held-out test data (zero leakage)
fit <- combat_fit(train_feat, batch = train_batch)
train_harm <- combat_apply(fit, train_feat, batch = train_batch)
syn <- ai_generate_maisi(dim = c(64L, 64L, 32L), seed = 2026L)
dim(syn$volume$voxels)
table(syn$mask)
Browse the full reference at https://lauyeehow1986-hub.github.io/dicomtk.ai/.