This project processes standard MRI scan using FreeSurfer and extracts specific regions of interest (ROIs) from the MRI data. The extracted data includes volumes and centroids of various brain structures, which are then aggregated and normalized.
- FreeSurfer
- Python 3.x
- Required Python packages (see requirements.txt)
Follow the installation instructions on the FreeSurfer website: https://surfer.nmr.mgh.harvard.edu/fswiki/DownloadAndInstall.
Install the required Python packages:
pip install -r requirements.txt
To run the script, you need to provide the path to the MRI file, study ID, and age of the patient. The output will be saved in the studies_output directory and a summary CSV file will be generated.
python workflow.py --mri "/path/to/mri/file.nii" --id "study123" --age 60 --sex "M"
- --mri: Path to the MRI file (.nii format).
- --id: Study ID (any string).
- --age: Age of the patient (integer).
- --sex: Sex of the patient (M or F).
The script generates three output files:
- Raw results CSV: Contains volumes and centroids of various ROIs.
- Summary CSV: Aggregated and normalized results.
- 3d visualization HTML: Presents cloud points and their respective centroids.
- Ensure FreeSurfer is correctly installed and the FREESURFER_HOME environment variable is set.
- The script will run FreeSurfer's recon-all command, which might take several hours to complete depending on the MRI file size and system performance.
If you don't have a .nii file, install FreeSurfer and then run the command:
dcm2niix -o "/path/to/mri/" "/path/to/mri/"
You can install FreeSurfer on Linux, macOS, and Windows (using WSL: https://learn.microsoft.com/en-us/windows/wsl/about).
This project is licensed under the MIT License.