Skip to content

Latest commit

 

History

History
340 lines (259 loc) · 28 KB

index.md

File metadata and controls

340 lines (259 loc) · 28 KB
layout
default

No identifying patient information is present. No MRIs nor any of the 18 HIPAA-designated direct identifiers and indirect identifiers are contained within this webpage. Only Javascript compatible 3D brain surface files (.glb, which do not contain any header or metadata information) and implant xyz coordinate files (.txt) are used. This webpage is intended to navigate intracranial EEG implants in 3D space ONLY.



Made by Andrew Revell (Fifth-year MD/PhD student at Penn):

My GitHub

Implant Links

Click to view "Phase II" implant in the Epilepsy Monitoring Unit (EMU):

| | | :--------------------------------------------------- | :---------------------------------------------------- | :--------------------------------------------------- | :--------------------------------------------------- | :------------------------------------------------------------- | :---------------------------------------------------- | :---------------------------------------------------- | :------------------------------------------------------- | :--------------------------------------------------- | :------------------------------------- | | 13 | 15 | 18 | 20 | 21 | 24 | 27 | 30 | 31 | 32 |
| 33 | 37 | 42 | 48 | 49 | 50 | 51 | 54 | 55 | 58 | | 59 | 65 | 68 | 69 | 89 | 101 | 102 | 106 | 117 | 131 | | 139 | 142 | 143 | 146 | 157 | 160 | 165 | 171 | 175 | 179 | | 186 | 190 | 192 | 190 | 194 | 206 | 213 | 218 | 222 | 227 | | 230 | 238 | 240 | 241 | 250 | 252 | 259 | 267 | 272 | 274 | | 278 | 279 | 280 | 294 | 295 | 296 | 307 | 309 | 317 | 320 | | 322 | 325 | 328 | 329 | 330 | 332 | 334 | 337 | 338 | 341 | | 356 | 357 | 365 | 371 | 380 | 381 | 382 | 385 | 386 | 392 | | 394 | 405 | 412 | 420 | 424 | 440 | 442 | 452 | 454 | 459 | | 472 | 475 | 476 | 490 | 502 | 508 | 517 | 520 | 522 | 529 | | 530 | 536 | 560 | 562 | 566 | 572 | 582 | 583 | 588 | 589 |
| 595 | 596 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 193 |

Click to view RNS implant:

| | |:------------------------------------------ |:------------------------------------------ |:------------------------------------------|:------------------------------------------|:------------------------------------------| |15 | 30 | 165 | 171 |186 | |206| 252 | 272 | 280 |328 | |334 | 337 |

  • Notes:
    • 13: Cortical surface of right temporal lobe is correct. Grid overlaid on right temporal lobe is correct.
    • 15: Surface reconstruction failed in Freesurfer.
    • 30: Missing coordinate files
    • 165: Freesurfer stuck in running mris_fix topology.
    • 186: Initial surface reconstruction of pre-implant image failed. Used the alternative clinical T1 imaging with very anisotropic voxels (and barely fully covers the lateral parts of brain).
    • 194: Channel coordinates and surface reconstruction are correct.
    • 218: Surface reconstruction failed.
    • 280: Using implant T1. Tissue classification will be incorrect (areas where electrodes are will most likely be classified as CSF because of the holes in the MRI)
    • 320: Registration a little off: Brain extraction of clinical T1 to the research 3T is off by some translation/rotation. Thus coordinates are off too.
    • 338: Freesurfer brain extraction, and thus tissue segmentation had large errors - due to poor quality clinical imaging
    • 386: Freesurfer stuck in running mris_fix_topology.
    • 476: Channel coordinates and surface reconstruction are correct.
    • 520: Registration a little off: Brain extraction of clinical T1 to the research 3T is off by some translation/rotation. Thus coordinates are off too.
    • 192: some manual WM delineation
    • 241: failed
    • 250: failed
    • 179: failed
    • 157: failed

About

These renders show implantations of epilepsy patients. Implantations were done for clinical purposes and to capture seizure activity. Click on the subject links in the table above to view the renders. You can adjust your view using your mouse and control settings (see below image). On mobile, toggle off "Brain wireframe" for quicker view adjustments. Click on "Channels" to see the channel label names. Spheres represent implanted electrode channels. The center of each sphere corresponds to the coordinate of each channel. Each spehere is arbitrarily 2.2 mm in radius. The coordinates of each channel is localized to specific brain tissue: gray matter (GM), white matter (WM), cerebrospinal fluid (CSF), or outside the brain area.

Colored spheres correspond to these areas:

RED: GM

BLUE: WM

PURPLE: CSF

