Hi Randy, As Koen mentioned, FS support for ushort file types wasn’t added until recently. I just extended that support to the python (samseg) tools yesterday, so this should work in the most recent development (nightly) freesurfer distributions. You could install that, or you could convert your input image to a supported type, like uint8, int, or float.
Best, Andrew From: freesurfer-boun...@nmr.mgh.harvard.edu <freesurfer-boun...@nmr.mgh.harvard.edu> on behalf of Koen Van Leemput <leem...@gmail.com> Date: Wednesday, March 9, 2022 at 12:44 PM To: daedalu...@aol.com <daedalu...@aol.com> Cc: freesurfer@nmr.mgh.harvard.edu <freesurfer@nmr.mgh.harvard.edu> Subject: Re: [Freesurfer] run_samseg output folder permissions error External Email - Use Caution This seems to have something to do with the image read/write tools in FS's Python tools not being able to handle ushort pixel types. One way around this would be to convert the input image into e.g., floats before calling samseg, but for a real fix in the code I'm looking at Andrew... (?) On Wednesday, March 9, 2022, <daedalu...@aol.com<mailto:daedalu...@aol.com>> wrote: Thank you Koen, Your suggestion allowed run_samseg to run for a few minutes, but... daedalus@DESKTOP-TILLA3B:/usr/local/freesurfer/7-dev/subjects$ run_samseg --input o_ADNI_002_S_4654__MRI-m072.nii --output T1-only ##---------------------------------------------- Samsegment Options ##---------------------------------------------- output directory: T1-only input images: o_ADNI_002_S_4654__MRI-m072.nii modelSpecifications: {'FreeSurferLabels': [0, 165, 258, ... ........ process ran for an additional few minutes and then crashed with the following statements (Any Thoughts?) .......... maximalDeformation=0.0750 minLogLikelihood=-0.8762 maximalDeformation=0.0000 minLogLikelihood=-0.8762 appliedScaling: 1.0021 INFO: This is an unsigined short. Traceback (most recent call last): File "/usr/local/freesurfer/7-dev/python/scripts/run_samseg", line 179, in <module> reg_only=args.reg_only File "/usr/local/freesurfer/7-dev/python/packages/freesurfer/samseg/Samseg.py", line 252, in segment initTransform=initTransform File "/usr/local/freesurfer/7-dev/python/packages/freesurfer/samseg/Samseg.py", line 271, in register initTransform=initTransform File "/usr/local/freesurfer/7-dev/python/packages/freesurfer/samseg/Affine.py", line 72, in registerAtlas self.saveResults( savePath, worldToWorldTransformMatrix, imageToImageTransformMatrix ) File "/usr/local/freesurfer/7-dev/python/packages/freesurfer/samseg/Affine.py", line 473, in saveResults inputImage = fs.Volume.read(self.imageFileName) File "/usr/local/freesurfer/7-dev/python/packages/freesurfer/ndarray.py", line 103, in read result = bindings.vol.read(filename) ValueError: unknown MRI data type ID: 10 daedalus@DESKTOP-TILLA3B:/usr/local/freesurfer/7-dev/subjects$ The image that I am trying to test with this process is a standard T1-weighted image from ADNI, and Freesurfer had been able to run the basic segmentation (-recon-all, took about four hours and ran to completion without errors), so I'm not sure why Samseg can't identify the "MRI data type". Thanks in advance for any insights you might be able to share. -Randy -----Original Message----- From: Koen Van Leemput <leem...@gmail.com<mailto:leem...@gmail.com>> To: daedalu...@aol.com<mailto:daedalu...@aol.com> <daedalu...@aol.com<mailto:daedalu...@aol.com>>; Freesurfer support list <freesurfer@nmr.mgh.harvard.edu<mailto:freesurfer@nmr.mgh.harvard.edu>> Sent: Tue, Mar 8, 2022 11:18 pm Subject: Re: [Freesurfer] run_samseg output folder permissions error It looks like you have an extra slash in front of the output file name, so you're trying to write in the root directory... On Tuesday, March 8, 2022, <daedalu...@aol.com<mailto:daedalu...@aol.com>> wrote: External Email - Use Caution Dear experts, Having installed Freesurfer on WSL2, I was able to get the basic FS segmentation to run without error. However, when I tried to run_samseg on a single T1 image, I received the following error message (permissions denied creating the "output folder") Is there anything in the trace (below) that provides a clue? daedalus@DESKTOP-TILLA3B:/usr/ local/freesurfer/7-dev/ subjects$ run_samseg --input o_ADNI_002_S_4654__MRI-m072. nii --output /T1-only -samsegOutput/ Traceback (most recent call last): File "/usr/local/freesurfer/7-dev/ python/scripts/run_samseg", line 67, in <module> os.makedirs(args. outputDirectory, exist_ok=True) File "/usr/local/freesurfer/7-dev/ python/lib/python3.6/os.py", line 220, in makedirs mkdir(name, mode) PermissionError: [Errno 13] Permission denied: '/T1-only-samsegOutput/'
_______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Mass General Brigham Compliance HelpLine at https://www.massgeneralbrigham.org/complianceline <https://www.massgeneralbrigham.org/complianceline> . Please note that this e-mail is not secure (encrypted). If you do not wish to continue communication over unencrypted e-mail, please notify the sender of this message immediately. Continuing to send or respond to e-mail after receiving this message means you understand and accept this risk and wish to continue to communicate over unencrypted e-mail.