Module 2

Purpose: Register Post-implant CT to pre-Implant MRI scan

Description

In this module, each subject’s CT and MRI images will be linearly aligned (co-registered). Electrode coordinates will be transformed from their native CT into MRI space.

  • Input Files:
    • Pre-implant MRI: anat/sub-xxxx_ses-yy_acq-3D_space-T00mri_T1w.nii.gz

    • Post-implant CT: ct/sub-xxxx_ses-yy_acq-3D_space-T01ct_ct.nii.gz

    • Electrode coordinates in CT space: ieeg/sub-xxxx_ses-yy_space-T01ct_ desc-vox_electrodes.txt

  • Output Files (in sub-xxx/derivatives/ieeg_recon/module2/):
    • Quality Report:
      • sub-xxxx_ses-yy_report.html

      • sub-xxxx_ses-yy_itksnap_workspace.itksnap

      • sub-xxxx_ses-yy_space-T00mri_desc-mm_electrodes_plot.html

      • sub-xxxx_ses-yy_T00mri_T01ct_registration.svg

      • sub-xxxx_ses-yy_space-T01ct_desc-vox_electrodes_itk_snap_labels.txt

    • Image Files:
      • sub-xxxx_ses-yy_acq-3D_space-T00mri_ct_thresholded.nii.gz

      • sub-xxxx_ses-yy_acq-3D_space-T00mri_T1w_electrode_spheres.nii.gz

      • sub-xxxx_ses-yy_acq-3D_space-T01ct_T1w.nii.gz

      • sub-xxxx_ses-yy_acq-3D_space-T01ct_ct_ras_electrode_spheres.nii.gz

      • sub-xxxx_ses-yy_acq-3D_space-T01ct_ct_ras_thresholded.nii.gz

      • sub-xxxx_ses-yy_acq-3D_space-T01ct_ct_ras.nii.gz

    • Coordinate files:
      • sub-xxxx_ses-yy_space-T00mri_desc-mm_electrodes.txt

      • sub-xxxx_ses-yy_space-T00mri_desc-vox_electrodes.txt

      • sub-xxxx_ses-yy_electrode_names.txt

      • sub-xxxx_ses-yy_orig_coords_in_mm.txt

    • Transformation Matrices:
      • sub-xxxx_ses-yy_T00mri_to_T01ct_fsl.mat

      • sub-xxxx_ses-yy_T01ct_to_T00mri_fsl.mat

      • sub-xxxx_ses-yy_T00mri_to_T01ct_greedy.mat (if using Greedy)

Running Module 2

If running from the iEEG-recon Application, follow the Running the App instructions.

If running from the command line, first make sure your input patient data is organized according to the pseudo-BIDS structure outlined in Data Setup. You can also run this tutorial with our example data.

The code below demonstrates how to run Module 2 from the command line.

$ docker run -v absolute/path/to/exampleData:/source_data lucasalf11/ieeg_recon -s sub-RID0922 -m 2 -cs ses-clinical01 -rs ses-clinical01 -d /source_data

| Arguments:
| -s: subject ID
| -m: Module number
| -cs: name of session with CT scan
| -rs: name of session with reference MRI scan
| -d: path to BIDS directory
| -gc: (optional, recommended) run with Greedy

Module 2 Outputs

Quality Report

Module 2 will generate a number of outputs including an html report that can be used to determine whether the coregistration worked properly.

Example: sub-RID0922_ses-clinical01_report.html:

Image Files

Module 2 generates a number of transformed image files

  • …acq-3D_space-T00mri_ct_thresholded.nii.gz: Original CT scan (left) transformed to MRI (T00) space with an intensity threshold applied (right):

    Single contact selected
  • …acq-3D_space-T00mri_T1w_electrode_spheres.nii.gz: Spheres marking electrodes in MRI (T00) space.

  • …acq-3D_space-T01ct_T1w.nii.gz: Original MRI transformed to CT (T01) space.

The next three outputs are the original CT scan, thresholded CT scan, and electrode spheres in native T01 CT space, transformed to the RAS (Right, Anterior, Superior) coordinate system. The units of RAS are voxels, and the voxels are indexed from left to right, posterior to anterior, and inferior to superior, respectively:

Coordinate files

  • sub-xxxx_ses_yy_space-T00mri_desc-mm_electrodes.txt

  • sub-xxxx_ses_yy_space-T00mri_desc-vox_electrodes.txt

  • sub-xxxx_ses_yy_electrode_names.txt

  • sub-xxxx_ses_yy_orig_coords_in_mm.txt

Transformation Matrices

  • sub-xxxx_ses_yy_T00mri_to_T01ct_fsl.mat

  • sub-xxxx_ses_yy_T01ct_to_T00mri_fsl.mat

  • sub-xxxx_ses_yy_T00mri_to_T01ct_greedy.mat (if using Greedy)