Databse on a hard drive

Hello,

As I am often working from different computer, I recently had the idea to move my Brainstorm database to a hard drive instead of having multiple copy it that were hard to keep synchronised.

However, the issue is that the path to the files are different when working on linux or macOS:

Linux : /media/edelaire/hard_drive/data/....
MacOs: /Volumes/hard_drive/data/....

Would there be an easy way to fix that or better way to keep the same db on multiple computers ?

Regards,
Edouard

As a quick fix, the only solution I found now to not have to pick each file location manually was to add the following in in_bst_data:
`

% ===== FIX BROKEN RAW LINKS =====
if isfield(DataMat, 'F') && isstruct(DataMat.F) && ~isempty(DataMat.F.filename) && ~file_exist(DataMat.F.filename)
    % Try to look for the file in the current study folder
    
    newRaw = strrep(DataMat.F.filename, '/media/edelaire/','/Volumes/');
    % If the corrected file exists
    if file_exist(newRaw)
        % Update the file in the returned structure
        DataMat.F.filename = newRaw;
        % Replace the link in the file
        UpdateMat.F = DataMat.F;
        bst_save(DataFile, UpdateMat, 'v6', 1);
    end
end

Usually, this is done by using the option:
File > Export protocol > Copy the raw files to the database

In that way the links to raw data will be automatically fixed.
Would this approach work for you?

It's working. There is only two issue with that :

  • it has to be done before copying the database. and its an additional step to think of.
  • it's adding a copy file tag to the file name. (but I guess its minor)

Maybe when importing continuous file. There could be a question asking 'do you want to copy the file to the database'

And one thing that could be nice, to avoid conversion, would be fore exemple to have a folder at the root of the protocol called sourcedata as in bids, where the file would be copied and linked to the database so that the database would be by design self-containing without any reference to outside folders

it would also make database more robust as currently it file linked in brainstorm can be very easily altered / deleted outside brainstorm making database invalid.

On an other topic. it would be very great to be able to have multiple files per folder even for continuous file. I am reimporting data using continuous files and only after the preprocessing its already a mess :

and its only with EEG/fNIRS data. with other PSG measurement I would end up with dozens of folders. even more after the data analysis.

Or maybe it would be nice to be able to say that intermediate output of specific combination of process are not useful. For example bandpass + notch + resample would only lead to the creating of one file / folder called preprocessed. Maybe when lunching a pipeline we could say ; save only last output with the following tag:

image

The Linux-MacOS (and also Windows) portability of a database as described above, should be handled now with 83e2591.


Yes, but this is the recommended way to moving a database.

This is added mostly to indicate that if the user removes it, it was a copy of the raw data

The idea is to avoid duplicating the raw files, as it can be very storage demanding.
Modifying or deleting the raw data outside of Brainstorm would be more on the user side.

This will imply that the continuous recordings share the same channel file, which is not necessarily true. If they were part of the same recording session, another approach would be to concatenate the raw files.

I think for the filter processes (using raw files) an extra option that says Delete input file would to the job.