Metadata-Version: 2.1
Name: mosaic-dataset
Version: 0.0.1
Summary: A scalable framework for fMRI dataset aggregation and modeling of human vision
Home-page: https://github.com/murtylab/mosaic-dataset
Author: Benjamin Lahner, Mayukh Deb, N. Apurva Ratan Murty, Aude Oliva
Author-email: blahner@mit.edu; mayukh@gatech.edu; ratan@gatech.edu; oliva@mit.edu
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
Requires-Dist: hcp-utils
Requires-Dist: numpy
Requires-Dist: h5py
Requires-Dist: nilearn

# mosaic-dataset

Load the mosaic dataset (Lahner et al.) and the associated pre-trained models

```bash
pip install mosaic-dataset
```

```python
import mosaic

dataset = mosaic.load(
    names_and_subjects={
        "nsd": [2,3],
        "deep_recon": "all",
    },
    folder="/research/datasets/mosaic-dataset" 
)

print(dataset[0])
```

Visualization

```python
import mosaic
from mosaic.utils import visualize
from IPython.display import IFrame

dataset = mosaic.load(
    names_and_subjects={
        "bold_moments": [1],
    },
    folder="/research/datasets/mosaic-dataset" 
)

visualize(
    betas=dataset[0]["betas"],
    ## set rois to None if you want to visualize all of the rois
    rois=[
        "L_FFC",
        "R_FFC",
    ],
    ## other modes are: 'white', 'midthickness', 'pial', 'inflated', 'very_inflated', 'flat', 'sphere'
    mode = "midthickness",
    save_as = "plot.html",
)
```
Loading pre-trained models

```python
import mosaic

model = mosaic.from_pretrained(
    backbone_name="resnet18",
    vertices="visual",
    framework="multihead",
    subjects="all"
)
```

Running inference with pre-trained models:

```python
from mosaic.utils.inference import MosaicInference
from PIL import Image

inference = MosaicInference(
    model=model,
    batch_size=32,
    device="cuda:0"
)

results = inference.run(
    images = [
        Image.open("cat.jpg"),
        Image.open("cat.jpg")
    ]
)

## (2, num_voxels)
print(results.shape)
```

Dev Setup

```bash
pip install git+https://github.com/Mayukhdeb/mosaic-dataset.git
cd mosaic-dataset
python setup.py develop
```
