OSCR

A robust and reproducible automated MRI pipeline for quantifying tissue outcomes after experimental stroke in multi-center preclinical networks.

Code ↔ Paper

13 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 13 matches
  1. [1] § Methods › Automated image processing and analysis pipeline › Brain extraction › Traditional rule-based segmentation approach ↔ bin/SpanAuxSegmentBrainRule.sh, lines 1–50 · score 0.94 · Markov random field, Gradient magnitude, contrast enhancement, brain mask, brain extraction, Sobel
  2. [2] § Methods › Automated image processing and analysis pipeline › Estimation of swelling, atrophy, and midline shift ↔ bin/SpanAuxMidline.py, lines 1–49 · score 0.93 · brain volume laterality, atlas midline, midline CSF, shift metrics, right hemispheres, midline shift
  3. [3] § Methods › Automated image processing and analysis pipeline › Tissue, ventricle, and lesion segmentation ↔ bin/SpanAuxSegmentLesion.sh, lines 199–238 · score 0.85 · joint probability, threshold seed, lesion seeds, enforce, product, modality
  4. [4] § Methods › Automated image processing and analysis pipeline › Preprocessing and quality assessment ↔ bin/SpanMainRun.sh, lines 227–270 · score 0.84 · N4 bias field, decay rate, multi echo, exponential, relaxation, SNR
  5. [5] § Methods › Automated image processing and analysis pipeline › Estimation of swelling, atrophy, and midline shift ↔ bin/SpanAuxMidline.py, lines 1–49 · score 0.84 · standard atlas space, brain swelling, CSF mask, position, displacement, lateral
  6. [6] § Methods › Automated image processing and analysis pipeline › Tissue, ventricle, and lesion segmentation ↔ bin/SpanMainRun.sh, lines 376–421 · score 0.80 · multi modal, standard atlas space, seed, sigmoid, morphological, artifacts
  7. [7] § Methods › Automated image processing and analysis pipeline › Brain extraction › Modern neural network approach ↔ lib/unetseg/unetseg.py, lines 303–344 · score 0.71 · ADAM optimizer, augmentation, kernel, convolutional, architecture, batch
  8. [8] § Methods › Automated image processing and analysis pipeline › Atlas-based registration ↔ bin/SpanMainRun.sh, lines 319–374 · score 0.69 · rigid registration, native space, parameter map, transform, atlas, brain
  9. [9] § Methods › Automated image processing and analysis pipeline › Preprocessing and quality assessment ↔ bin/SpanAuxSegmentBrainRule.sh, lines 1–50 · score 0.69 · image intensity, NIfTI, resampling, background, noise, Otsu
  10. [10] § Methods › Automated image processing and analysis pipeline › Preprocessing and quality assessment ↔ bin/SpanMainRun.sh, lines 227–270 · score 0.66 · noise ratio, segmenting foreground, denoising, SNR, signal, intensity
  11. [11] § Methods › Automated image processing and analysis pipeline › Preprocessing and quality assessment ↔ bin/SpanAuxSegmentLesion.sh, lines 159–197 · score 0.58 · baseline signal, decay rate, voxels, maps, mask, volume
  12. [12] § Methods › SPAN MRI acquisition protocol ↔ bin/SpanAuxSegmentLesion.sh, lines 159–197 · score 0.53 · acute ischemic, diffusion, signal, voxel, ADC, lesion
  13. [13] § Methods › Automated image processing and analysis pipeline › Tissue, ventricle, and lesion segmentation ↔ bin/SpanMainRun.sh, lines 376–421 · score 0.51 · standard atlas space, boundaries, harmonization, species, threshold, ADC

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

