Using Pybids to query derivative files using desc entity

Hi everyone,

I’m trying to use pybids in my preprocessing pipeline to loop through subjects and identify the files I need, but I can’t seem to make it work for derivative files. For instance I’m trying to identify each subject’s preprocessed DWI image which is called sub-xxx_ses-xxx_space-dwi_desc-preproc_dwi.mif and I tried running

bids_dir = '/home/lm/Desktop/data'
layout = BIDSLayout(bids_dir)
preproc_dwi_files = layout.get(desc="preproc", suffix="dwi",extension="mif",invalid_filters="allow")

but preproc_dwi_files returns an empty list. I added invalid_filters="allow" after the error "ValueError: 'desc' is not a recognized entity. If you're sure you want to impose this constraint, set invalid_filters='allow'. I tried moving this image into the derivatives folder and adding scope="derivatives" to the command, but it didn’t work either. Does anyone have an idea how I could do this? Thanks in advance!

Solved: I forgot to add a dataset_description.json file in the derivatives directory, after adding this the file is identified correctly!