Skip to content

shimming-toolbox/siemens-fire

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Siemens-FIRE

This repository contains tools, scripts, and instructions for building a chroot disk image of Shimming Toolbox and deploying it on Siemens MARS MRI systems using the Framework for Image REconstruction (FIRE). This approach simplifies advanced shimming protocols by removing the need for an external laptop running Shimming Toolbox. It provides a step-by-step guide to create the image locally with Docker, compress it, and transfer it to a USB drive for installation on the scanner hardware. The repository also includes guidelines for testing Python modules both locally and directly on the MARS system.

Many of the scripts are adapted from Kelvin Chow's python-ismrmrd-server repository. Please refer to that repository’s documentation for additional details.


Table of Contents


1. Creating a chroot disk image for Shimming Toolbox

This guide walks you through creating on your computer a disk image (.img) containing a complete Linux filesystem intended to be used as the root directory for a changed root (chroot) environment. The resulting image can be exported and deployed on MARS system hardware to run Shimming Toolbox locally on the MRI scanner.

1.1 Prerequisites

Before starting, ensure you have:

  • Docker: Installed and running on your system
  • Disk space: Between 30-35GB free disk space for the build process
  • USB drive: At least 8GB capacity for image transfer
  • Time: Allow 30-40 minutes for the complete process
  • Permissions: Root/sudo access may be required for some operations

1.2 Overview

The process consists of three main steps:

  1. Build a Docker image containing Shimming Toolbox
  2. Export the container filesystem and create a chroot-compatible disk image
  3. Compress and transfer the image to a USB drive for deployment

1.3 Step 1 - Clone and navigate to the repository

git clone https://github.com/shimming-toolbox/siemens-fire.git <path/to/repository>
cd <path/to/repository>

1.4 Step 2 - Create the chroot image

Make the build scripts executable and run the image creation process. On macOS:

chmod +x docker/docker_to_chroot.sh
chmod +x docker/docker_tar_to_chroot.sh
./docker/docker_to_chroot.sh st_chroot

On Windows:

docker\docker_to_chroot.bat st_chroot

What happens during this step:

  1. Docker build: Creates a Docker image containing Shimming Toolbox and its dependencies
  2. Container export: Exports the container's filesystem to a tarball
  3. Image creation: Converts the tarball to a Linux root filesystem (.img)

Note

Expected duration: 14 minutes Output files: st_chroot.img and st_chroot.zip

1.5 Step 3 - Export the chroot image to your USB key

After successful verification, clean up local files:

rm st_chroot.zip
rm st_chroot.img

1.7 Next Steps

After completing this process:

  1. Safely eject the USB drive
  2. Transport to the MRI scanner system
  3. Follow the deployment instructions for mounting the chroot environment on the MARS hardware

2. Python modules

To perform shimming with Shimmin Toolbox on the scanner, different python modules are linked to each acquisition :

  1. Localizer : No python module
  2. MP-RAGE : Creation of the masked ROI with st_masking.py
  3. GRE : Creation of the fieldmap with st_fieldmapping.py
  4. Dummy EPI : Compute the currents with st_optimizing.py
  5. Shimmed EPI : Shim with st_shimming.py

Each of these python modules take the raw data from the acquisition, converts it to a NIfTI file, runs the appropriate Shimming Toolbox command, then converts it back to raw data that is sent back to the scanner. Before an acquisition, to change de parameters of a python module, please update the corresponding JSON sidecar (e.g. st_shimming.json for st_shimming.py).


3. Testing a python module locally

This guide describes how to build, launch, and interact with a Docker image for processing .h5 datasets on your computer using a Siemens-fire server and client CLI.

  1. Navigate to the siemens-fire directory
cd <path/to/repository>
  1. Build the Docker image
docker build --platform linux/amd64 -t test_st .
  1. Start the server on a new terminal window
docker run -p=9002:9002 --rm -it -v /tmp:/tmp test_st 

Note

The server can be stopped any time using control + c

  1. Start an interactive Bash CLI on a new terminal window
docker run --rm -it -v /tmp:/tmp test_st /bin/bash

Note

The interactive CLI can be stopped by typing exit

  1. Ensure you have test .h5 data files in your computer's /tmp directory
  2. In the interactive CLI, launch the client
python3 /opt/code/python-ismrmrd-server/client.py -a host.docker.internal -c <module> -p 9002 -G "dataset" -o <path/to/output> <path/to/input>

For more details, please consult Kelvin Chow's documentation on this subject.


4. Testing a python module on MARS system hardware

Note

TODO

About

Code for running Shimming Toolbox using FIRE on Siemens MRI scanners

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors