You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The data is in /home/fernando/datasets/deepreg.
You will find there four directories:
matrices: affine matrices (.txt, 12 DOF) from native space to MNI
mri: images already in MNI space
gif_parcellation: GIF parcellations in native space
reference: MNI-ICBM-152 template and corresponding GIF parcellation. The MRI needs to be skull-stripped using the parcellation.
You can visualise parcellations on 3D Slicer or NifTK using this colour table.
I suggest using TorchIO for all that needs to be done. Here's some code that might help:
importtorchioastiomatrix_path, parcellation_path, mri_mni_path=_# of a subjectmri_mni_skull_stripped_path=_parcellation_mni_path=_# Resample parcellation to MNImatrix=tio.io.read_matrix(matrix_path)
parcellation=tio.LabelMap(parcellation_path, to_mni=matrix)
resample=tio.Resample(mri_mni_path, pre_affine_name='to_mni')
parcellation_mni=resample(parcellation)
parcellation_mni.save(parcellation_mni_path)
# Get brain maskSMALLEST_BRAIN_LABEL=24# from colour tableextract_brain=tio.Lambda(lambdax: (x>=SMALLEST_BRAIN_LABEL))
brain_mask=extract_brain(parcellation_mni)
# Skull-strippingdefskull_strip(image, mask):
image.data[~mask.data.bool()] =0mri=tio.ScalarImage(mri_mni_path)
skull_strip(mri, brain_mask)
mri.save(mri_mni_skull_stripped_path)
You can use similar code to perform skull-stripping on the template.
If you want to use the same brain structures for evaluation, you'll need to find a mapping between FreeSurfer labels and the corresponding labels from the colour table I shared above.
Activity
mathpluscode commentedon Jan 27, 2021
@fepegar I guess torchio does not support the symlink for path XDEDIT: it was due to a permission issue
fepegar commentedon Jan 27, 2021
(For reference: it does. It was just a permissions issue)
Issue #9: add pre-commit configs
Issue #9: add preprocess script
Issue #9: create dirs and use tqdm
Issue #9: add known length for tqdm
fepegar commentedon Jan 28, 2021
Please @mathpluscode read carefully the following before submitting anything:
Issue #9: add script for vm
Issue #9: fix bug