Overview
scimagR provides an end-to-end pipeline for longitudinal MRI and CT analysis in spinal cord injury (SCI) research. This vignette walks you through:
- Installing prerequisites
- Creating a new project
- Organizing your data
- Running the pipeline
- Analyzing results
Prerequisites
scimagR requires the following external tools:
- Spinal Cord Toolbox (SCT) >= 6.4: https://spinalcordtoolbox.com
- dcm2niix: https://github.com/rordenlab/dcm2niix
-
Python 3 with pydicom:
pip install pydicom
Check that all tools are available:
Creating a Project
Use sci_create_project() to scaffold a new
workflowr-based analysis project:
sci_create_project(
path = "~/projects/my-sci-study",
title = "Cervical SCI Longitudinal MRI Analysis",
author = "Your Name"
)This creates a complete directory structure with template files, configuration, and analysis Rmd notebooks.
Data Organization
Place your DICOM files in data/raw/dicom/ following this
structure:
data/raw/dicom/
├── SCI001/
│ ├── ses-01/
│ │ └── *.dcm
│ └── ses-02/
│ └── *.dcm
└── SCI002/
└── ses-01/
└── *.dcm
Fill in the CSV templates in data/metadata/:
-
imaging_registry.csv: One row per imaging session -
clinical_data.csv: One row per patient
Running the Pipeline
sci_run_pipeline() lists the processing steps and the
function that runs each one:
sci_run_pipeline("~/projects/my-sci-study", steps = 1:8)Check pipeline status at any time:
sci_pipeline_status("~/projects/my-sci-study")Computing SCI Metrics
scimagR includes validated implementations of common SCI metrics:
# Maximum Spinal Cord Compression
compute_mscc(di = 5.2, da = 8.1, db = 8.5)
# Compression ratio
compute_compression_ratio(ap = 6.5, transverse = 12.0)
# Phase classification
classify_phase(c(0, 5, 30, 200, 400))Visualization
Use the built-in theme and palettes for publication-ready figures:
library(ggplot2)
ggplot(data, aes(x = phase, y = mscc, fill = phase)) +
geom_violin() +
scale_fill_phase() +
theme_sci()