CoolFace
Apppublic

TobiasPitters/bids-neuroimaging

sourceHugging Facecc-by-4.0updated 10mo agoView on Hugging Face
2likes
App README

BIDS Neuroimaging Viewer

A FastAPI-based web application for visualizing neuroimaging data in BIDS format using NiiVue.

Installation

  1. 1.Clone the repository:
bash
git clone <your-repo-url>
cd bids-neuroimaging
  1. 1.Create a virtual environment and install dependencies:
bash
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install -r requirements.txt
  1. 1.Install the custom datasets fork with BIDS loader:
bash
pip install git+https://github.com/The-Obstacle-Is-The-Way/datasets.git@feat/bids-loader

Running the Application

Start the FastAPI server with:

bash
fastapi dev main.py

Or using uvicorn directly:

bash
uvicorn main:app --reload --host 0.0.0.0 --port 8000

Then open your browser and navigate to:

  • Main viewer: http://localhost:8000
  • Health check: http://localhost:8000/health

Features

  • Interactive 3D visualization of NIfTI files using NiiVue
  • Multiple viewing modes: Multiplanar + 3D, and 3D Render Only
  • Next button to iterate through dataset samples (implement the /next endpoint)

Development

The main application is in main.py. To implement the "Next" functionality:

  1. 1.Modify the /next endpoint in main.py to load and return the next sample
  2. 2.The endpoint should return a JSON with the base64-encoded NIfTI data

Configuration Reference

For Hugging Face Spaces deployment, check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference