7.11. Creating a Data Registry¶
7.11.1. What is a data registry¶
Data Registry is an object which manages pipeline data (like parcellations,
coordinates and masks) based on the scope. junifer comes with the
following in-built data registries:
ParcellationRegistryfor parcellationsCoordinatesRegistryfor coordinatesMaskRegistryfor masks
You interact with them indirectly via get_data(), load_data(),
list_data(), register_data() and deregister_data(). The
kind parameter in them directs which data registry to interact with. These
in turn supply preprocessors and markers with their necessary data for computation.
7.11.2. How to make a data registry¶
Ideally you would not need to create a custom data registry if you work with fMRI data. In case you work with other modalities like EEG, you might want to create a data registry for montages. Here is how you would go about it:
Check extending junifer on how to create a junifer extension if you have not done so.
Create the data registry in the extension script like so:
from junifer.api.decorators import register_data_registry from junifer.data import BasePipelineDataRegistry @register_data_registry("montage") class MontageDataRegistry(BasePipelineDataRegistry): def __init__(self): super().__init__() def register(self): pass def deregister(self): pass def load(self): pass def get(self): pass
register_data_registry()registers a class with the name passed in the argument,"montage"in this case.Inheriting from
BasePipelineDataRegistrytakes care of the class acting as a data registry.BasePipelineDataRegistry.register(),BasePipelineDataRegistry.deregister(),BasePipelineDataRegistry.load()andBasePipelineDataRegistry.get()need to be implemented (check other registries for reference implementations).
Pass
kind="montage"in*_datafunctions to verify if your data registry is set up properly.