"BIDS root does not exist" error (Intro to Neuroimaging)

When I try to initialize the BIDS layout with the localizer data, I keep getting the error message “BIDS root does not exist” - any thoughts why this could be? I thought the localizer dataset has already been converted to BIDS format, which should rule out any issues with the dataset itself.

Hi Liza, thanks for asking your question. Your error is probably not related to the BIDS formatting, but rather that PyBIDS can’t find the data.

data_dir = '/home/jovyan/psych60/data/Localizer'
layout = BIDSLayout(data_dir, derivatives=True)

In order for PyBIDS to find the data, we need to specify the location of the data on the hard drive.

There are two ways to specify paths to the data directory.

  1. An absolute path specifies the location of a file or directory from the root directory (i.e., ‘/’). This means that regardless of your current location, the path will alway lead to the directory.

    data_dir = '/Users/lukechang/Dropbox/Dartbrains/data/Localizer'

  2. A relative path specifies the location of a file or directory relative to your current working directory. You can print the path to your current working directory using pwd.

For example, if you are in this folder, /home/jovyan/psych60/notebooks, you can specify the relative path to the data by going up one level (..) and then specifying the location of the data directory.

`data_dir = '../data/Localizer`

If you are in a different directory, then you need to specify the path to get to the data from that location.

Thank you! Couldn’t get it to work with the absolute path, but the relative path method worked.

1 Like