Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate GARDEL #759

Draft
wants to merge 52 commits into
base: master
Choose a base branch
from

Conversation

chinmaychinara91
Copy link
Collaborator

@chinmaychinara91 chinmaychinara91 commented Jan 23, 2025

About GARDEL: link
Test data: link


Access GARDEL external GUI from Brainstorm

  • GARDEL as plugin
  • GARDEL option shown only when there is a raw CT in the subject.
  • Start GARDEL external GUI from Brainstorm
  • Create temporary folder for exchanging data between GARDEL and Brainstorm
  • Once done with GARDEL tool, load the SPM12 segmented tissues into Brainstorm
  • Once done with GARDEL tool, load the electrodes and its coordinates as channel file into Brainstorm
  • Once data in Brainstorm, allow user to reopen GARDEL GUI for editing (give flexibility to the user to edit the electrodes within GARDEL itself) by using the precomputed tissue maps and the electrode data
    • If precomputed tissue maps from GARDEL not available in Brainstorm, compute them when restarting GARDEL
  • Place Gardel menu option. Check 5c5ea9f.
  • Update GARDEL logo (to be given by GARDEL team)

Steps to test:

  1. Create an empty subject in a protocol.
  2. Right click subject > Import MRI. Set and save the fiducials (NAS, LPA, RPA).
  3. Right click subject > Import CT.
    • Choose Yes for importing raw CT from the menu that pops up
    • Rest steps of CT import (coregistering/reslicing/skull stripping) is not important for this test but good to have once we have imported things from GARDEL back to Brainstorm.
  4. After this, the subject should have MRI, raw CT (and another CT volume based on what you did i.e. coregistering/ reslicing/skull stripping)
  5. Right click on the subject > SEEG/ECOG Implantation > GARDEL .
  6. Brainstorm GUI hides, GARDEL GUI loads (takes some time for GARDEL GUI to start as it does MRI to CT coregistration (~2mins), tissue segmentation (for skull stripping)(~8mins) and brain surface generation (~2mins) using SPM12).
  7. In the GARDEL GUI, Click Segment Electrodes and set the threshold for CT by pressing Set Actual Threshold.
  8. Once electrode segmentation is done, it displays in the GARDEL GUI under Electrodes and Contacts section.
  9. Click Export Table. Close the summary image that pops up. Close the GARDEL GUI.
  10. Brainstorm GUI reappears:
  • tissues_segment_gardel atlas gets added to the subject node that stores the SPM12 tissue segmentation data.
  • In the functional tab, under the subject a channel called Gardel is loaded in Brainstorm format.
  1. To restart and edit contacts in GARDEL, just do as in step 5. This time all processes in step 6 except the SPM12 tissue segmentation (it will use the saved tissues_segment_gardel atlas) will be done. So in like ~4mins, GARDEL GUI starts and reloads with all the electrodes and contacts.

Using GARDEL magic button in Brainstorm

  • Automatic SEEG Contact Localization using GARDEL (within Brainstorm)
  • Place Gardel button in panel_ieeg. Check d31b164.

Steps to test:

  1. Right click subject > Import MRI. Set fiducials and save.
  2. Right click subject > Import CT. Click Yes transformation, Yes for unprocessed raw CT, SPM for registration, Yes for reslicing and SPM for skull stripping.
  3. Right click subject > SEEG/ECOG implantation > Brainstorm
  4. Right click on CT_spm_reslice_masked_spm > CT segmentation > Generate threshold mesh from CT
  5. Choose CT+MRI+IsoSurf. Panel iEEG opens. MRI viewer opens with CT overlayed on MRI. 3D viewer opens with 3D MRI loaded with IsoSurface.
  6. In Panel iEEG, at the bottom click Auto > Gardel. The magic fucntion is called and the live automatic implantation can be seen.
  7. Close figures and click Save in the prompts to save the channel data.

Additional checks

  • Verify GARDEL works both with and without using Parallel Computing Toolbox.

Bugs encountered

  1. Remove line fitting renderings with multiple electrodes selected. Introduced in 2ea6b5c. Fixed 8a72c83.
  2. Pass reference MRI for skull stripping. Introduced in 8ebc1db. Fixed 492a1f4

When the user imports a CT file, we can end up with: one file (unprocessed) or, two files (the unprocessed file and the processed file)
- unprocessed file ends with `_volct_raw`
- processed file ends with `_volct'
only shows up when there is a raw CT file present
@chinmaychinara91 chinmaychinara91 marked this pull request as draft January 24, 2025 02:58
…alue from the IsoSurface data

Some comments cleanup as well
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant