Metadata-Version: 2.4
Name: neurovlm
Version: 0.0.3
Summary: Neuro vision-language models.
Author-email: Ryan Hammonds <ryanphammonds@gmail.com>
License-Expression: Apache-2.0
License-File: LICENSE
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Requires-Python: <3.14,>=3.10
Requires-Dist: adapters
Requires-Dist: huggingface-hub
Requires-Dist: nibabel
Requires-Dist: nilearn
Requires-Dist: numpy
Requires-Dist: pandas
Requires-Dist: pyarrow
Requires-Dist: safetensors
Requires-Dist: torch
Requires-Dist: transformers
Provides-Extra: cogatlas
Requires-Dist: networkx; extra == 'cogatlas'
Provides-Extra: coords
Requires-Dist: nimare; extra == 'coords'
Provides-Extra: crawling
Requires-Dist: beautifulsoup4; extra == 'crawling'
Requires-Dist: requests; extra == 'crawling'
Requires-Dist: tqdm; extra == 'crawling'
Provides-Extra: docs
Requires-Dist: myst-nb<2,>=1.1; extra == 'docs'
Requires-Dist: myst-parser<4,>=2.0; extra == 'docs'
Requires-Dist: sphinx-book-theme<2,>=1.1; extra == 'docs'
Requires-Dist: sphinx-copybutton<1,>=0.5; extra == 'docs'
Requires-Dist: sphinx-design<1,>=0.6; extra == 'docs'
Requires-Dist: sphinx<9,>=7.2; extra == 'docs'
Provides-Extra: full
Requires-Dist: accelerate; extra == 'full'
Requires-Dist: beautifulsoup4; extra == 'full'
Requires-Dist: ipython; extra == 'full'
Requires-Dist: matplotlib; extra == 'full'
Requires-Dist: networkx; extra == 'full'
Requires-Dist: nimare; extra == 'full'
Requires-Dist: ollama; extra == 'full'
Requires-Dist: requests; extra == 'full'
Requires-Dist: scikit-image; extra == 'full'
Requires-Dist: scikit-learn; extra == 'full'
Requires-Dist: seaborn; extra == 'full'
Requires-Dist: tqdm; extra == 'full'
Provides-Extra: llm
Requires-Dist: accelerate; extra == 'llm'
Requires-Dist: ollama; extra == 'llm'
Provides-Extra: metrics
Requires-Dist: scikit-image; extra == 'metrics'
Requires-Dist: scikit-learn; extra == 'metrics'
Provides-Extra: notebook
Requires-Dist: ipython; extra == 'notebook'
Requires-Dist: jupyter; extra == 'notebook'
Requires-Dist: tqdm; extra == 'notebook'
Provides-Extra: viz
Requires-Dist: matplotlib; extra == 'viz'
Requires-Dist: seaborn; extra == 'viz'
Description-Content-Type: text/markdown

# NeuroVLM

NeuroVLM maps between neuroimaging activation maps and neuroscience text.

![model](https://github.com/neurovlm/neurovlm_data/blob/13dd7769f9603c036a9338b7da4adc2f3a03ec94/docs/model.png)

## Install

Minimal, inference-only installation:

```bash
pip install neurovlm
```

With optional dependencies needed to train and reproduce analyses:

```bash
pip install "neurovlm[full]"
```

## Quickstart

Fetch NeuroVLM's datasets:

```python
from neurovlm.data import fetch_data
fetch_data()
```

Use the `NeuroVLM` object for text-to-brain and brain-to-text:

```python
from neurovlm import NeuroVLM
from neurovlm.data import load_latent

# Text-to-brain: generation
nvlm = NeuroVLM()
result = nvlm.text(["vision", "default mode network"]).to_brain(head="mse")
result.to_nifti() # returns list of nib.Nifti1Image
result.plot(0, threshold=0.25) # plot image for vision
result.plot(1, threshold=0.15) # plot image for DMN

# Text-to-brain: ranking and retrieval
nvlm = NeuroVLM()
result = nvlm.text("motor").to_brain(head='infonce')
top = result.top_k(2) # each row pairs to a neuorimage that is similar to the text query
top.plot_row(1, threshold=0.1) # WashU atlas
top.plot_row(2, threshold=2.5) # NeuroVault
top.plot_row(4, threshold=0.1) # PubMed

# Brain-to-text: ranking and retrieval
nvlm = NeuroVLM()
result = nvlm.brain(load_latent("networks_neuro")["Du"]["AUD"]).to_text()
result.top_k(5).query("cosine_similarity > 0.4") # return up to 5 examples per dataset
```

## Documentation

See the [docs](https://neurovlm.github.io/neurovlm/) for the [API](https://neurovlm.github.io/neurovlm/api.html) and [tutorials](https://neurovlm.github.io/neurovlm/tutorials/index.html).

## License

Apache-2.0 (`LICENSE`).
