---
title: mne_setup_mri
sidebar_label: mne_setup_mri
sidebar_position: 5
---

# mne_setup_mri

## Overview

`mne_setup_mri` sets up FreeSurfer MRI data for MNE software by creating the Neuromag directory structure and converting FreeSurfer MRI volumes (COR files or `.mgz`/`.mgh`) into `COR.fif` FIFF files.

This is a C++ port of the original MNE-C tools `mne_setup_mri` and `mne_make_cor_set` by Matti Hämäläinen.

## Usage

```bash
mne_setup_mri [options]
```

## Options

| Option | Description |
|---|---|
| `--subject <name>` | Subject name. Defaults to `SUBJECT` environment variable. |
| `--subjects-dir <dir>` | Subjects directory. Defaults to `SUBJECTS_DIR` environment variable. |
| `--mri <name>` | MRI set name to process (can be specified multiple times; default: T1 brain) |
| `--overwrite` | Overwrite existing data |
| `--verbose` | Verbose output |

## Description

`mne_setup_mri` prepares FreeSurfer MRI data for use with MNE tools. It performs the following steps:

1. Creates the required Neuromag-style directory structure within the subject's FreeSurfer directory
2. Converts FreeSurfer MRI volumes (in COR or MGZ format) to FIFF format (`COR.fif`)
3. Sets up the coordinate transformations needed for MNE processing

This step should be performed after the FreeSurfer cortical reconstruction is complete and before computing the forward solution.

## Example

```bash
export SUBJECTS_DIR=/path/to/subjects
mne_setup_mri --subject sample --overwrite --verbose
```

Process a specific MRI set:

```bash
mne_setup_mri --subject sample --mri T1 --overwrite
```