Shell · 595 lines · 20 KB · other · 5 matches

  1. #! /usr/bin/env bash
  2. ##############################################################################
  3. #
  4. # SPAN Rodent MRI Analytics — Single-Case Processing Pipeline
  5. #
  6. # Purpose:
  7. # Main entry point for processing a single rodent brain MRI case through
  8. # the full SPAN analysis pipeline. Converts raw DICOM data into
  9. # quantitative stroke metrics including lesion volumes, midline shift,
  10. # and regional anatomical measurements.
  11. #
  12. # Pipeline stages (each is idempotent — skipped if output already exists):
  13. # 1. native.dicom — Copy and fix DICOM headers (merge ProtocolName/SeriesDescription)
  14. # 2. native.convert — Convert DICOM to NIfTI using dcm2niix; extract site metadata
  15. # 3. native.import — Identify modalities (ADC, T2, RARE); apply site-specific orientation
  16. # 4. native.denoise — Non-local means denoising (Otsu mask, slice-wise NLM)
  17. # 5. native.fit — Exponential decay fitting (S(TE) = alpha * exp(-beta * TE))
  18. # 6. native.mask — Brain extraction (U-Net for mice, rule-based morphology for rats)
  19. # 7. native.harm — Statistical harmonization of fitted parameter maps
  20. # 8. native.reg — Rigid registration to species-specific atlas using ANTs
  21. # 9. standard.fit/harm — Transform fitted/harmonized maps to atlas space
  22. # 10. standard.mask — Transform brain mask to atlas space; intersect with restriction mask
  23. # 11. standard.seg — Lesion and CSF segmentation using multi-modal thresholding
  24. # 12. standard.midline — Midline shift analysis (mm, percent, laterality indices)
  25. # 13. standard.label — Anatomical labeling (hemispheres, regions, tissue classes)
  26. # 14. standard.map — Compute quantitative metrics (volumes, intensities by region)
  27. # 15. standard.vis — Generate mosaic visualizations of segmentation overlays
  28. #
  29. # Inputs:
  30. # --case <dir> Case output directory (required; created if it doesn't exist)
  31. # --source <dir> DICOM source directory (required on first run)
  32. # --species <str> Species: "mouse" or "rat" (default: auto-detected from path)
  33. # --correct <dir> Correction directory containing flipi/flipj/flipk flags (optional)
  34. #
  35. # Outputs:
  36. # Populates the case directory with subdirectories for each pipeline stage.
  37. # Key outputs include:
  38. # standard.map/*.csv — Quantitative metric tables
  39. # standard.vis/*.png — Mosaic visualization images
  40. #
  41. # Dependencies:
  42. # dcm2niix, ANTs (N4BiasFieldCorrection), QIT, Python 3 + PyTorch (mice only)
  43. #
  44. # Author: Ryan Cabeen
  45. #
  46. ##############################################################################
  47. usage()
  48. {
  49. echo "
  50. Name: $(basename $0)
  51. Description:
  52. The SPAN Rodent MRI Analysis. This program performs lesion segment and
  53. quantification. The input should be a dicom directory.
  54. Usage:
  55. $(basename $0) [options} --case case_dir
  56. Optional Parameters:
  57. --source <dicom_dir>: specify the input dicom directory (required first time)
  58. --species <mouse|rat>: specify the species of the case (default=auto)
  59. --correct <correct_dir>: specify the correction directory (advanced)
  60. Author: Ryan Cabeen
  61. "
  62. exit 1
  63. }
  64. function check
  65. {
  66. if [ ! -e $1 ]; then
  67. "[error] required data not found: $1"
  68. exit 1
  69. fi
  70. }
  71. function runit
  72. {
  73. echo " running: $@"
  74. $@
  75. if [ $? != 0 ]; then
  76. echo "[error] command failed: $@"
  77. exit;
  78. fi
  79. }
  80. data="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd ../data && pwd)"
  81. workflow="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  82. name=$(basename $0)
  83. qitcmd="qit --verbose --debug"
  84. species=""
  85. source=""
  86. correct=""
  87. case=""
  88. posit=""
  89. while [ "$1" != "" ]; do
  90. case $1 in
  91. --source) shift; source=$1 ;;
  92. --correct) shift; correct=$1 ;;
  93. --case) shift; case=$1 ;;
  94. --species) shift; species=$1 ;;
  95. --help ) usage ;;
  96. * ) posit="${posit} $1" ;;
  97. esac
  98. shift
  99. done
  100. if [ $(echo ${posit} | wc -w) -ne 0 ]; then echo "unexpected positional arguments: ${posit}"; usage; fi
  101. if [ ""${case} == "" ]; then echo "no case provided"; usage; fi
  102. # Auto-detect species from the case directory path. The standard directory
  103. # layout uses process/{mouse,rat}/{early,late}/subject_id, so a path
  104. # containing "rat" or "mouse" indicates the species. Falls back to mouse.
  105. if [[ "${species}" == "" ]]; then
  106. abscase="$(cd "$(dirname ${case})" && pwd)/$(basename ${case})"
  107. echo " detecting species from case path"
  108. if [[ "${case}" == *rat* ]]; then species="rat"; fi
  109. if [[ "${case}" == *mouse* ]]; then species="mouse"; fi
  110. if [[ "${species}" == "" ]]; then
  111. echo " no species detected, defaulting to mouse"
  112. species="mouse"
  113. fi
  114. fi
  115. ##############################################################################
  116. # Processing
  117. ##############################################################################
  118. echo "started ${name}"
  119. # Stage 1: Copy DICOM source into the case directory and fix headers.
  120. # The header fix merges ProtocolName and SeriesDescription fields so that
  121. # dcm2niix can produce consistent, informative filenames during conversion.
  122. if [ ""${source} != "" ]; then
  123. if [ ! -e ${case}/native.dicom ]; then
  124. echo " using source: ${source}"
  125. mkdir -p ${case}
  126. tmp=${case}/native.dicom.tmp.${RANDOM}
  127. cp -r ${source} ${tmp}
  128. chmod -R u+w ${tmp}
  129. runit bash ${workflow}/SpanAuxDicomFix.sh ${tmp}
  130. mv ${tmp} ${case}/native.dicom
  131. fi
  132. fi
  133. # Check for axis-flip corrections. If the correction directory contains
  134. # files named flipi, flipj, or flipk, the corresponding axis will be
  135. # flipped during import to correct acquisition orientation errors.
  136. flips=""
  137. for c in flipi flipj flipk; do
  138. if [ -e ${correct}/${c} ]; then
  139. flips="${flips} ${c}"
  140. fi
  141. done
  142. cd ${case}
  143. echo " using case: ${PWD}"
  144. echo " using species: ${species}"
  145. check native.dicom
  146. # Stage 2: Convert DICOM to NIfTI format using dcm2niix.
  147. # Extracts site name from DICOM JSON metadata and builds an image index
  148. # CSV cataloging all scans with their acquisition parameters.
  149. # Output: native.convert/nifti/*.nii.gz, native.convert/site.txt, native.convert/images.csv
  150. if [ -e native.dicom ] && [ ! -e native.convert ]; then
  151. tmp=native.convert.tmp.${RANDOM}
  152. runit bash ${workflow}/SpanAuxConvert.sh native.dicom ${tmp}
  153. mv ${tmp} native.convert
  154. fi
  155. # Stage 3: Import and organize converted images into a standardized format.
  156. # Identifies ADC, T2, and RARE modalities by filename patterns. Applies
  157. # site-specific image orientation (from params/<site>/orient.json) and
  158. # resamples to a common geometry. Applies any axis-flip corrections.
  159. # Output: native.import/{adc,t2,rare}.nii.gz, native.import/{adc,t2}.txt (echo times)
  160. if [ -e native.convert ] && [ ! -e native.import ]; then
  161. tmp=native.import.tmp.${RANDOM}
  162. runit bash ${workflow}/SpanAuxImport.sh native.convert ${tmp}
  163. for c in ${flips}; do
  164. for v in adc t2; do
  165. echo " correcting ${v} with ${c}"
  166. runit mv ${tmp}/${v}.nii.gz ${tmp}/${v}.raw.nii.gz
  167. runit ${qitcmd} VolumeReorder \
  168. --${c} \
  169. --input ${tmp}/${v}.raw.nii.gz \
  170. --output ${tmp}/${v}.nii.gz
  171. done
  172. done
  173. mv ${tmp} native.import
  174. fi
  175. # Stage 4: Denoise the multi-echo ADC and T2 volumes.
  176. # Uses Otsu thresholding to create a foreground mask, then applies non-local
  177. # means (NLM) filtering slice-by-slice (h=0.1, relative mode) to reduce
  178. # noise while preserving edges. Echo time files are copied through unchanged.
  179. # Output: native.denoise/{adc,t2}.nii.gz, native.denoise/{adc,t2}.txt
  180. if [ ! -e native.denoise ]; then
  181. tmp=native.denoise.tmp.${RANDOM}
  182. mkdir -p ${tmp}
  183. for p in adc t2; do
  184. runit bash ${workflow}/SpanAuxDenoise.sh \
  185. native.import/${p}.nii.gz ${tmp}/${p}.nii.gz
  186. done
  187. runit cp native.import/t2.txt ${tmp}
  188. runit cp native.import/adc.txt ${tmp}
  189. mv ${tmp} native.denoise
  190. fi
  191. # Stage 5: Fit exponential decay model to multi-echo data.
  192. # For each modality (ADC, T2), fits S(TE) = alpha * exp(-beta * TE) where:
  193. # alpha (base) = signal amplitude at TE=0
  194. # beta (rate) = decay rate (related to tissue relaxation/diffusion)
  195. # rmse = root mean square fitting error
  196. # snr = signal-to-noise ratio of the fit
  197. # The --skipFirstThresh 7 parameter skips the first echo if its intensity
  198. # exceeds 7x the second echo, which handles T2* contamination artifacts.
  199. # Also computes the mean across echoes (with N4 bias field correction)
  200. # and a foreground mask with QA report for each modality.
  201. # Output: native.fit/{adc,t2}_{base,rate,rmse,snr,mean,mask}.nii.gz
  202. if [ ! -e native.fit ]; then
  203. tmp=native.fit.tmp.${RANDOM}
  204. mkdir -p ${tmp}
  205. for m in adc t2; do
  206. runit ${qitcmd} VolumeExpDecayFit \
  207. --skipFirstThresh 7 \
  208. --input native.denoise/${m}.nii.gz \
  209. --varying native.denoise/${m}.txt \
  210. --outputAlpha ${tmp}/${m}_base.nii.gz \
  211. --outputBeta ${tmp}/${m}_rate.nii.gz \
  212. --outputError ${tmp}/${m}_rmse.nii.gz \
  213. --outputSnr ${tmp}/${m}_snr.nii.gz
  214. runit ${qitcmd} VolumeReduce \
  215. --method Mean \
  216. --input native.denoise/${m}.nii.gz \
  217. --output ${tmp}/${m}_mean.nii.gz
  218. for p in mean; do
  219. runit N4BiasFieldCorrection \
  220. -i ${tmp}/${m}_${p}.nii.gz \
  221. -w ${tmp}/${m}_${p}.nii.gz \
  222. -o ${tmp}/${m}_${p}.nii.gz
  223. done
  224. runit ${qitcmd} VolumeSegmentForeground \
  225. --input native.denoise/${m}.nii.gz \
  226. --output ${tmp}/${m}_mask.nii.gz \
  227. --report ${tmp}/${m}_report.csv
  228. done
  229. mv ${tmp} native.fit
  230. fi
  231. # Stage 6: Brain extraction (skull stripping).
  232. # Uses species-specific strategies:
  233. # Mouse: Tri-planar 2D U-Net deep learning model that fuses T2 and ADC
  234. # parameter maps (4 channels: t2_base, t2_rate, adc_base, adc_rate)
  235. # Rat: Rule-based morphological pipeline on ADC baseline image (foreground
  236. # detection → contrast enhancement → gradient edges → graph
  237. # segmentation → morphological cleanup → MRF-EM refinement)
  238. # Output: native.mask/brain.mask.nii.gz
  239. if [ ! -e native.mask/brain.mask.nii.gz ]; then
  240. tmp=native.mask.tmp.${RANDOM}
  241. mkdir -p ${tmp}
  242. # We only have a deep learning brain extractor for mice
  243. if [ ${species} == "mouse" ]; then
  244. runit bash ${workflow}/SpanAuxSegmentBrainLearn.sh \
  245. native.fit ${tmp}/brain.mask.nii.gz
  246. else
  247. runit bash ${workflow}/SpanAuxSegmentBrainRule.sh \
  248. native.fit ${tmp}/brain.mask.nii.gz
  249. fi
  250. mv ${tmp} native.mask
  251. fi
  252. # Stage 7: Statistical harmonization of fitted parameter maps.
  253. # Normalizes each parameter map (adc_base, adc_rate, t2_base, t2_rate) to
  254. # have zero mean and unit variance within the brain mask. This reduces
  255. # inter-site and inter-scanner variability in the quantitative maps.
  256. # Output: native.harm/{adc,t2}_{base,rate}.nii.gz
  257. if [ ! -e native.harm ]; then
  258. tmp=native.harm.tmp.${RANDOM}
  259. mkdir -p ${tmp}
  260. for p in {adc,t2}_{base,rate}; do
  261. runit ${qitcmd} VolumeHarmonize \
  262. --input native.fit/${p}.nii.gz \
  263. --inputStatMask native.mask/brain.mask.nii.gz \
  264. --output ${tmp}/${p}.nii.gz
  265. done
  266. mv ${tmp} native.harm
  267. fi
  268. # Stage 8: Register native-space brain to species-specific atlas.
  269. # Extracts the brain-masked harmonized T2 rate map as the registration
  270. # target, then performs rigid registration to the atlas brain template
  271. # using ANTs. The rigid transform preserves brain shape while aligning
  272. # orientation and position.
  273. # Output: native.reg/xfm.txt (affine transform matrix)
  274. if [ ! -e native.reg ]; then
  275. tmp=native.reg.tmp.${RANDOM}
  276. mkdir -p ${tmp}
  277. echo "extracting registration target"
  278. runit ${qitcmd} VolumeMask \
  279. --input native.harm/t2_rate.nii.gz \
  280. --mask native.mask/brain.mask.nii.gz \
  281. --output ${tmp}/native.nii.gz
  282. echo "performing registration"
  283. runit ${qitcmd} VolumeRegisterLinearAnts \
  284. --rigid \
  285. --input ${tmp}/native.nii.gz \
  286. --ref ${data}/${species}/brain.nii.gz \
  287. --output ${tmp}/work
  288. mv ${tmp}/work/* ${tmp}
  289. rm -rf ${tmp}/work
  290. mv ${tmp} native.reg
  291. fi
  292. # Stage 9: Transform fitted and harmonized parameter maps to standard atlas space.
  293. # Applies the rigid transform from registration to warp each parameter map
  294. # (t2_base, t2_rate, adc_base, adc_rate) into the atlas coordinate system.
  295. # Output: standard.fit/{t2,adc}_{base,rate}.nii.gz, standard.harm/{t2,adc}_{base,rate}.nii.gz
  296. for p in fit harm; do
  297. if [ ! -e standard.${p} ]; then
  298. tmp=standard.${p}.tmp.${RANDOM}
  299. mkdir -p ${tmp}
  300. for m in {t2,adc}_{base,rate}; do
  301. runit ${qitcmd} VolumeTransform \
  302. --input native.${p}/${m}.nii.gz \
  303. --affine native.reg/xfm.txt \
  304. --reference ${data}/${species}/brain.nii.gz \
  305. --output ${tmp}/${m}.nii.gz
  306. done
  307. mv ${tmp} standard.${p}
  308. fi
  309. done
  310. # Stage 10: Transform brain mask to standard atlas space.
  311. # Warps the native brain mask using the registration transform, applies
  312. # a mode filter to clean up interpolation artifacts, then intersects with
  313. # the atlas restriction mask to remove any regions outside the expected
  314. # brain boundary.
  315. # Output: standard.mask/brain.mask.nii.gz
  316. if [ ! -e standard.mask ]; then
  317. tmp=standard.mask.tmp.${RANDOM}
  318. mkdir -p ${tmp}
  319. runit ${qitcmd} MaskTransform \
  320. --input native.mask/brain.mask.nii.gz \
  321. --affine native.reg/xfm.txt \
  322. --reference ${data}/${species}/brain.nii.gz \
  323. --output ${tmp}/raw.mask.nii.gz
  324. runit ${qitcmd} MaskFilterMode \
  325. --input ${tmp}/raw.mask.nii.gz \
  326. --output ${tmp}/filter.mask.nii.gz
  327. runit ${qitcmd} MaskIntersection \
  328. --left ${tmp}/filter.mask.nii.gz \
  329. --right ${data}/${species}/restrict.mask.nii.gz \
  330. --output ${tmp}/brain.mask.nii.gz
  331. mv ${tmp} standard.mask
  332. fi
  333. # Stage 11: Segment lesion and CSF in standard atlas space.
  334. # Uses multi-modal sigmoid thresholding on harmonized T2 rate, ADC rate,
  335. # and ADC base maps to estimate lesion probability. Applies a two-threshold
  336. # seed-and-grow strategy (high threshold → morphological cleanup → dilate →
  337. # low threshold) for robust lesion delineation. CSF is segmented separately.
  338. # Results are intersected with the species-specific lesion prior mask.
  339. # Output: standard.seg/{lesion,tissue,csf}.mask.nii.gz, standard.seg/rois.nii.gz
  340. if [ ! -e standard.seg ]; then
  341. runit bash ${workflow}/SpanAuxSegmentLesion.sh \
  342. --input standard.harm \
  343. --mask standard.mask/brain.mask.nii.gz \
  344. --prior ${data}/${species}/lesion.mask.nii.gz \
  345. --output standard.seg
  346. fi
  347. # Stage 12: Compute midline shift metrics.
  348. # Identifies the centroid of CSF in the midline region, then measures
  349. # the displacement from the anatomical center. Computes shift in mm,
  350. # as a percentage of brain width, and laterality indices for tissue
  351. # and brain volumes. Splits the brain into hemispheres.
  352. # Output: standard.midline/map.csv, standard.midline/{brain,tissue}.hemis.mask.nii.gz
  353. if [ ! -e standard.midline ]; then
  354. runit ${qitcmd} ${workflow}/SpanAuxMidline.py \
  355. standard.mask/brain.mask.nii.gz \
  356. standard.seg/tissue.mask.nii.gz \
  357. standard.seg/csf.mask.nii.gz \
  358. ${data}/${species} \
  359. standard.midline
  360. fi
  361. # Stage 13: Create anatomical label volumes by combining tissue classes,
  362. # hemispheres, and atlas regions. Produces combinatorial label volumes:
  363. # classes — tissue(1), csf(2), lesion(3)
  364. # hemis — left(1), right(2) hemispheres
  365. # hemis_classes — hemisphere × tissue class
  366. # classes_regions — tissue class × anatomical region (cortex, striatum, etc.)
  367. # hemis_classes_regions — hemisphere × tissue class × region
  368. # Output: standard.label/{classes,hemis,hemis_classes,...}.nii.gz and .csv
  369. if [ ! -e standard.label ]; then
  370. tmp=standard.label.tmp.${RANDOM}
  371. mkdir -p ${tmp}
  372. runit cp standard.seg/rois.nii.gz ${tmp}/classes.nii.gz
  373. runit cp standard.seg/rois.csv ${tmp}/classes.csv
  374. runit cp standard.midline/brain.hemis.mask.nii.gz ${tmp}/hemis.nii.gz
  375. runit cp ${data}/${species}/hemis.csv ${tmp}/hemis.csv
  376. runit ${qitcmd} MaskProduct\
  377. --left ${data}/${species}/regions.nii.gz \
  378. --right ${tmp}/classes.nii.gz \
  379. --output ${tmp}/classes_regions.nii.gz
  380. runit ${qitcmd} MaskProduct\
  381. --left ${tmp}/hemis.nii.gz \
  382. --right ${tmp}/classes_regions.nii.gz \
  383. --output ${tmp}/hemis_classes_regions.nii.gz
  384. runit ${qitcmd} MaskProduct\
  385. --left ${tmp}/hemis.nii.gz \
  386. --right ${tmp}/classes.nii.gz \
  387. --output ${tmp}/hemis_classes.nii.gz
  388. mv ${tmp} standard.label
  389. fi
  390. # Stage 14: Compute quantitative metric tables.
  391. # Copies QA reports (SNR) from native fitting, midline shift metrics, and
  392. # computes regional statistics: mean/std of each parameter map within each
  393. # label combination (hemisphere × tissue class × region). Also computes
  394. # volumetric measurements for each label combination.
  395. # Output: standard.map/{midline,adc_qa,t2_qa,volumetrics_by_*,...}.csv
  396. if [ ! -e standard.map ]; then
  397. tmp=standard.map.tmp.${RANDOM}
  398. mkdir -p ${tmp}
  399. for f in adc t2; do
  400. cp native.fit/${f}_report.csv ${tmp}/${f}_qa.csv
  401. done
  402. cp standard.midline/map.csv ${tmp}/midline.csv
  403. for label in classes hemis_classes; do
  404. runit ${qitcmd} MaskRegionsMeasure \
  405. --basic \
  406. --regions standard.label/${label}.nii.gz \
  407. --lookup standard.label/${label}.csv \
  408. --volume ${label}_adc_rate=standard.fit/adc_rate.nii.gz \
  409. ${label}_t2_rate=standard.fit/t2_rate.nii.gz \
  410. ${label}_adc_base=standard.fit/adc_base.nii.gz \
  411. ${label}_t2_base=standard.fit/t2_base.nii.gz \
  412. ${label}_adc_rate_harm=standard.harm/adc_rate.nii.gz \
  413. ${label}_t2_rate_harm=standard.harm/t2_rate.nii.gz \
  414. ${label}_adc_base_harm=standard.harm/adc_base.nii.gz \
  415. ${label}_t2_base_harm=standard.harm/t2_base.nii.gz \
  416. --mask standard.mask/brain.mask.nii.gz \
  417. --output ${tmp}
  418. done
  419. for n in classes hemis hemis_classes classes_regions hemis_classes_regions; do
  420. runit ${qitcmd} MaskMeasure \
  421. --input standard.label/${n}.nii.gz \
  422. --lookup standard.label/${n}.csv \
  423. --output ${tmp}/volumetrics_by_${n}.csv
  424. done
  425. mv ${tmp} standard.map
  426. fi
  427. # Helper function for generating label overlay visualizations.
  428. # Renders a label mask on top of a background parameter map using pastel
  429. # colors, then creates a coronal mosaic image (every other slice) as a PNG.
  430. # Args: $1=background volume, $2=param name, $3=label name, $4=output dir
  431. function visit
  432. {
  433. runit ${qitcmd} VolumeRender \
  434. --bghigh 3.0 \
  435. --alpha 1.0 \
  436. --discrete pastel \
  437. --background ${1} \
  438. --labels ${4}/${3}.nii.gz \
  439. --output ${4}/${2}_${3}.nii.gz
  440. runit ${qitcmd} VolumeMosaic \
  441. --crop :,start:2:end,: \
  442. --rgb --axis j \
  443. --input ${4}/${2}_${3}.nii.gz \
  444. --output ${4}/${2}_${3}.png
  445. rm ${4}/${2}_${3}.nii.gz
  446. }
  447. # Stage 15: Generate mosaic visualizations.
  448. # Creates edge-outlined versions of brain, lesion, CSF, ROI, and hemisphere
  449. # labels (MaskShell), then overlays each on the harmonized ADC and T2 rate
  450. # maps as coronal mosaic PNGs for quality control review.
  451. # Output: standard.vis/{adc,t2}_rate_{anatomy,brain,lesion,csf,rois,hemis}.png
  452. if [ ! -e standard.vis ]; then
  453. tmp=standard.vis.tmp.${RANDOM}
  454. mkdir -p ${tmp}
  455. runit ${qitcmd} MaskShell \
  456. --mode Multi \
  457. --input standard.label/hemis.nii.gz \
  458. --output ${tmp}/hemis.nii.gz
  459. runit ${qitcmd} MaskShell \
  460. --mode Multi \
  461. --input standard.seg/rois.nii.gz \
  462. --output ${tmp}/rois.nii.gz
  463. runit ${qitcmd} MaskShell \
  464. --input standard.seg/lesion.mask.nii.gz \
  465. --output ${tmp}/lesion.nii.gz
  466. runit ${qitcmd} MaskShell \
  467. --input standard.seg/csf.mask.nii.gz \
  468. --output ${tmp}/csf.nii.gz
  469. runit ${qitcmd} MaskShell \
  470. --input standard.mask/brain.mask.nii.gz \
  471. --output ${tmp}/brain.nii.gz
  472. runit ${qitcmd} MaskSet --clear \
  473. --input ${tmp}/brain.nii.gz \
  474. --output ${tmp}/anatomy.nii.gz
  475. for labels in anatomy brain lesion csf rois hemis; do
  476. for param in {adc,t2}_rate; do
  477. visit standard.harm/${param}.nii.gz ${param} ${labels} ${tmp}
  478. done
  479. done
  480. rm ${tmp}/*.nii.gz
  481. mv ${tmp} standard.vis
  482. fi
  483. echo "finished"
  484. ################################################################################
  485. # END
  486. ################################################################################

SpanMainRun.sh at commit 9b425a0, under other · at the source

Overview

Authors: Kirsten M Lynch1, Ryan P Cabeen1, Andreia Lopes de Morais2, Xuyan Jin2, Erendiz Tarakci1, Jessica Lamb3, Basavaraju G Sanganahalli4, Jelena M Mihailovic4, Yamileck Olivas-Garcia5, David B Berry6, Marcio A Diniz7, Joseph Mandeville2, Fahmeed Hyder4,8, Daniel R Thedens9, Ali Arbab10,11, Shuning Huang12, Adnan Bibic13,14, Wyatt Austin15, Bingren Hu6, Mohammad B Khan16, Pradip K Kamat16, Arthur W Toga1, Patrick Lyden3,17, Cenk Ayata2,18
18 affiliations
  1. Laboratory of Neuro Imaging, USC Mark and Mary Stevens Institute for Neuroimaging and Informatics, Keck School of Medicine of USC, University of Southern California, Los Angeles, CA, United States
  2. Department of Radiology, Massachusetts General Hospital, Harvard Medical School, Charlestown, MA, United States
  3. Department of Physiology and Neuroscience, Zilkha Neurogenetic Institute of the Keck School of Medicine of USC, Los Angeles, CA, United States
  4. Department of Radiology and Biomedical Imaging, Yale University, New Haven, CT, United States
  5. Department of Emergency Medicine, University of California, San Diego, La Jolla, CA, United States
  6. Department of Orthopaedic Surgery, University of California, San Diego, La Jolla, CA, United States
  7. Icahn School of Medicine at Mount Sinai, New York, NY, United States
  8. Department of Biomedical Engineering, Yale University, New Haven, CT, United States
  9. Department of Radiology, University of Iowa, Iowa City, IA, United States
  10. Department of Biochemistry and Molecular Biology, Medical College of Georgia at Augusta University, Augusta, GA, United States
  11. Georgia Cancer Center, Augusta University, Augusta, CA, United States
  12. Department of Diagnostic and Interventional Imaging, The University of Texas McGovern Medical School at Houston, Houston, TX, United States
  13. F.M. Kirby Research Center for Functional Brain Imaging, Kennedy Krieger Research Institute, Baltimore, MD, United States
  14. Russell H. Morgan Department of Radiology and Radiological Science, Johns Hopkins University School of Medicine, Baltimore, MD, United States
  15. Department of Radiology, Duke University Medical Center, Durham, NC, United States
  16. Department of Neurology, Medical College of Georgia at Augusta University, Augusta, GA, United States
  17. Department of Neurology, Keck School of Medicine of USC, Los Angeles, CA, United States
  18. Department of Neurology, Massachusetts General Hospital, Harvard Medical School, Charlestown, MA, United States
Institutions: University of Southern California (United States); Harvard University (United States); Massachusetts General Hospital (United States); Yale University (United States); University of California San Diego (United States); Icahn School of Medicine at Mount Sinai (United States); University of Iowa (United States); Augusta University (United States); Kennedy Krieger Institute (United States); Johns Hopkins University (United States); Johns Hopkins Medicine (United States); Duke Medical Center (United States); Keck Hospital of USC (United States)
Journal: Imaging neuroscience (Cambridge, Mass.), volume 4, article IMAG.a.1328
Dates: received 8 January 2026; accepted 18 June 2026; published online 7 August 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1162/imag.a.1328 · PMID 42577804 · PMCID PMC13455521 · OpenAlex W7168388168
Open access: diamond, a free copy (OpenAlex)
Status: code verified
Categories: structural MRI / diffusion (modality), stroke (population)
Methods: Connectivity, Statistics, Machine learning, fMRI & imaging
Keywords: ischemic stroke, preclinical trial, image analysis pipeline, lesion segmentation, rodent MRI, harmonization, deep learning, skull stripping
Topic: Acute Ischemic Stroke Management (Epidemiology, Medicine), according to OpenAlex
Funding: NINDS NIH HHS (R01 NS105894, U01 NS113356, R01 NS117565, U01 NS113388, U01 NS113451, R01 NS099455, R01 NS109910, R01 NS112511, R01 NS110378, U01 NS113444, U24 NS113452, R01 NS102583, U24 NS107247, U01 NS113443, U01 NS113445); NHLBI NIH HHS (R35 HL139926); NIBIB NIH HHS (P41 EB015922); NIH HHS (S10 OD032343, S10 OD032285); NCATS NIH HHS (UL1 TR001881)
Citations: not cited yet (Europe PMC); 38 references in the paper

Abstract

The failure to translate promising preclinical stroke therapies into clinical success is a multi-faceted problem; however, a critical contributing factor is the lack of rigorous, reproducible preclinical outcome measures. While magnetic resonance imaging (MRI) offers a translational alternative to traditional histology, its use in large, multi-site trials is challenged by data heterogeneity and the need for scalable analysis. To address this, we developed and validated a fully automated, open-source image analysis pipeline for the Stroke Preclinical Assessment Network (SPAN), a six-center preclinical trial network. The pipeline processed T2-weighted and apparent diffusion coefficient (ADC) maps from over 2,000 mice and rats, incorporating steps for cross-site data harmonization, deep learning-based brain extraction, and rule-based segmentation to quantify infarct volume, brain swelling, and atrophy. The pipeline demonstrated high accuracy, as automated lesion volumes strongly correlated with manual expert tracing on both MRI (R = 0.96) and 2,3,5-triphenyl-tetrazolium chloride (TTC)-stained tissue (R = 0.86). The U-net model for brain extraction achieved a Dice score of 0.96, and our harmonization method successfully reduced inter-site variability in quantitative MRI parameters. This robust and reproducible pipeline provides a scalable framework for standardizing tissue outcome assessment, enhancing the rigor of multi-site preclinical studies.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repository

Its files are read in the Code ↔ Paper reader above, with 13 matches between paragraphs and lines of code.

cabeen/span-mri

License: other
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: 9b425a07a28a908162fc89de1b1ccd134abf5963, 18 September 2026
Languages: Shell (30), Python (5)
Size: 180 files, 35 scripts
Software Heritage: archived
Found in: “Data and Code Availability”
Holds: README, license file, environment (docker-compose.yml, Dockerfile), tests
Not found: CITATION.cff, continuous integration, documentation
Tools: PyTorch (5 files), NiBabel (3 files), NumPy (3 files), SciPy (2 files), dcm2niix (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
37 files

The paper's code and data availability statement is in the Data section.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 35 scripts, each with its path and the digest of its content;
  • 13 matches between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

Datasets cited

Data and Code Availability

MRI data used in the present study are available for download at: https://datadryad.org/stash/dataset/doi:10.5061/dryad.xd2547dpb. The automated MRI processing pipeline used in the present study is publicly available and can be downloaded at: https://github.com/cabeen/span-mri.

Reproduced under the paper's license (CC BY), from the paper cited above.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, pages, dates, 24 authors, 8 keywords, 5 funders, 37 references.

Cite

This paper

Lynch, K. M., Cabeen, R. P., de Morais, A. L., Jin, X., Tarakci, E., Lamb, J., Sanganahalli, B. G., Mihailovic, J. M., Olivas-Garcia, Y., Berry, D. B., Diniz, M. A., Mandeville, J., Hyder, F., Thedens, D. R., Arbab, A., Huang, S., Bibic, A., Austin, W., Hu, B., . . . Ayata, C. (2026). A robust and reproducible automated MRI pipeline for quantifying tissue outcomes after experimental stroke in multi-center preclinical networks. Imaging neuroscience (Cambridge, Mass.), 4, IMAG.a.1328. https://doi.org/10.1162/imag.a.1328

BibTeX

@article{lynch2026robust,
author = {Lynch, Kirsten M and Cabeen, Ryan P and de Morais, Andreia Lopes and Jin, Xuyan and Tarakci, Erendiz and Lamb, Jessica and Sanganahalli, Basavaraju G and Mihailovic, Jelena M and Olivas-Garcia, Yamileck and Berry, David B and Diniz, Marcio A and Mandeville, Joseph and Hyder, Fahmeed and Thedens, Daniel R and Arbab, Ali and Huang, Shuning and Bibic, Adnan and Austin, Wyatt and Hu, Bingren and Khan, Mohammad B and Kamat, Pradip K and Toga, Arthur W and Lyden, Patrick and Ayata, Cenk},
title = {{A robust and reproducible automated MRI pipeline for quantifying tissue outcomes after experimental stroke in multi-center preclinical networks}},
journal = {Imaging neuroscience (Cambridge, Mass.)},
year = {2026},
month = aug,
volume = {4},
pages = {IMAG.a.1328},
publisher = {MIT Press},
issn = {2837-6056},
doi = {10.1162/imag.a.1328},
url = {https://doi.org/10.1162/imag.a.1328},
pmid = {42577804},
pmcid = {PMC13455521}
}

RIS

TY - JOUR
AU - Lynch, Kirsten M
AU - Cabeen, Ryan P
AU - de Morais, Andreia Lopes
AU - Jin, Xuyan
AU - Tarakci, Erendiz
AU - Lamb, Jessica
AU - Sanganahalli, Basavaraju G
AU - Mihailovic, Jelena M
AU - Olivas-Garcia, Yamileck
AU - Berry, David B
AU - Diniz, Marcio A
AU - Mandeville, Joseph
AU - Hyder, Fahmeed
AU - Thedens, Daniel R
AU - Arbab, Ali
AU - Huang, Shuning
AU - Bibic, Adnan
AU - Austin, Wyatt
AU - Hu, Bingren
AU - Khan, Mohammad B
AU - Kamat, Pradip K
AU - Toga, Arthur W
AU - Lyden, Patrick
AU - Ayata, Cenk
TI - A robust and reproducible automated MRI pipeline for quantifying tissue outcomes after experimental stroke in multi-center preclinical networks
T2 - Imaging neuroscience (Cambridge, Mass.)
J2 - Imaging Neurosci (Camb)
PY - 2026
DA - 2026/08/07
VL - 4
SP - IMAG.a.1328
SN - 2837-6056
PB - MIT Press
DO - 10.1162/imag.a.1328
UR - https://doi.org/10.1162/imag.a.1328
LA - en
ER -

CSL-JSON

{
"id": "10.1162/imag.a.1328",
"type": "article-journal",
"title": "A robust and reproducible automated MRI pipeline for quantifying tissue outcomes after experimental stroke in multi-center preclinical networks",
"container-title": "Imaging neuroscience (Cambridge, Mass.)",
"author": [
{
"family": "Lynch",
"given": "Kirsten M"
},
{
"family": "Cabeen",
"given": "Ryan P"
},
{
"family": "de Morais",
"given": "Andreia Lopes"
},
{
"family": "Jin",
"given": "Xuyan"
},
{
"family": "Tarakci",
"given": "Erendiz"
},
{
"family": "Lamb",
"given": "Jessica"
},
{
"family": "Sanganahalli",
"given": "Basavaraju G"
},
{
"family": "Mihailovic",
"given": "Jelena M"
},
{
"family": "Olivas-Garcia",
"given": "Yamileck"
},
{
"family": "Berry",
"given": "David B"
},
{
"family": "Diniz",
"given": "Marcio A"
},
{
"family": "Mandeville",
"given": "Joseph"
},
{
"family": "Hyder",
"given": "Fahmeed"
},
{
"family": "Thedens",
"given": "Daniel R"
},
{
"family": "Arbab",
"given": "Ali"
},
{
"family": "Huang",
"given": "Shuning"
},
{
"family": "Bibic",
"given": "Adnan"
},
{
"family": "Austin",
"given": "Wyatt"
},
{
"family": "Hu",
"given": "Bingren"
},
{
"family": "Khan",
"given": "Mohammad B"
},
{
"family": "Kamat",
"given": "Pradip K"
},
{
"family": "Toga",
"given": "Arthur W"
},
{
"family": "Lyden",
"given": "Patrick"
},
{
"family": "Ayata",
"given": "Cenk"
}
],
"container-title-short": "Imaging Neurosci (Camb)",
"volume": "4",
"page": "IMAG.a.1328",
"DOI": "10.1162/imag.a.1328",
"PMID": "42577804",
"PMCID": "PMC13455521",
"ISSN": "2837-6056",
"publisher": "MIT Press",
"URL": "https://doi.org/10.1162/imag.a.1328",
"language": "en",
"issued": {
"date-parts": [
[
2026,
8,
7
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1038/s41467-026-71918-7 [code]
Developmental disinhibition gates language lateralization in childhood.
Journal: Nature communications
In common: dcm2niix, NiBabel, PyTorch, 2 other tools, 1 reference
[2] doi:10.1038/s41597-026-07184-5 [code]
A Multiple Sclerosis MRI Dataset with Tri-Mask Annotations for Lesion Segmentation.
Journal: Scientific data
In common: dcm2niix, NiBabel, SciPy, 1 other tool, structural MRI / diffusion, 1 reference
[3] doi:10.1016/j.isci.2026.115747 [code]
Realistic PET image synthesis from MRI for automated inference of brain atrophy and Alzheimer's.
Journal: iScience
In common: dcm2niix, NiBabel, PyTorch, 2 other tools, structural MRI / diffusion
[4] doi:10.1162/imag.a.1183 [code]
Learning-based segmentation of diffusion-weighted MR images with arbitrary &lt;i&gt;q&lt;/i&gt;-space samplings.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: NiBabel, PyTorch, SciPy, 1 other tool, structural MRI / diffusion, 2 references
[5] doi:10.3389/fmed.2026.1875760 [code]
Adaptive multi-stage domain unlearning for white-matter lesion segmentation.
Journal: Frontiers in medicine
In common: NiBabel, PyTorch, SciPy, 1 other tool, structural MRI / diffusion, 2 references
[6] doi:10.1002/nbm.70353 [code]
Automated Surface-Based Segmentation of Deep Gray Matter Regions Based on Diffusion Tensor Images Reveals Unique Age Trajectories Over the Healthy Lifespan.
Journal: NMR in biomedicine
In common: dcm2niix, NiBabel, SciPy, 1 other tool, structural MRI / diffusion, 1 reference
[7] doi:10.1016/j.phro.2026.101056 [code]
Toward uncertainty-aware manual delineation of brain tumours using eye-tracking and image-derived features.
Journal: Physics and imaging in radiation oncology
In common: NiBabel, PyTorch, SciPy, 1 other tool, 2 references
[8] doi:10.1038/s41597-026-07248-6 [code]
A large-scale fMRI dataset for vision-language semantic association.
Journal: Scientific data
In common: dcm2niix, NiBabel, PyTorch, 2 other tools
[9] doi:10.1038/s41467-026-71719-y [code]
Brain functional-structural gradient coupling reflects development, behavior and genetic influences.
Journal: Nature communications
In common: dcm2niix, NiBabel, PyTorch, 2 other tools
[10] doi:10.1162/imag.a.1362 [code]
Human fMRI at 11.7T: Assessing feasibility, stability, and reliability on the Iseult scanner.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: dcm2niix, NiBabel, SciPy, 1 other tool, 1 reference

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.