Warning! This repo is under active development and can change without notice. Coming soon:
- updated models
- faster code for inference
- integration into FreeSurfer!
- Clone this repo and set it as your current working directory
git clone https://github.com/chiara-mauri/VesSynth.git
cd VesSynth
- Create and activate a conda environment:
- Option 1: Use the provided yaml file:
conda env create -f vessynth-env.yml (or for Mac: conda env create -f vessynth-env-macOS.yml)
conda activate vessynth-env
- Option 2: Create the environment and manually install the required packages:
conda create -n vessynth-env python=3.10
conda activate vessynth-env
pip install cornucopia
pip install pandas==2.3.3 tensorstore==0.1.78 boto3
Download the 'models' folder from https://ftp.nmr.mgh.harvard.edu/pub/dist/lcnpublic/dist/VesSynth/ unzip it and copy it in this repo
Now you can use the method with:
python path/to/repo/vessynth_test.py -i <vol> -o <outputDir> -mod <modality> [-th <threshold> -m <mask_vol> -c <cutout> -nw]
where the required arguments are:
<vol>: input nifti volume to segment<outputDir>: output directory where segmentations are saved<modality>: modality/contrast of the input volume. Accepted values are- 'T2star': for exvivo MRI and all T2star-based contrasts (including SWI, QSM,...). Vessels can be both bright and dark. Mesoscopic resolution (100-400um)
- 'HiPCT': for Hierarchical Phase-Contrast Tomography. Dark vessels. Resolution ~ 20-30um
- 'OCT': for Optical Coherence Tomography. Dark vessels. Resolution ~ 20um
- 'TOF': for in vivo Time-Of-Flight Magnetic Resonance angiography. Bright vessels. Flexible resolution, from ~150um iso to 500um x 500um x 1mm
- 'fibers': for bright fiber bundles/axons across modalities (experimental)
- 'pvs': for perivascular spaces (coming soon!)
optional arguments are:
<threshold>value used to threshold the 'vessel probablity' to obtain a hard segmentation. Default is 0.3.<mask_vol>a binary mask applied to the segmentation (e.g. 1 inside brain, 0 outside). Useful to remove noise outside brain. A whole-brain mask can be obtained with mri_synthstrip<cutout>a bounding box to identify ROI (-zc x1 x2 y1 y2 z1 z2)-nw,--no_weightsdo NOT use Gaussian weights when computing segmentation on a patch
Synthetic data for training VesSynth (vessels and intensity images) have been generated using synthspline
