Skip to content

Registering lesions in template space

dorianps edited this page Nov 23, 2017 · 29 revisions

The information of this page and a registration example is presented in a youtube video.


Lesion registration is a two step process.

  1. First, you need to register the anatomical image of the patient onto a template. The anatomical image is the image you acquired from the scanner (T1 or CT), not the lesion map you drew. The registration deforms the brain of the patient to make sure the gyri match the gyri of the template. Since your patient has a lesion, this is a problem, because the registration will try to pull the remaining healthy tissue to fill the lesioned area to match as much as possible the template. To avoid this, the lesioned area of the patient's brain is excluded from the registration. This means that the remaining areas will register very well onto the template, while the lesioned area will simply be ignored, because there is nothing to match there. The special registration mask is typically obtained by subtracting the lesion map from the brain mask, leaving a binary map that resembles the brain with an empty area at the lesion site.
  2. In the second step, the deformation fields obtained from the above registration are applied to the lesion map itself, and the lesion map is brought in template space. A small but important note, this transformation should use a nearest neighbor interpolation instead of other linear interpolations. This assures that an old lesioned voxel (value 1) that falls in between two new voxels (value 0 and 1) will not split its values to have something in between (i.e., value 0.5) but will keep it's original value (value 1).

Since version 0.0.0.9004, LESYMAP does all the above for you in a new function called registerLesionToTemplate. You can specify your own template, but you don't need to. By default, LESYMAP will use the integrated MNI152 ICBM 2009c template. We have checked the quality of this template and added an additional no-face mask to enhance the quality of some processing steps.

How do I run registerLesionToTemplate?

All you need is the filenames of the anatomical and lesion images for a single subject. Here is an example:

anatomical = '/mnt/c/User/dp/Desktop/Subject1_anat.nii.gz'
lesion = '/mnt/c/User/dp/Desktop/Subject1_les.nii.gz'
lesyreg = registerLesionToTemplate(anatomical, lesion, outprefix = '/mnt/c/User/dp/Desktop/Subj1onTemplate_')

18:36:04 Template undefined, using provided MNI152_2009c
     /home/dp/R/x86_64-pc-linux-gnu-library/3.2/LESYMAP/extdata/template/other_templates/MNI152_2009c
18:36:04 Loading subject's anatomical...
18:36:04 Loading subject's lesion file...
18:36:04 Assuring lesion and antomical are in the same space...
18:36:04 Running bias correction on anatomical...
18:36:27 Denoising the anatomical...
18:36:37 Skull-stripping subject's image...
18:50:22 Running template registration (expect >1 hour) ...
19:56:54 Applying registration to lesion image...
19:56:55 Lesion size native: 53.21 ml
19:56:56 Lesion size template: 55.8 ml
19:56:56 Done! 1.3 hours

If you don't specify a template, the provided MNI template will be used (MNI152 ICBM 2009c).

For more detailed documentation type:

?registerLesionToTemplate

What does registerLesionToTemplate do?

Whether you use your own template or the one provided in LESYMAP, the steps are the same:

  1. Assure the anatomical and lesion images are in same space/orientation/resolution/etc.
  2. Binarize the lesion mask to 0/1 values (in case your mask has values of 255).
  3. Truncate outlier intensities, bias correct, and denoise, the anatomical image.
  4. (optional and recommended) Skull stripping to keep a brain-only anatomical.
  5. Compute the registration mask in subject space, and remove the lesion area.
  6. Register the anatomical to the template anatomical.
  7. Use the transformation matrices to bring the lesion in template space.

These steps have specific parameters, but their explanation would take too long. The parameters may also change in future LESYMAP versions. The current function code is here.

Quality inspection

Image registration is not a magic process that works in every situation. Things may go wrong, and, unless you check the data, you cannot be sure that it worked. The best way to check whether the registration worked is to open the template and overlay the subject's image in template space. You should see that most of the gyri are well matched between the two images. The ventricles should be as similar as possible. You can also overlay the lesion in template space to make sure it's neither out of the brain nor bleeding into the ventricles. Data quality inspection is one of the most important steps of any study, and is the only way to be sure that results are not contaminated by image processing errors. Even respectable imaging software might give wrong results, it's up to you to seal the quality of the study.