Пример #1
0
# In[16]:

f = layout.get()[0]
f

# If we wanted to get the path of the file, we can use `.path`.

# In[17]:

f.path

# Suppose we were interested in getting a list of tasks included in the dataset.

# In[18]:

layout.get_task()

# We can query all of the files associated with this task.

# In[19]:

layout.get(task='localizer', suffix='bold', scope='raw')[:10]

# Notice that there are nifti and event files. We can get the filename for the first particant's functional run

# In[140]:

f = layout.get(task='localizer')[0].filename
f

# If you want a summary of all the files in your BIDSLayout, but don't want to have to iterate BIDSFile objects and extract their entities, you can get a nice bird's-eye view of your dataset using the `to_df()` method.
- .get_image(): Returns the file contents as a nibabel image (only works for image files)
- .get_df(): Get file contents as a pandas DataFrame (only works for TSV files)
- .get_metadata(): Returns a dictionary of all metadata found in associated JSON files
- .get_associations(): Returns a list of all files associated with this one in some way

Let's explore the first file in a little more detail.

f = layout.get()[0]
f

If we wanted to get the path of the file, we can use `.path`.

f.path

Suppose we were interested in getting a list of tasks included in the dataset.

layout.get_task()

We can query all of the files associated with this task.

layout.get(task='localizer', suffix='bold', scope='raw')[:10]

Notice that there are nifti and event files. We can get the filename for the first particant's functional run

f = layout.get(task='localizer')[0].filename
f

If you want a summary of all the files in your BIDSLayout, but don't want to have to iterate BIDSFile objects and extract their entities, you can get a nice bird's-eye view of your dataset using the `to_df()` method.

layout.to_df()