bids-standard / legacy-validator

Validator for the Brain Imaging Data Structure
https://bids-standard.github.io/legacy-validator/
MIT License
186 stars 111 forks source link

Integrate validation of BrainVision data files #475

Open sappelhoff opened 6 years ago

sappelhoff commented 6 years ago

Some data are saved in a multi-file system. For example the Brainvision format for EEG data contains three files:

I don't know if there are multi-file systems accepted somewhere in BIDS up to now ... but as soon as BEP006_EEG will be merged, there will be that case (at the latest).

Once the BIDS-validator encounters data of a "multi-file" system, it might make sense to kick in some assertion that all files of the multi-file system are present such as in this pseudo-code (python-like because I don't know much about js):

# import some list of what multi_file_endings are in BIDS
import multi_file_endings

# Check if current file ending is part of multi_file_endings
if file_ending in multi_file_endings:

    # Check which other files should be present
    # e.g., if file_ending=='.vhdr', then 
    # other_file_endings = ['.eeg', '.vmrk'] 
    other_file_endings = find_multi_file_system(f_ending, multi_file_endings)

    # Assert all necessary files are present ... else, raise some error message
    for other_file_ending in other_file_endings:
        assert other_file_ending in dir_that_is_currently_checked

This might be relevant in general and not just for EEG, so I am posting it as an issue here.

sappelhoff commented 6 years ago

Apparently the BrainVision file system will (as for now) be the only multi-file system in BIDS once the EEG spec is merged.

EDIT: in MEG we have the file format ending in .ds, which is a directory ... so also kind of multifile

I have started to write some code to validate the BrainVision file triplets here. The aim is to make this an npm package for easy integration into the BIDS-validator.

It could then conveniently go right below this line:

https://github.com/INCF/bids-validator/blob/fc7ac71b1080918a4d17316389d54b89d6bf3ddb/validators/bids.js#L251-L253

@robertoostenveld @CPernet

sappelhoff commented 6 years ago

edit: This is now located here: https://github.com/bids-standard/bids-validator/blob/c9901bc9c53480a8b9b13fedbe6ab5ae7a265b5c/validators/bids/groupFileTypes.js#L48

and needs some work

olgn commented 5 years ago

reopening because the changes implemented in #701 broke the browser version of the validator and were reverted

sappelhoff commented 5 years ago

relevant conversation in https://github.com/bids-standard/bids-validator/issues/718