Generation of B0 fieldmap based on anatomical MRIs of 60 adult subjects. The fieldmaps are generated from the segmented tissues and assignment of susceptibility values.
Pipeline
![Pipeline](https://private-user-images.githubusercontent.com/1421029/383000787-8bf04642-0ab2-460c-8893-5d2d94490a13.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2NTM2NjksIm5iZiI6MTczOTY1MzM2OSwicGF0aCI6Ii8xNDIxMDI5LzM4MzAwMDc4Ny04YmYwNDY0Mi0wYWIyLTQ2MGMtODg5My01ZDJkOTQ0OTBhMTMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMjEwMjQ5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YWM1ZjQ2ZTdkNDY4YjEyZjU0ZWIwMWU0NmZlZGU0NGE5NmVmOGMwZjE2NmFmNmEwM2I3ZDQ4ZWFmZTI2MjhkNSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.YYW3F0SV1kA1ZSr8KnEgc05mKuhtJT2k7DjpJPTJrQY)
3D Render of segmentations
![3D Render of segmentations](https://private-user-images.githubusercontent.com/1421029/383001162-5062eb6c-e2a3-42ad-936e-26f402caa1b8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2NTM2NjksIm5iZiI6MTczOTY1MzM2OSwicGF0aCI6Ii8xNDIxMDI5LzM4MzAwMTE2Mi01MDYyZWI2Yy1lMmEzLTQyYWQtOTM2ZS0yNmY0MDJjYWExYjgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMjEwMjQ5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZDdiNDgzODc3NzZlMzhiZTIyYWQwYzk1NjdkMjVlMzZlZmYwOTM4OTY0YWVmYjc0ZjU3MWE4ZDJiMzg2MTRhYiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.AhTJg-JHd7dGFOJTl_oi1bVFpDusgyWBw3iBPy6z0V0)
Sagittal mosaic of simulated B0 maps
![3D Render of segmentations](https://private-user-images.githubusercontent.com/1421029/383001229-6bd82576-3a10-40bf-b965-64a10b8f53d3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2NTM2NjksIm5iZiI6MTczOTY1MzM2OSwicGF0aCI6Ii8xNDIxMDI5LzM4MzAwMTIyOS02YmQ4MjU3Ni0zYTEwLTQwYmYtYjk2NS02NGExMGI4ZjUzZDMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMjEwMjQ5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MWNjMDgzNjZkNjY2OGI5ZjYzZGJmNmRkOTlmYWZjZGI1ZjUzMmQ1ZDRmODU4NDZjN2VhNTc1YTg5MWY2OTRkZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.tG5f4kykKVm-TW02wmodUbrd9DlYB2_J_JxGAlNhtEQ)
Link to OpenNeuro BIDS dataset to be provided soon.
In a new virtual environment (recommended), install this repository:
git clone https://github.com/shimming-toolbox/b0-fieldmap-realistic-simulation.git
cd b0-fieldmap-realistic-simulation
pip install -e requirements.txt
Install the susceptibility-to-fieldmap project,
git clone https://github.com/shimming-toolbox/susceptibility-to-fieldmap-fft
cd susceptibility-to-fieldmap-fft
git checkout d9f785b082fb145d547ff03ae53f23f1564ccc38
pip install -e .
Install via their website, https://www.slicer.org
Open the application, then navigate to the Python terminal (see Python "snake" logo in the top toolbar) and run:
import slicer
slicer.util.pip_install('click')
Note: for all *.sh script files, you'll need to provide execution permissions,
chmod +xxx $SCRIPT
where $SCRIPT is the *.sh filename for that script.
For convenience, we recommend you set the variable BIDS_DIR
in your shell to the datasets BIDS directory,
BIDS_DIR = /path/to/bids/dir
This way, you can copy-paste the commands below directly.
Step 1: Smooth & merge From within this directory, first generate the script for smoothing using 3D Slicer & merging of the labels:
./b0realsim/step_1_generate_smoothing.sh -b $BIDS_DIR
Output: run_1_smooth.sh
Step 2: Labels to chi Then, generate the script that will, for each subject, map the labels to their chi values.
./b0realsim/step_2_generate_chi.sh -b $BIDS_DIR
]
Output: run_2_compute_chimaps.sh
Step 3: Chi to B0 field map Lastly, generate the script that will, for each subject, simulate the B0 field map using the chi map generated in the previous step.
./b0realsim/step_3_generate_b0.sh -b $BIDS_DIR
Output: run_3_compute_b0maps.sh
Now, provide execute permission (chmod +xxx $SCRIPT
) each pipeline scripts you just generated and then run them in order
./run_1_smooth.sh
- runtime: ~2 hours
./run_2_compute_chimaps.sh
- runtime: ~1 minute
./run_3_compute_b0maps.sh
- runtime: ~30 minutes
Smoothed & merged labels $BIDS_DIR/derivatives/labels/$SUBJECT/anat/
Chi maps $BIDS_DIR/derivatives/$SUBJECT/anat/
B0 maps $BIDS_DIR/derivatives/$SUBJECT/fmap/
python b0realsim/visualization/plot_mosaic.py -b $BIDS_DIR
- runtime ~3 minutes
Output: subject-mosaic.png
To compute the age/weight/height statistics for the subjects,
python b0realsim/stats/subjects.py -b $BIDS_DIR