WHITE: OUTSIDE (or not localized to any area)

if all channels are blue, localization information absent

aboutImage

Note on channel tissue localization:

The tissue type corresponding to each channel is determined by the SINGLE voxel the channel coordinate is in, and thus subject to errors.

Example: a specific voxel is determined to be GM through the FIRST and FAST FSL algorithms (see figure below). The channel is localized to that voxel. However, all surrounding voxels happen to be WM. It could be assumed then that the tissue type of that particular channel was determined to be wrong in this case - because all surrounding voxels of that channel are WM. Furthermore, tissue localization for ECoG (grids and strips) may not be necessarily correct. They can be assumed to be in CSF overlaid on GM cortical structures.

The FIRST and FAST algorithms have a smoothing factor to mitigate this issue to some extent. Please take this into consideration when relying on the specifc tissue type of each channel when interpreting these localizations. See this image below for an overview of the localization procedure:

aboutImage NOTE: This figure is now outdated. Freesurfer's segmentation is now used. GM is considered any cortical/subcortical areas found in the aseg.mgz output, WM is considered the WM regions in aseg.mgz (including Corpus Collosum labels), and CSF is any brain extracted areas (using the mri/brain.mgz file) but not in GM or WM. Outside the brain electrodes are ones that fall outside this brain extracted file. Figure legend: Electrode localization and Tissue Segmentation. Each channel is localized to a specific tissue type shown by the figure above. (1) A CT is acquired of the implantation. (2) The coordinates of each channel is determined through our clinical localization pipeline, and registered to an implant image (3) and a preimplant image (4). Using the preimplant image, tissue type is determined using FSL's FIRST and FAST algorithms. Output of the cortical segmentation (FAST) is shown in (5) and output of the subcortical segmentation (FIRST) is shown in (6). These images are combined (7). The electrode coordinates are determined in preimplant space using FSL's linear registration (not non-linear - the figure is wrong here and will be updated). The exact coordinate of the electrode channel is matched to a voxel in the tissue segmentation combined image (7) and thus the type of tissue the channel is sampling from is determined. WARNING: This method does not consider surrounding voxels, and thus a channel may be erroneously determined to be sampling from the wrong tissue in rare cases.

Metadata

Subject Implant Sampling T1 scan used for surface
13 ECoG bilateral clinical
15 ECoG bilateral clinical
18 ECoG bilateral clinical
20 ECoG bilateral clinical
21 ECoG bilateral clinical
24 ECoG right clinical
27 ECoG bilateral clinical
30 ???? ?????? clinical
31 SEEG bilateral research
32 ECoG right research
33
37 research
42 clinical
48 clinical
49 ECoG left clinical
50 ECoG right research
51 ECoG bilateral research
54 ECoG bilateral clinical
55 ECoG bilateral clinical
58 ECoG bilateral clinical
59 SEEG bilateral research
65 ECoG left clinical
68 ECoG left clinical
69 ECoG left clinical
89 SEEG bilateral research
101 ECoG bilateral research
102 ECoG bilateral research
106 ECoG bilateral clinical
117 ECoG bilateral research
131 SEEG left clinical
139 SEEG bilateral research
142
143 ECoG bilateral research
146 SEEG bilateral clinical
157
160 ECoG bilateral clinical
171 ECoG left clinical
175 SEEG bilateral clinical
179
186 SEEG bilateral clinical
190 research
192 SEEG left clinical
193 ECoG right clinical
194 SEEG bilateral research
206 SEEG bilateral clinical
213 ECoG bilateral research
218 SEEG bilateral clinical
222 ECoG left clinical
227 SEEG bilateral clinical
230 SEEG bilateral clinical
238 SEEG bilateral clinical
240 SEEG bilateral clinical
241 clinical
250 clinical
252 SEEG left clinical
259
267 SEEG bilateral clinical
272 SEEG bilateral clinical
274 SEEG right clinical
278 SEEG bilateral research
279 SEEG bilateral clinical
280 SEEG bilateral implant
294 SEEG bilateral clinical
295 ECoG left clinical
296 SEEG bilateral clinical
309 SEEG bilateral research
307 SEEG bilateral clinical
317 SEEG bilateral clinical
320 SEEG bilateral research
322 SEEG right clinical
325 SEEG bilateral clinical
328 SEEG bilateral clinical
329 SEEG bilateral clinical
330 SEEG bilateral clinical
332 SEEG bilateral clinical
334 SEEG left clinical
337 ???? ?????? clinical
338 SEEG bilateral clinical
341 SEEG bilateral research
356 SEEG bilateral clinical
357 ECoG right clinical
365 SEEG bilateral research
371 SEEG bilateral clinical
380 SEEG bilateral research
381 SEEG bilateral clinical
382 SEEG bilateral clinical
385 SEEG bilateral clinical
386 SEEG bilateral clinical
392 SEEG bilateral clinical
394 SEEG bilateral research
405 SEEG bilateral clinical
412 SEEG bilateral clinical
420 SEEG bilateral research
424 SEEG bilateral clinical
440 SEEG bilateral research
442 SEEG bilateral clinical
452 SEEG bilateral clinical
454 SEEG bilateral research
459 SEEG left research
472 SEEG bilateral clinical
475 SEEG bilateral clinical
476 SEEG bilateral research
490 SEEG bilateral research
502 SEEG bilateral research
508 SEEG left research
517 SEEG bilateral clinical
520 ECoG left research
522 SEEG right research
529 SEEG right research
530 SEEG bilateral clinical
536 SEEG bilateral research
560 SEEG bilateral clinical
562 SEEG right clinical
566 SEEG left research
572 SEEG right research
582 SEEG bilateral clinical
583 SEEG left research
588 SEEG bilateral clinical
589 SEEG left research
595 SEEG left research
596 SEEG left research
646 SEEG bilateral research
647 SEEG left clinical
648 SEEG left research
649 SEEG left clinical
650 SEEG bilateral research
651 SEEG left clinical
652 SEEG bilateral research

