@@ -51,10 +51,12 @@ function tutorial_coherence(tutorial_dir, reports_dir)
5151% Build the path of the files to import
5252MriFilePath = fullfile(tutorial_dir , ' SubjectCMC' , ' SubjectCMC.mri' );
5353MegFilePath = fullfile(tutorial_dir , ' SubjectCMC' , ' SubjectCMC.ds' );
54+ MriCat12Path = fullfile(tutorial_dir , ' SubjectCMC' , ' cat12' );
5455% Check if the folder contains the required files
5556if ~file_exist(MriFilePath ) || ~file_exist(MegFilePath )
5657 error([' The folder ' tutorial_dir ' does not contain the folder from the file SubjectCMC.zip.' ]);
5758end
59+ isMriSegmented = file_exist(bst_fullfile(MriCat12Path , ' SubjectCMC.nii.gz' ));
5860
5961
6062%% ===== CREATE PROTOCOL =====
@@ -75,16 +77,24 @@ function tutorial_coherence(tutorial_dir, reports_dir)
7577
7678
7779%% ===== IMPORT ANATOMY =====
78- % Process: Import MRI
79- bst_process(' CallProcess' , ' process_import_mri' , [], [], ...
80- ' subjectname' , SubjectName , ...
81- ' mrifile' , {MriFilePath , ' ALL' }, ...
82- ' nas' , [0 , 0 , 0 ], ...
83- ' lpa' , [0 , 0 , 0 ], ...
84- ' rpa' , [0 , 0 , 0 ], ...
85- ' ac' , [0 , 0 , 0 ], ...
86- ' pc' , [0 , 0 , 0 ], ...
87- ' ih' , [0 , 0 , 0 ]);
80+ if ~isMriSegmented
81+ % Process: Import MRI
82+ bst_process(' CallProcess' , ' process_import_mri' , [], [], ...
83+ ' subjectname' , SubjectName , ...
84+ ' mrifile' , {MriFilePath , ' ALL' }, ...
85+ ' nas' , [ 84 , 229 , 143 ], ...
86+ ' lpa' , [ 9 , 116 , 102 ], ...
87+ ' rpa' , [155 , 114 , 101 ]);
88+ else
89+ % Process: Import anatomy folder
90+ bst_process(' CallProcess' , ' process_import_anatomy' , [], [], ...
91+ ' subjectname' , SubjectName , ...
92+ ' mrifile' , {MriCat12Path , ' CAT12' }, ...
93+ ' nvertices' , 15000 , ...
94+ ' nas' , [ 84 , 229 , 143 ], ...
95+ ' lpa' , [ 9 , 116 , 102 ], ...
96+ ' rpa' , [155 , 114 , 101 ]);
97+ end
8898% Process: Generate head surface
8999bst_process(' CallProcess' , ' process_generate_head' , [], [], ...
90100 ' subjectname' , SubjectName , ...
@@ -313,15 +323,17 @@ function tutorial_coherence(tutorial_dir, reports_dir)
313323
314324
315325%% ===== SOURCE ESTIMATION =====
316- % Process: Segment MRI with CAT12
317- bst_process(' CallProcess' , ' process_segment_cat12' , [], [], ...
318- ' subjectname' , SubjectName , ...
319- ' nvertices' , 15000 , ...
320- ' tpmnii' , {' ' , ' Nifti1' }, ...
321- ' sphreg' , 1 , ...
322- ' vol' , 1 , ...
323- ' extramaps' , 0 , ...
324- ' cerebellum' , 0 );
326+ if ~isMriSegmented
327+ % Process: Segment MRI with CAT12
328+ bst_process(' CallProcess' , ' process_segment_cat12' , [], [], ...
329+ ' subjectname' , SubjectName , ...
330+ ' nvertices' , 15000 , ...
331+ ' tpmnii' , {' ' , ' Nifti1' }, ...
332+ ' sphreg' , 1 , ...
333+ ' vol' , 1 , ...
334+ ' extramaps' , 0 , ...
335+ ' cerebellum' , 0 );
336+ end
325337% Process: Compute covariance (noise or data)
326338bst_process(' CallProcess' , ' process_noisecov' , sFileRawNotchHighAbs , [], ...
327339 ' baseline' , [18 , 29 ], ...
0 commit comments