This repository contains scripts and utilities for processing MR and CT images used with our advanced transcranial ultrasound system, a 256-element array designed for precise deep brain neuromodulation in humans. These tools were written by Bradley Treeby, University College London.
The tools in this repository support a complete workflow for:
- Converting DICOM to NIfTI format
- Registering brain and positioning images to the helmet reference frame
- Processing planning images for transducer targeting
- Real-time replanning between sessions to maintain targeting accuracy
- Segmenting thalamic nuclei using FreeSurfer
- Computing targeting shifts for re-registration
These scripts were developed for and used in the neuromodulation system described in the paper:
Martin, E., Roberts, M., Grigoras, I.F., Wright, O., Nandi, T., Rieger, S.W., Campbell, J., den Boer, T., Cox, B.T., Stagg, C.J. and Treeby, B.E., "Ultrasound system for precise neuromodulation of human deep brain circuits." bioRxiv, https://doi.org/10.1101/2024.06.08.597305, 2024.
If you find these tools useful for your reserach, please consider citing our paper.
-
Bash Scripts: Collection of shell scripts for image processing and registration
convertDicoms.sh- Convert DICOM images to NIfTI formatregisterWithHelmet.sh- Register T1 images with the helmet reference imageregisterWithHelmetSaveAll.sh- Register T1 images with additional outputssegmentThalamus.sh- Extract thalamic nuclei maps using FreeSurfercomputeTargetShift.sh- Calculate shifts in target positionprocessImagesForPlanning.sh- Main workflow script for image processing
-
MATLAB Functions: Support functions for image processing
resliceImageToRAS.m- Reslice and pad NIfTI imagesextractTransducerPosition.m- Generate transformations for k-PlancomputeRigidTransform.m- Compute transformations between coordinate systems
- Setup and Installation - How to install required software and set up scripts
- Image Conversion - Converting DICOM images to NIfTI format
- Processing Planning Images - Detailed workflow for planning
- k-Plan Simulations - Setting up k-Plan simulations
- Real-Time Replanning - Protocol for between-session adjustments
- FSL (FMRIB Software Library)
- FreeSurfer
- 3D Slicer
- MATLAB (for some processing steps)
- dcm2niix (for DICOM conversion)
For complete setup instructions, see the Setup and Installation guide.
A typical workflow involves:
- Converting DICOM images using
convertDicoms.sh - Segmenting thalamic nuclei with
segmentThalamus.sh - Creating a subject-specific script based on
processImagesForPlanningS00X.sh - Running the processing script to generate targeting data
- Using
computeTargetShift.shfor between-session replanning
See Processing Planning Images for detailed instructions.