sccn / EEG-BIDS

21 stars 17 forks source link

pop_validatebids() .EEGChannelCount should be integer #92

Closed CorentinWicht closed 2 years ago

CorentinWicht commented 2 years ago

Dear Developper,

I've just exported BIDS files for the first time using your plugin and while applying the pop_validatebids function to actually validate the output, I got the following message:

>> pop_validatebids(ExportPath)
bids-validator@undefined

    1: [ERR] Invalid JSON file. The file is not formatted according the schema. (code: 55 - JSON_SCHEMA_VALIDATION_ERROR)
        ./sub-001/ses-01/eeg/sub-001_ses-01_task-GNG_eeg.json
            Evidence: .EEGChannelCount should be integer
        ./sub-001/ses-01/eeg/sub-001_ses-01_task-RVIP_eeg.json
            Evidence: .EEGChannelCount should be integer
... and 278 more files having this issue (Use --verbose to see them all).
   Please visit https://neurostars.org/search?q=JSON_SCHEMA_VALIDATION_ERROR for existing conversations about this issue.

    1: [WARN] The recommended file /README is missing. See Section 03 (Modality agnostic files) of the BIDS specification. (code: 101 - README_FILE_MISSING)

   Please visit https://neurostars.org/search?q=README_FILE_MISSING for existing conversations about this issue.

    2: [WARN] The Authors field of dataset_description.json should contain an array of fields - with one author per field. This was triggered based on the presence of only one author field. Please ignore if all contributors are already properly listed. (code: 102 - TOO_FEW_AUTHORS)

   Please visit https://neurostars.org/search?q=TOO_FEW_AUTHORS for existing conversations about this issue.

That's how my "./sub-001/ses-01/eeg/sub-001_ses-01_task-GNG_eeg.json" looks like: image

Would you have any idea why I got these error messages when trying to validate the output?

Many thanks and best regards,

Corentin Wicht

Remi-Gau commented 2 years ago

hey @CorentinWicht

I suspect this is because you have a string for EEGChannelCount.

So change :

   "EEGChannelCount": ""

to

   "EEGChannelCount": 0

should fix that error.

Though obviously you will want "EEGChannelCount" to not be 0 but actually be the number of EEG channels included in the recording (for example, 64, 128, 256).

CorentinWicht commented 2 years ago

Hello @Remi-Gau ,

Many thanks for your prompt reply, this is also what I suspected.

But will I have to do it manually for the ~300 files or isn't there here is an issue here related to the BIDS plugin not being able to detect the number of channels in my files ?

I think it would take less time to wait for a fix and re-run the BIDS export than to manually adjust all the individual .json files...

Remi-Gau commented 2 years ago

I will let the plugin developpers confirm but it seems that you can set that info manually at export to override info read from file:

https://github.com/sccn/bids-matlab-tools/blob/dabf9e945909f4f2735cc2ea8e47513f4e1c64de/bids_export.m#L220

maybe you can use that approach.

cll008 commented 2 years ago

One reason behind this behavior is that the channels can contain EXG and AUX channels as well. Do your channels have 10-05 labels? If so, you can script in readlocs with a template location file (e.g. dipfit BEM file) which will populate the type field in your data structure. Else, you could script in a way to assign EEG.chanlocs.type before the export step, and bids export will tally these up.

arnodelorme commented 2 years ago

This field should automatically populate. We have checked with the GitHub version that it does. Would you mind checking with your data (using the Github version of the plugin)? Thanks Remi for your comment. Closing this bug for now, but feel free to reopen.