Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions mindeye/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,20 @@ If you are planning to run your own real-time MindEye scans, here are additional
1. [mindeye_task](https://github.com/PrincetonCompMemLab/mindeye_task): contains all materials required to run NSD-like tasks with PsychoPy
2. [mindeye_preproc](https://github.com/PrincetonCompMemLab/mindeye_preproc): contains materials used at Princeton for offline data preprocessing in preparation for the real-time session
3. [mindeye_offline](https://github.com/PrincetonCompMemLab/mindeye_offline): contains materials to fine-tune MindEye on offline-preprocessed data in preparation for the real-time session

### Reliability mask generation
Before fine-tuning or real-time deployment, generate a subject-specific reliability mask for the training sessions. Use `scripts/reliability_mask.py` to aggregate GLMsingle betas, exclude held-out MST images, and leverage every available repeat when estimating voxel reliability. Outputs default to the location defined by `data_path` in your `config.json`.

Example (`uv` environment activated):

```bash
uv run python mindeye/scripts/reliability_mask.py sub-005 ses-01 ses-02 --task C \
--quantile 0.85 --mask-img /path/to/3t/data/sub-005_final_mask.nii.gz
```

Key options:
- `--beta-pattern` lets you match the GLMsingle betas naming scheme if it differs from the default `{subject}_{session}_task-{task}_betas.npy`.
- `--threshold` or `--quantile` controls voxel selection per session before the union mask is formed.
- `--test-pattern` can be specified multiple times when you need to exclude additional held-out image sets.

The script writes per-session reliability arrays, per-session binary masks, and a union mask named `union_mask_from_ses-XX-YY.npy`. If you supply `--mask-img`, a 3D NIfTI version of the union mask is also produced for quality checks.
1 change: 1 addition & 0 deletions mindeye/docs/03-experiment_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Refer to the [mindeye_task](https://github.com/PrincetonCompMemLab/mindeye_task)
Refer to the [mindeye_preproc](https://github.com/PrincetonCompMemLab/mindeye_preproc/tree/main) repository for sample command-line snippets and scripts for preprocessing with fMRIPrep and GLMsingle on Princeton research clusters. This includes instructions on generating the subject-specific NSDgeneral mask and getting the betas to fine-tune MindEye.

Refer to the [mindeye_offline](https://github.com/PrincetonCompMemLab/mindeye_offline) repository for instructions on making the union mask from multiple sessions and fine-tuning MindEye based on that mask.
You can also generate the reliability and union masks directly within this repository using `scripts/reliability_mask.py`, which mirrors the conventions used by the real-time pipeline (excludes MST test images and averages across all repeats).

## Preparing for the real-time scan
We strongly recommend running a real-time test scan using a dummy such as an MRI phantom. Based on the connection between the MRI machine and your analysis computer, you may need to identify where newly streamed DICOM volumes are being sent, how to access them, and any scanner-specific naming schemes for these volumes.
Expand Down
Loading