Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tools:source_localization [2026/11/09 16:21] – sdm63 | tools:source_localization [2026/11/09 16:38] (current) – sdm63 | ||
|---|---|---|---|
| Line 13: | Line 13: | ||
| * data: your brain data | * data: your brain data | ||
| * contains eeg files that you load in | * contains eeg files that you load in | ||
| + | \\ | ||
| === Brainstorm Scripts === | === Brainstorm Scripts === | ||
| * I have one script for each task epoch (fix, delay, resting state, etc) | * I have one script for each task epoch (fix, delay, resting state, etc) | ||
| * Sets the necessary paths to the freesurfer folders, list of glasser parcellations, | * Sets the necessary paths to the freesurfer folders, list of glasser parcellations, | ||
| - | * * We need the subject folders that have ' | + | * We need the subject folders that have ' |
| < | < | ||
| + | |||
| * Define the subject folder (protocol), DBfolder is the brainstorm_db, | * Define the subject folder (protocol), DBfolder is the brainstorm_db, | ||
| - | < | + | < |
| + | |||
| + | * Here we are setting the protocol name | ||
| + | * The iProtocol bst_get checks to see the protocol already exists in the database | ||
| + | * If no (iProtocol is empty), then create protocol, and add the subject within it | ||
| + | * That just creates a blank subject line in the protocol to then fill with the anat and data | ||
| + | * If the protocol does exist, then load it and set it as the current protocol | ||
| + | |||
| + | < | ||
| + | ProtocolName = sprintf(' | ||
| + | iProtocol = bst_get(' | ||
| + | |||
| + | if isempty(iProtocol) | ||
| + | |||
| + | gui_brainstorm(' | ||
| + | db_add_subject(SubjectNameMRI, | ||
| + | |||
| + | else | ||
| + | |||
| + | gui_brainstorm(' | ||
| + | |||
| + | end | ||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| + | * bst_get(' | ||
| + | * A study is like each EEG file you have loaded into that protocol, so everyone should have fix, delays, and rest | ||
| + | * But this code below checks to see if fix (or delay or rest or whatever what you're running) already exists and removes it (cause maybe you wanna redo it) | ||
| + | |||
| + | < | ||
| + | sStudies = bst_get(' | ||
| + | |||
| + | for iStudy = 1: | ||
| + | studyName = sStudies.Study(iStudy).Name; | ||
| + | |||
| + | if contains(studyName, | ||
| + | |||
| + | fprintf(' | ||
| + | db_delete_studies(iStudy); | ||
| + | |||
| + | end | ||
| + | |||
| + | end | ||
| + | |||
| + | </ | ||
| + | |||
| + | * Find the lunaID | ||
| + | * Find the MRI date | ||
| + | * Find the row in merge 7t with the corresponding lunaID and MRI date | ||
| + | * Using that row, find the EEG date | ||
| + | * Create the path to the corresponding EEG file | ||
| + | |||
| + | < | ||
| + | luna = str2double(SubjectNameMRI(1: | ||
| + | MRIdate = str2double(SubjectNameMRI(7: | ||
| + | |||
| + | rowIdx = merge7t(:, | ||
| + | |||
| + | if any(rowIdx) | ||
| + | |||
| + | | ||
| + | |||
| + | | ||
| + | files = dir(fullfile(EEGfolder, | ||
| + | |||
| + | | ||
| + | |||
| + | else | ||
| + | |||
| + | | ||
| + | |||
| + | end | ||
| + | </ | ||