External Email - Use Caution        

Thank you so much yujing, it worked. 


Il giorno lun 10 mar 2025 alle 14:24 Huang, Yujing <YHUANG43@mgh.harvard.edu> ha scritto:

I have attached SamsegLongitudinal.py to fix the python error. Copy it to /Applications/freesurfer/8.0.0/python/packages/gems/SamsegLongitudinal.py

 

Yujing

 

From: freesurfer-bounces@nmr.mgh.harvard.edu <freesurfer-bounces@nmr.mgh.harvard.edu> On Behalf Of Paola Di Filippo
Sent: Sunday, March 9, 2025 8:28 AM
To: freesurfer@nmr.mgh.harvard.edu
Subject: [Freesurfer] Longitudinal samseg not working - TypeError: transform() got an unexpected keyword argument 'affine'

 

        External Email - Use Caution        

Hi everyone, I am trying to launch longitudinal samseg with the lesion flag for an MS subject, in Freesurfer 8.0. I followed instructions, cross sectional samseg for the same subject at T0 worked fine, but now I am having troubles, described as follows:

 

MBP-di-Paola:~ paoladifilippo$ export FS_LICENSE=$HOME/license.txt

MBP-di-Paola:~ paoladifilippo$ export FREESURFER_HOME=/Applications/freesurfer/8.0.0

MBP-di-Paola:~ paoladifilippo$ source $FREESURFER_HOME/SetUpFreeSurfer.sh

-------- freesurfer-macOS-darwin_arm64-8.0.0-20250205-0f2bd3a --------

Setting up environment for FreeSurfer/FS-FAST (and FSL)

FREESURFER_HOME   /Applications/freesurfer/8.0.0

FSFAST_HOME       /Applications/freesurfer/8.0.0/fsfast

FSF_OUTPUT_FORMAT nii.gz

SUBJECTS_DIR      /Applications/freesurfer/8.0.0/subjects

MNI_DIR           /Applications/freesurfer/8.0.0/mni

MBP-di-Paola:~ paoladifilippo$ export LD_LIBRARY_PATH=$FREESURFER_HOME/MCRv97/runtime/maci64:$FREESURFER_HOME/MCRv97/bin/maci64:$FREESURFER_HOME/MCRv97/sys/os/maci64:$FREESURFER_HOME/MCRv97/extern/bin/maci64

MBP-di-Paola:~ paoladifilippo$ cd /Users/paoladifilippo/RM.OCT.NFL/A.C/LONGITUDINAL.SAMSEG

MBP-di-Paola:LONGITUDINAL.SAMSEG paoladifilippo$ run_samseg_long --timepoint A.C.2.4.91.MRI.12.9.22_t1_reg.mgz A.C.2.4.91.MRI.12.9.22_flair_reg.mgz --timepoint A.C.2.4.91.MRI.13.2.23_t1_reg.mgz A.C.2.4.91.MRI.13.2.23_flair_reg.mgz --timepoint A.C.2.4.91.MRI.20.09.23_t1_reg.mgz A.C.2.4.91.MRI.20.09.23_flair_reg.mgz --pallidum-separate --lesion --lesion-mask-pattern 0 1 --output /Users/paoladifilippo/RM.OCT.NFL/A.C/LONG.SAMSEG.OUTPUT/

Assuming an identity transformation between base and each time point

WARNING:tensorflow:From /Applications/freesurfer/8.0.0/python/miniconda3_apple_dist/py3_8_13/lib/python3.8/site-packages/tensorflow/python/compat/v2_compat.py:107: disable_resource_variables (from tensorflow.python.ops.variable_scope) is deprecated and will be removed in a future version.

Instructions for updating:

non-resource variables are not supported in the long term

Traceback (most recent call last):

  File "/Applications/freesurfer/8.0.0/python/scripts/run_samseg_long", line 209, in <module>

    samsegLongitudinal.segment(saveWarp=args.save_warp, initTransformFile=args.init_reg)

  File "/Applications/freesurfer/8.0.0/python/packages/gems/SamsegLongitudinal.py", line 181, in segment

    self.constructAndRegisterSubjectSpecificTemplate(initTransformFile)

  File "/Applications/freesurfer/8.0.0/python/packages/gems/SamsegLongitudinal.py", line 200, in constructAndRegisterSubjectSpecificTemplate

    self.sstFileNames = self.generateSubjectSpecificTemplate()

  File "/Applications/freesurfer/8.0.0/python/packages/gems/SamsegLongitudinal.py", line 835, in generateSubjectSpecificTemplate

    imageBuffer = image0.transform(affine=self.tpToBaseTransforms[0])

TypeError: transform() got an unexpected keyword argument 'affine'





I am working on Apple M4 Pro with 48 GB RAM, MacOS 15.2. Any ideas on how to fix this? Thanks in advance


_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
MailScanner has detected a possible fraud attempt from "secure-web.cisco.com" claiming to be 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 MailScanner has detected a possible fraud attempt from "secure-web.cisco.com" claiming to be https://www.massgeneralbrigham.org/complianceline <MailScanner has detected a possible fraud attempt from "secure-web.cisco.com" claiming to be 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.