The data is in /home/fernando/datasets/deepreg.
You will find there four directories:
matrices: affine matrices (.txt, 12 DOF) from native space to MNImri: images already in MNI spacegif_parcellation: GIF parcellations in native spacereference: 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.
The data is in
/home/fernando/datasets/deepreg.You will find there four directories:
matrices: affine matrices (.txt, 12 DOF) from native space to MNImri: images already in MNI spacegif_parcellation: GIF parcellations in native spacereference: 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:
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.