The Brain Imaging Data Structure (BIDS) is a standard for organizing, annotating, and describing data collected during neuroimaging experiments. It is based on a formalized file/folder structure and...


The Brain Imaging Data Structure (BIDS) is a standard for organizing, annotating, and describing data collected during neuroimaging experiments. It is based on a formalized file/folder structure and JSON based metadata files with controlled vocabulary. BIDS has standard conventions for file names. A filename consists of a chain of entities, or key-value pairs, a suffix and an extension.


BIDS has a standardized way of naming files that tries to implement the following principles:




  • Do not white spaces in file names




  • Use only letters, numbers, hyphens, and underscores.




  • Do not rely on letter case (UPPERCASE and lowercase)




  • Use separators provide a meaningful way to describe the content of the file. Filename template


    key1-value1_key2-value2_suffix.extension


    Entities are composed ofkey-valuepairs separated by underscores.Keys,valueandsuffixescan only contain letters and/or numbers.Suffixdenotes de neuroimaging modality: e.g.,eeg
    Suffixesare preceded by an underscore.


    Extensioncan contain three or more character and they can be:.edf .set .fdt


    An example of a valid filename is:


    sub-100_task-motor_eeg.set
    This filename describes the electroencephalography (eeg) data of the subject (sub) number100which performed amotortask.


    Create a program that asks the user for a valid BIDS filename, validates the filename and inform the user the result according to the following cases:


    Validate Expected format Description























Separator symbols



-_



The only valid separators are dash, underscore, and dot. Dashes are part of key-value pairs, while underscores separate those pairs. Any other symbol is not valid as well as misplacing the dashes and underscore. A dot can only appear one time in the correct place (15 points).



The subject entity



sub-DDD



The first three characters are fixed (“sub”), a dash, and a number with three digits followed by an underscore (15 points).



The task entity



task-LLLLL



The first four characters are fixed (“task”), a dash, five characters (only letters) followed by an underscore (15 EXTRA points).



The suffix entity LLL The exact string “eeg” followed by a dot (‘.’) (15 points).


The extension LLLEither of the extensions: “edf” or ”set” (15 points).


Expected solution:


The output of the program can be any of these three cases:




  • - The filename is complete and valid.




  • - The filename is not valid (error in separators).




  • - The filename is not valid (error in subject entity).




  • - The filename is not valid (error in task entity).




  • - The filename is not valid (error in suffix entity).




  • - The filename is not valid (error in extension).


    Examples:


    i)


    Enter a BIDS-valid filename:

    sub-100_task-motor_eeg.set

    The filename is valid and complete.

    ii)


    Enter a BIDS-valid filename:

    sub-23_task-motor_eeg.set

    The filename is not valid (error in subject entity)

    Explanation: the number format for the subject is not valid because it has only two digits (it should be four digits).


    iii)


    Enter a BIDS-valid filename:

    sub-100_task-motor_egg.set

    The filename is not valid (error in suffix entity)

    Explanation: Expected “eeg” and “egg” received instead iv)
    Enter a BIDS-valid filename: sub_100-task_motor-egg.set


    The filename is not valid (error in subject entity)

    Explanation: Not valid separators. They are not valid because the underscores are in the dashes places and vice versa.




Suggested reading


•zyBook, 3.6 Character operationsRequired style (10 pts. each):




  1. Add a multi-line comment at the top of the file with the format:


    /*
    TITLE OF THE PROGRAM Input data
    InputVar1 : Explanation InputVar2 : Explanation ...
    Output
    OutputVar1 : Explanation */




  2. Add single-line comments to describe every step of your program: For instance, each condition must have a brief explanation.




  3. Use descriptive names for the identifiers and one style (snake_case or camelCase; choose only one).




  4. Print numbers using the integer format.



Jun 27, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here