The idea would be to source 7.4.1 and then run:
fspython [location_of_FS_dev]/python/packages/WMHSynthSeg/inference.py [arguments]
Cheers,
/Eugenio
--
Juan Eugenio Iglesias
http://www.jeiglesias.com
From:
freesurfer-bounces@nmr.mgh.harvard.edu <freesurfer-bounces@nmr.mgh.harvard.edu> on behalf of Corinne Alison Donnay <corinne.donnay@linacre.ox.ac.uk>
Date: Wednesday, April 10, 2024 at 8:39 AM
To: Freesurfer support list <freesurfer@nmr.mgh.harvard.edu>
Subject: Re: [Freesurfer] WMH-SynthSeg - Torch module not found
External Email - Use Caution
Hi Eugenio,
Thanks for getting back to me – I had the newest version installed and still get the same error (pasted below).
mri_WMHsynthseg --i flair_ax.nii.gz --o flair_ax_WML.nii.gz --threads -1
Arguments seem correct; loading Python packages...
Traceback (most recent call last):
File "/usr/local/apps/freesurfer/dev-2024-04-19/python/packages/WMHSynthSeg/inference.py", line 284, in <module>
main()
File "/usr/local/apps/freesurfer/dev-2024-04-19/python/packages/WMHSynthSeg/inference.py", line 76, in main
import torch
ModuleNotFoundError: No module named 'torch'
I also installed FreeSurfer 7.4.1. Would you be able to expand on what you mean by “a way around this is installing FreeSurfer 7.4.1, and using its fspython to run the WMh-SynthSeg code”?
I loaded FreeSurfer 7.4.1, and then changed the location of the model in inference.py and tried using FreeSurfer 7.4.1 fspython but now its missing the
'unet3d' module:
[donnayca@cn4270 anat]$ module load freesurfer
[-] Unloading freesurfer 7.4.1 on cn4270
[+] Loading freesurfer 7.4.1 on cn4270
[donnayca@cn4270 anat]$ fspython ../inference_cd.py --i flair_ax.nii.gz --o flair_ax_WML.nii.gz
Arguments seem correct; loading Python packages...
Traceback (most recent call last):
File "../inference_cd.py", line 285, in <module>
main()
File "../inference_cd.py", line 79, in main
from unet3d.model import UNet3D
ModuleNotFoundError: No module named 'unet3d'
[donnayca@cn4270 anat]$ fspython
Python 3.8.13 (default, Apr 21 2022, 14:55:37)
[GCC 8.3.1 20190311 (Red Hat 8.3.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
Thank you!
Corinne
From:
<freesurfer-bounces@nmr.mgh.harvard.edu> on behalf of "Iglesias Gonzalez, Juan E." <JIGLESIASGONZALEZ@mgh.harvard.edu>
Reply-To: Freesurfer support list <freesurfer@nmr.mgh.harvard.edu>
Date: Saturday, April 6, 2024 at 1:04 PM
To: Freesurfer support list <freesurfer@nmr.mgh.harvard.edu>
Subject: Re: [Freesurfer] WMH-SynthSeg - Torch module not found
Wrong answer: apparently this has been fixed in the latest dev; maybe try that?
Cheers,
/Eugenio
--
Juan Eugenio Iglesias
http://www.jeiglesias.com
From:
freesurfer-bounces@nmr.mgh.harvard.edu <freesurfer-bounces@nmr.mgh.harvard.edu> on behalf of Iglesias Gonzalez, Juan E. <JIGLESIASGONZALEZ@mgh.harvard.edu>
Date: Friday, April 5, 2024 at 3:58 PM
To: Freesurfer support list <freesurfer@nmr.mgh.harvard.edu>
Subject: Re: [Freesurfer] WMH-SynthSeg - Torch module not found
Dear Corinne,
A bunch of libraries are currently broken in the development version; apologies for this. A way around this is installing FreeSurfer 7.4.1, and using its fspython to run the WMh-SynthSeg code. Apologies for
the inconvenience!
Cheers,
/E
PS: I just updated the wiki to include this information.
--
Juan Eugenio Iglesias
http://www.jeiglesias.com
From:
freesurfer-bounces@nmr.mgh.harvard.edu <freesurfer-bounces@nmr.mgh.harvard.edu> on behalf of Corinne Alison Donnay <corinne.donnay@linacre.ox.ac.uk>
Date: Friday, April 5, 2024 at 12:43 PM
To: freesurfer@nmr.mgh.harvard.edu <freesurfer@nmr.mgh.harvard.edu>
Subject: [Freesurfer] WMH-SynthSeg - Torch module not found
External Email - Use Caution
Good Afternoon!
I was working with my IT department to install the development version of FreeSurfer on our server so that I could use
WMH-SynthSeg.
IT installed development version 2024-04-14. After loading the freesurfer development module, and running
source $FREESURFER_HOME/SetUpFreeSurfer.sh, I still get the following error:

Is there any way to fix this or figure out what is wrong?
Thank you!
Corinne