Skip to content

Data for MICCAI #9

Closed
Closed

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.

Activity

  1. mathpluscode commented on Jan 27, 2021

    @mathpluscode
    Member

    @fepegar I guess torchio does not support the symlink for path XD

    EDIT: it was due to a permission issue

  2. fepegar commented on Jan 27, 2021

    @fepegar
    CollaboratorAuthor

    (For reference: it does. It was just a permissions issue)

  3. added 4 commits that reference this issue on Jan 27, 2021
  4. fepegar commented on Jan 28, 2021

    @fepegar
    CollaboratorAuthor

    Please @mathpluscode read carefully the following before submitting anything:

  5. added a commit that references this issue on Feb 21, 2021
  6. added a commit that references this issue on Mar 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions