How gt-lit-lab/funroi works
Main Components
• Core Package – The funROI module (located in the “funROI” directory) is structured into several submodules:
• Analysis Module (funROI/analysis): Contains functions for effect estimation, generating fROIs (froi_gen), computing spatial correlation (spcorr), creating parcels (parcels_gen), and calculating spatial overlaps. These components form the algorithmic backbone processing the data.
• First-Level Processing Module (funROI/first_level): Provides functions for preliminary analysis steps via wrappers for nilearn and SPM, as well as utilities to manage first-level data processing.
• Datasets Module (funROI/datasets): Handles dataset-specific operations (e.g., reading HCP data) which are critical for adapting to different fMRI datasets.
• Other Supporting Modules: Scripts like contrast.py, froi.py, parcels.py, settings.py, and utility scripts (funROI/utils.py) complete the package by providing configuration and high-level API calls.
• Documentation – The “doc” directory includes Sphinx configuration, API documentation, examples (like demo.ipynb), and guides that further explain the design and usage of the toolbox. Although it is not part of the runtime architecture, documenting the system is essential for maintainability.
Relationships and Interactions
• Data Flow:
• Input fMRI data is first preprocessed using tools provided in the first_level module. Preprocessing results feed into higher-level analysis.
• The datasets module provides interfaces to load and format the fMRI data.
• Processed data is then handed off to the analysis module where parcel generation, fROI definition, effect estimation, spatial correlation, and overlap calculations occur.
• Utility and Configuration:
• The settings and utils modules are used across other components for common configurations and helper functions, ensuring consistency across the toolbox.
• External Dependencies:
Important Architectural Patterns and Design Principles
• Modular Design: The clear separation of functionality into data handling (datasets), preprocessing (first_level), and analysis (analysis) shows a modular approach. This makes it easy to update parts of the pipeline without affecting the rest.
• Reusability: The use of utility modules and settings ensures that common functions and configuration details are not duplicated.
• Pipeline Flow: The design follows a pipeline-like structure from data ingestion to final analysis, which is key for fMRI analysis workflows.
• Extensibility: The separation into distinct modules (e.g., multiple choices for first-level processing) hints at a pluggable architecture, allowing integration of additional processing methods if needed.