Skip to content

Data for MICCAI #9

@fepegar

Description

@fepegar

The data is in /home/fernando/datasets/deepreg.
You will find there four directories:

  1. matrices: affine matrices (.txt, 12 DOF) from native space to MNI
  2. mri: images already in MNI space
  3. gif_parcellation: GIF parcellations in native space
  4. 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:

import torchio as tio

matrix_path, parcellation_path, mri_mni_path = _ # of a subject
mri_mni_skull_stripped_path = _
parcellation_mni_path = _

# Resample parcellation to MNI
matrix = 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 mask
SMALLEST_BRAIN_LABEL = 24  # from colour table
extract_brain = tio.Lambda(lambda x: (x >= SMALLEST_BRAIN_LABEL))
brain_mask = extract_brain(parcellation_mni)

# Skull-stripping
def skull_strip(image, mask):
    image.data[~mask.data.bool()] = 0

mri = 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions