Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To do so a new datatype was created: the meg/fif-override datatype that will be used when an App doesn’t change the meg.fif but writes a file that will be used later in another App.

...

Info
  1. events.tsv and channels.tsv are BIDS compliant, see How to create a BIDS compliant channels.tsv and events.tsv files.

  2. An updated events.tsv is also returned by app-resampling when this app is applied to continuous data , and when an events.tsv is given in input. But the output of this app has not the meg/fif-override datatype because it returns also a meg.fif.

...

For instance, the app-maxwell-filter takes as inputs the meg/fif datatype (for the meg.fif) and also optionnaly optionaly the meg/fif-override datatype. The inputs from the meg/fif-override datatype are optional because we don’t know if an App user will run the whole pipeline on Brainlife (i.e. compute the destination.fif, then the headshape.pos, detect bad channels, and eventually run Maxwell filter), maybe he will want to run only the app-maxwell-filter and he will provide the headshape.pos and channels.tsv without computing them with the BL Apps, and these files will be directly into the data staged under the meg/fif datatype.

But, maybe the user will run the pipeline from the beginning and still provide the headshape.pos and channels.tsv when the data is staged underr under the meg/fif datatype. So, for app-maxwell-filter we will have two versions of each file. So, in this case, only the files computed by the BL Apps will be taken into account.

...

Code Block
    # Read the destination file
    if 'destination_override' in config.keys():  # if the App has no meg/fif-override input this key doesn't exist
        destination_override = config.pop('destination_override')
        # No need to test if destination_override is None, this key is only present when the app runs on BL
        if os.path.exists(destination_override) is False: 
            if destination is not None:
                # If destination from meg/fif exists but destination_override from meg/fif-override doesn't,
                # we copy it in out_dir 
                shutil.copy2(destination, os.path.join(out_dir_name, 'destination.fif'))  # required to run a pipeline on BL
        else:
            # If destination_override from meg/fif-override exists, we copy it in out_dir
            # By default we copy the files given in input of meg/fif-override 
            shutil.copy2(destination_override, os.path.join(out_dir_name, 'destination.fif'))  # required to run a pipeline on BL 
            destination = destination_override  # we overwrite the value of destination
    else: 
        # If the App has no meg/override- datatype (or if the App is run locally) 
        if destination is not None:
            # If destination file from meg/fif is not None, we copy it in outdir
            shutil.copy2(destination, os.path.join(out_dir_name, 'destination.fif'))

...

We decided not to inform the App user that the optional file previously computed by an App (so a file from the meg/fif-override datatype) will overwrite the optional file linked to the meg/fif datatype because we supposed that, if the User user computes a new file he doesn’t want to use the file he gave at first when the data was staged.

...

In the file mapping section (displayed when registering or eding editing an App on Brainlife) of app-maxwell-filter, we have:

...

In the config.json created by BL we will have the keys linked to the meg/fif-override datatype, but these keys won’t be present if the App is run locally because the datatype issue is specific to BL (that’s why we check if the key is present at the beginning).