SEEG: Stereoelectroencephalography ("toothpicks")

ECoG: Electrocorticography ("grids and strips")

Methods

Visual

visualMethodsImage

Bullet Point Methods

See revellLab GitHub repository electrodeLocalization.py for example pipeline

  1. Step 1: Creation of brain 3D model

    • Data needed:
      • Pre-implant T1 image.
      • Preferably at 3T
      • Preferably using our high resolution 3T research protocol (not all patients acquire this image)
    • Software needed:
    • Step 1.1: Cortical surface reconstruction of brain
      • Software: Freesurfer
      • Command: recon-all -subjid ### -all -time -log logfile -nuintensitycor-3T -sd ### -parallel -threads 12
      • Takes about 1.5-2hrs for Andy's computer (AMD Ryzen 9 3900X 12-Core Processor, 64 GB RAM, Titan RTX GPU)
    • Step 1.2: Make 3D model
      • Convert lh.pial and rh.pial to scanner T1 space
        • Freesurfer command: mris_convert --to-scanner lh.pial lh.pial
      • Combine lh.pial and rh.pial AND convert to .stl 3D model file
        • reesurfer command: mris_convert --combinesurfs rh.pial lh.pial combined.stl
      • Convert to .stl to .glb file (To render on webpage using three.js)
        • Software: Blender 3.9
        • Use python script blender_compress_mesh.py from revellLab GitHub repository
        • Command: blender --background --factory-startup --addons io_scene_gltf2 --python blender_compress_mesh.py -- -i combined.stl -o brain.glb
  2. Step 2: Get implantation coordinates

    • Data needed:
      • Pre-implant T1 image (from above)
      • Coordinates in the pre-implant T1 space above
        • If coordinates in a different space, need the corresponding T1 image and register the pre-implant T1 image above
      • Optional: output of atlas localization pipeline to get tissue localization information of implant channels
    • Software needed:
      • FSL
      • Python 3.7+
    • Step 2.1: Register the pre-implant T1 image to the T1 image the coordinate file is in - skip if they are the same
      • Brain extract the images using FSL bet
      • Linear registration of the two images using FSL flirt
      • Apply the returned tranformation matrix from flirt to the coordinate file
        • FSL command: img2imgcoord -src ### -dest ### -xfm ### -mm ### > ###
        • See FSL's documentation of img2imgcoord for specific data sctructures files must be in
    • Step 2.2: Save coordinates in same location as the brain.glb file, name it electrodes.txt
      • electrodes.txt format
        • each row contains channel information. Column 1: Channel name; Column 2: x coordinate; Column 3: y coordinate; Column 4: z coordinate
        • Separation is a single space between columns (not comma or tab separated)
  3. Step 3: Get necessary files in single directory:

    • See example
    • File names:
      • brain.glb
      • electrodes.txt
      • index.html Get here
    • These three files are all you need, and the html file should work provided you name the .glb and .txt files accordingly
    • To run on local computer, follow these directions
      • I installed npm: npm install http-server -g (I forget if you need this to run the python -m http.server below)
      • python -m http.server
      • Type this into browser (I used Chrome, Firefox, and Microsoft Edge): http://localhost:8000/
      • The reason why you need the above is because web browser restrict loading of the 3D .glb files locally for security reasons.