Package that provides tools for brain MRI Deep Learning pre-processing.
Note
Go to the end to download the full example code.
mriqc quality control use caseΒΆ
Credit: A Grigis
Example on how to run the mriqc quality control using the brainprep Singularity container.
# sphinx_gallery_thumbnail_path = '_static/carousel/mriqc.png'
import os
import subprocess
from brainrise.datasets import MRIToyDataset
Please tune these parameters.
DATADIR = "/tmp/brainprep-data"
OUTDIR = "/tmp/brainprep-out"
WORKDIR = "/tmp/brainprep-out/work"
HOMEDIR = "/tmp/brainprep-home"
SCRIPT = "mriqc"
SIMG = "/volatile/nsap/brainprep/mriqc/brainprep-mriqc-latest.simg"
for path in (DATADIR, OUTDIR, HOMEDIR, WORKDIR):
if not os.path.isdir(path):
os.mkdir(path)
dataset = MRIToyDataset(root=DATADIR)
cmd = ["singularity", "run", "--bind", "{0}:/data".format(DATADIR),
"--bind", "{0}:/out".format(OUTDIR), "--home", HOMEDIR, "--cleanenv",
SIMG,
"brainprep", SCRIPT,
"/data",
"sub-unknown",
"--outdir", "/out",
"--workdir", "/out/work"]
Downloading https://raw.github.com/muschellij2/open_ms_data/master/cross_sectional/coregistered_resampled/patient01/T1W.nii.gz.
Downloading https://raw.github.com/muschellij2/open_ms_data/master/cross_sectional/coregistered_resampled/patient01/T2W.nii.gz.
Downloading https://raw.github.com/muschellij2/open_ms_data/master/cross_sectional/coregistered_resampled/patient01/FLAIR.nii.gz.
Downloading https://raw.github.com/muschellij2/open_ms_data/master/cross_sectional/coregistered_resampled/patient01/consensus_gt.nii.gz.
Downloading https://raw.github.com/muschellij2/open_ms_data/master/cross_sectional/coregistered_resampled/patient01/brainmask.nii.gz.
You can now execute this command.
print(" ".join(cmd))
singularity run --bind /tmp/brainprep-data:/data --bind /tmp/brainprep-out:/out --home /tmp/brainprep-home --cleanenv /volatile/nsap/brainprep/mriqc/brainprep-mriqc-latest.simg brainprep mriqc /data sub-unknown --outdir /out --workdir /out/work
Total running time of the script: (0 minutes 5.147 seconds)
Estimated memory usage: 697 MB
Follow us