@@ -204,14 +204,12 @@ function tolerant_message(tolerant, msg)
204
204
subject = parse_using_schema(subject , datatypes{iDatatype }, schema );
205
205
case ' dwi'
206
206
subject = parse_dwi(subject , schema );
207
- case ' eeg'
208
- subject = parse_eeg (subject , schema );
207
+ case { ' eeg' , ' meg ' }
208
+ subject = parse_meeg (subject , datatypes{ iDatatype } , schema );
209
209
case ' fmap'
210
210
subject = parse_fmap(subject , schema );
211
211
case ' func'
212
212
subject = parse_func(subject , schema );
213
- case ' meg'
214
- subject = parse_meg(subject );
215
213
case ' perf'
216
214
subject = parse_perf(subject , schema );
217
215
end
@@ -652,9 +650,7 @@ function tolerant_message(tolerant, msg)
652
650
653
651
end
654
652
655
- function subject = parse_eeg(subject , schema )
656
-
657
- datatype = ' eeg' ;
653
+ function subject = parse_meeg(subject , datatype , schema )
658
654
659
655
pth = fullfile(subject .path , datatype );
660
656
@@ -666,10 +662,13 @@ function tolerant_message(tolerant, msg)
666
662
667
663
subject = bids .internal .append_to_structure(file_list{i }, subject , datatype , schema );
668
664
669
- switch subject .eeg (end ).type
665
+ switch subject.( datatype ) (end ).type
670
666
671
- case {' events' , ' channels' , ' electrodes' }
672
- subject .eeg(end ).meta = bids .util .tsvread(fullfile(pth , file_list{i }));
667
+ case {' events' , ' channels' , ' electrodes' } %
668
+ % TODO: events / channels file can also be stored
669
+ % at higher levels (inheritance principle)
670
+ %
671
+ subject.(datatype )(end ).meta = bids .util .tsvread(fullfile(pth , file_list{i }));
673
672
674
673
case {' photo' , ' coordsystem' }
675
674
@@ -681,58 +680,6 @@ function tolerant_message(tolerant, msg)
681
680
682
681
end
683
682
684
- function subject = parse_meg(subject )
685
-
686
- pth = fullfile(subject .path , ' meg' );
687
-
688
- if exist(pth , ' dir' )
689
-
690
- entities = return_entities(' meg' );
691
-
692
- file_list = return_file_list(' meg' , subject );
693
-
694
- for i = 1 : numel(file_list )
695
-
696
- subject = append_to_structure(file_list{i }, entities , subject , ' meg' );
697
-
698
- subject .meg(end ).meta = struct([]); % ?
699
-
700
- end
701
-
702
- file_list = return_event_file_list(' meg' , subject );
703
-
704
- for i = 1 : numel(file_list )
705
-
706
- subject = append_to_structure(file_list{i }, entities , subject , ' meg' );
707
-
708
- subject .meg(end ).meta = bids .util .tsvread(fullfile(pth , file_list{i })); % ?
709
-
710
- end
711
-
712
- file_list = return_channel_description_file_list(' meg' , subject );
713
-
714
- for i = 1 : numel(file_list )
715
-
716
- subject = append_to_structure(file_list{i }, entities , subject , ' meg' );
717
-
718
- subject .meg(end ).meta = bids .util .tsvread(fullfile(pth , file_list{i })); % ?
719
-
720
- end
721
-
722
- file_list = return_session_specific_file_list(' meg' , subject );
723
-
724
- for i = 1 : numel(file_list )
725
-
726
- subject = append_to_structure(file_list{i }, entities , subject , ' meg' );
727
-
728
- subject .meg(end ).meta = struct([]); % ?
729
-
730
- end
731
-
732
- end
733
-
734
- end
735
-
736
683
function subject = parse_pet(subject )
737
684
% --------------------------------------------------------------------------
738
685
% -Positron Emission Tomography imaging data
@@ -776,12 +723,6 @@ function tolerant_message(tolerant, msg)
776
723
777
724
switch modality
778
725
779
- case ' eeg'
780
- entities = {' sub' , ' ses' , ' task' , ' acq' , ' run' , ' meta' };
781
-
782
- case ' meg'
783
- entities = {' sub' , ' ses' , ' task' , ' acq' , ' run' , ' proc' , ' meta' };
784
-
785
726
case ' pet'
786
727
entities = {' sub' , ' ses' , ' task' , ' acq' , ' rec' , ' run' };
787
728
@@ -827,73 +768,3 @@ function tolerant_message(tolerant, msg)
827
768
file_list = convert_to_cell(file_list );
828
769
829
770
end
830
-
831
- function file_list = return_event_file_list(modality , subject )
832
- %
833
- % TODO: events file can also be stored at higher levels (inheritance principle)
834
- %
835
-
836
- switch modality
837
-
838
- case ' meg'
839
- pattern = ' _task-.*_events\\ .tsv' ;
840
-
841
- end
842
-
843
- pth = fullfile(subject .path , modality );
844
-
845
- file_list = bids .internal .file_utils(' List' , ...
846
- pth , ...
847
- sprintf([' ^%s .*' pattern ' $' ], ...
848
- subject .name ));
849
-
850
- file_list = convert_to_cell(file_list );
851
-
852
- end
853
-
854
- function file_list = return_channel_description_file_list(modality , subject )
855
- %
856
- % Channel description table
857
- %
858
- % TODO: those files can also be stored at higher levels (inheritance principle)
859
- %
860
-
861
- switch modality
862
-
863
- case ' meg'
864
- pattern = ' _task-.*_channels\\ .tsv' ;
865
-
866
- end
867
-
868
- pth = fullfile(subject .path , modality );
869
-
870
- file_list = bids .internal .file_utils(' List' , ...
871
- pth , ...
872
- sprintf([' ^%s .*' pattern ' $' ], ...
873
- subject .name ));
874
-
875
- file_list = convert_to_cell(file_list );
876
-
877
- end
878
-
879
- function file_list = return_session_specific_file_list(modality , subject )
880
-
881
- switch modality
882
-
883
- case ' meg'
884
- pattern = [ ...
885
- ' (_ses-[a-zA-Z0-9]+)?.*_' , ...
886
- ' (electrodes\\ .tsv|photo\\ .jpg|coordsystem\\ .json|headshape\\ ..*)' ];
887
-
888
- end
889
-
890
- pth = fullfile(subject .path , modality );
891
-
892
- file_list = bids .internal .file_utils(' List' , ...
893
- pth , ...
894
- sprintf([' ^%s ' pattern ' $' ], ...
895
- subject .name ));
896
-
897
- file_list = convert_to_cell(file_list );
898
-
899
- end
0 commit comments