4.3. Data Grabber#
4.3.1. Description#
The Data Grabber is an object that can provide an interface to datasets you want to work with in junifer.
Every concrete implementation of a datagrabber is aware of a particular dataset’s structure and thus allows
you to fetch specific elements of interest from the dataset. It adds the path
key to each data type
in the Data object.
Datagrabbers are intended to be used as context managers. When used within a context, a datagrabber takes care of any pre and post steps for interacting with the dataset, for example, downloading and cleaning up. As the interface is consistent, you always use the same procedure to interact with the datagrabber.
For example, a concrete implementation of DataladDataGrabber
can provide junifer
with data from a Datalad dataset. Of course, datagrabbers are not only meant to work with Datalad datasets but
any dataset.
If you are interested in using already provided datagrabbers, please go to Built-in Pipeline steps and data. And, if you want to implement your own datagrabber, you need to provide concrete implementations of base classes already provided.
4.3.2. Base classes#
In this section, we showcase different abstract base classes you might want to use to implement your own datagrabber.
Name |
Description |
---|---|
The abstract base class providing you an interface to implement your own datagrabber.
You should try to avoid using this directly and instead use
To build your own custom low-level datagrabber, you need to at least implement the
get_elements method,but most of the time you should also override other existing methods like
__enter__ and __exit__ . |
|
It implements functionality to help you define the pattern of the dataset you want to get. For example,
you know that T1 images are found in a directory following this pattern
{subject}/anat/{subject}_T1w.nii.gz inside of the dataset. Now you can provide this to the PatternDataGrabber and it will be able to get the file.
|
|
It implements functionality to deal with Datalad datasets. Specifically, the
__enter__ and __exit__ methodstake care of cloning and removing the Datalad dataset.
|
|
It is a combination of
PatternDataladDataGrabber andDataladDataGrabber . This is probably the class you are looking for when using Datalad. |