External Email - Use Caution Dear Malte,
I am currently utilizing the Docker version of SynthMorph 2 for MNI space normalization and have encountered a technical issue I hope you can assist me with. Below, I have detailed the command line used in my attempt: (GBM) chang@chang-System-Product-Name:~/projects$ synthmorph -t post_004_M_to_F.lta -T post_004_F_to_M.lta -o post_004_syn_MNI.nii.gz -O post_004_syn_nat.nii.gz post_004_T1_nat_filled_synthsr.nii.gz wmni_icbm152_t1_tal_nlin_asym_09c_strip.nii I am operating SynthMorph version 2, which is sourced from Docker Hub under the FreeSurfer user. The Docker container is managed using /usr/bin/docker, and I have configured the /mnt directory in the image to bind to the SUBJECTS_DIR at /home/chang/projects. The command executed was as follows: Running SynthMorph version 2 from https://secure-web.cisco.com/1Y50YTxjgoN3UdzsNhDlXNbHmFHe5Kd4HWQ6MprgqaoItzhB7TZmJmrIoLkJKt3ZcnxvmxQUCnzv0Ap54dPOiDj2bMrNyNviTT7u-iprCKXdd11a7u1TumyNiecgn-kIF08bq2J7o7t0DbgWCOgcKVJJwLfzPInBor5l_Kfc5YYoNiW8lQHAAd3KGfsRAUHv0xLTgnUfOJGRhYceU2dsqu147IhG86SLsIwt89lx7FO9S6wCrvGMs8Ab1pnP-qbpXhfFTgbH075lCeO3du_1FzBvQFtzy2Mmodedib9_BbIRvaJnEcIYy4uZin-h-B_V0/https%3A%2F%2Fhub.docker.com%2Fu%2Ffreesurfer Using /usr/bin/docker to manage containers Will bind /mnt in image to SUBJECTS_DIR="/home/chang/projects" Command: docker run --rm -v /home/chang/projects:/mnt -t -u 1000:1000 freesurfer/synthmorph:2 SynthMorph arguments: -t post_004_M_to_F.lta -T post_004_F_to_M.lta -o post_004_syn_MNI.nii.gz -O post_004_syn_nat.nii.gz post_004_T1_nat_filled_synthsr.nii.gz wmni_icbm152_t1_tal_nlin_asym_09c_strip.nii Traceback (most recent call last): File "/freesurfer/mri_synthmorph", line 608, in <module> out.save(arg.trans) File "/freesurfer/env/lib/python3.11/site-packages/surfa/core/framed.py", line 279, in save save_framed_array(self, filename, fmt=fmt) File "/freesurfer/env/lib/python3.11/site-packages/surfa/io/framed.py", line 137, in save_framed_array raise ValueError(f'cannot determine file format from extension for {filename}') ValueError: cannot determine file format from extension for post_004_M_to_F.lta Upon changing the file format from .lta to .nii.gz, the command executed successfully. However, this adjustment presents a new challenge as I am unable to use mri_convert to apply the transformation to another NIfTI file. Could you provide any insights or suggestions on how to resolve these issues? Specifically, I need guidance on saving in the .lta format and applying transformations using mri_convert. Thank you in advance for your assistance. Best regards, -Edward 引述 "Hoffmann, Malte,PhD" <mhoffm...@mgh.harvard.edu>: > The displacement field stored will be the same, so I would say the > file format shouldn't really matter. Malte > > ________________________________________ > From: freesurfer-boun...@nmr.mgh.harvard.edu > <freesurfer-boun...@nmr.mgh.harvard.edu> on behalf of Antoine Royer > <antoine.ro...@usherbrooke.ca> > Sent: Saturday, May 4, 2024 15:06 > To: freesurfer@nmr.mgh.harvard.edu > Subject: Re: [Freesurfer] Understanding registration with mri_synthmorph > > External Email - Use Caution > > Thanks Malte! > > Would you recommend anything between saving deform transforms > generated from synthmorph, between .mgz or .nii.gz? Which in my > case, are expected to be passed onto mri_warp_convert for itk > conversion. I'm running numerous tests trying to find > dissimilarities between the two approach, trying to determine which > will be better for me. > > Any insight? > ________________________________ > De : freesurfer-boun...@nmr.mgh.harvard.edu > <freesurfer-boun...@nmr.mgh.harvard.edu> de la part de Antoine Royer > <antoine.ro...@usherbrooke.ca> > Envoyé : 20 avril 2024 13:52 > À : freesurfer@nmr.mgh.harvard.edu <freesurfer@nmr.mgh.harvard.edu> > Objet : Re: [Freesurfer] Understanding registration with mri_synthmorph > > > External Email - Use Caution > > Thank you very much!! > ________________________________ > De : freesurfer-boun...@nmr.mgh.harvard.edu > <freesurfer-boun...@nmr.mgh.harvard.edu> de la part de Hoffmann, > Malte,PhD <mhoffm...@mgh.harvard.edu> > Envoyé : 20 avril 2024 11:16 > À : freesurfer@nmr.mgh.harvard.edu <freesurfer@nmr.mgh.harvard.edu> > Objet : Re: [Freesurfer] Understanding registration with mri_synthmorph > > Hi Antoine, > > Thanks for reaching out. Unless you're using a dev build of > FreeSurfer, mri_synthmorph may lag behind the dockerized version, > which is likely why you see a different behavior. For affine > transforms, we switched to LTA format to track the source and target > spaces. SynthMorph now saves these with surfa, which insists on the > .lta suffix. > > Similarly, we recently added code to save warp files in .mgz format, > which is more similar to NIfTI and less clunky than .m3z (surfa > might not let you save warps with NIfTI extension just yet). Until > the next FS release, I would recommend using SynthMorph from the > Docker Hub. > > In any case, the warps store shifts in physical RAS space: your > `mri_warp_convert` call looks correct, and `antsApplyTransforms -v > -d 3 -i [moving] -r [fixed] -t ants_warp.nii.gz -o out.nii.gz` > should produce an image identical to "warped.nii.gz". > > Malte > > ________________________________________ > From: freesurfer-boun...@nmr.mgh.harvard.edu > <freesurfer-boun...@nmr.mgh.harvard.edu> on behalf of Antoine Royer > <antoine.ro...@usherbrooke.ca> > Sent: Friday, April 19, 2024 16:08 > To: freesurfer@nmr.mgh.harvard.edu > Subject: [Freesurfer] Understanding registration with mri_synthmorph > > External Email - Use Caution > > Hi all! > > I am working on implementing some freesurfer synth tools into a > larger diffusion processing pipeline. Doing so, I would like to use > mri_synthmorph to generate a transform and then pass it downstream. > FIrstly, I use the dockerized synthmorph version, which seems to > present discrepancies in its behaviour vs local testing: > > > 1. > Can someone explain the expected output format of freesurfer > transforms? When used within docker, I must define affine transforms > as .lta and deform transforms as .mgz, otherwise: "ValueError: > cannot determine file format from extension for > test__init_warp.txt"; while when using mri_synthform from my local > freesurfer installation, it doesn't seem like an issue. While I > expected .m3z to be the expected output. > 2. > Here is the sequence of functions I use. My objective is to pass > down the resulting transform (affine initialization + deform warp) > downstream my pipeline for further registration using ANTs > (antsApplyTransforms). I tested and it seems to work, but i would > appreciate an opinion. Does the --insrcgeom parameter fixes > everything for me? > > * > Initialization + registration (freesurfer): > * > mri_synthmorph -m affine -t <init.lta> [moving] [fixed] > > mri_synthmorph -m deform -t <freesurfer_warp.mgz> -o <warped.nii.gz> > -i <init.txt> [moving] [fixed] > > Convert warp from freesurfer (RAS) to ANTs (LPS) using freesurfer > warp_convert: > mri_warp_convert -g [moving] --inras <freesurfer_warp.mgz> --outlps > <ants_warp.nii.gz> > > > Thank you very much! > > > _______________________________________________ > Freesurfer mailing list > Freesurfer@nmr.mgh.harvard.edu > MailScanner has detected a possible fraud attempt from > "secure-web.cisco.com" claiming to be > https://secure-web.cisco.com/1KgdeEu7k5JaxFBG5Skz6P20V5tKrNdD7ZWWBmuUmrT40q-UNYv13wbn7KI7bokcn6S9gvTphDc8uXZ1ppciIdgEXJQYYdeDYK4N_7wnvCMem5wuSGWi2jgRIHVlTaPROQoeBbXNNuqSRfzVxgmEnfuTbrsBrdCGyDo5j5UohcFd3gB9eOv78IqwTOkqidOhoDKl-VVb3UQxKOb_VVAPrjZbs3UYmLQLoRU-3LY7o7AX2UGMRfrZ0AEFlhvNmyON5Cs0EXHLfpQU9kLHCFsumgXrYBKbpBMkTL5u36bJSA6VQnT-A8kSmr4E5W7Ny67nm/https%3A%2F%2Fmail.nmr.mgh.harvard.edu%2Fmailman%2Flistinfo%2Ffreesurfer<https://secure-web.cisco.com/1OQU9vH_idsDikSqsIQp3rvxNk3RbXt4f2FlAcI1uxrntRhoUfsnj8ydRuoO1HYiyNrgyHjJZMDFn9UQKJgs14VbbkE1IdIr1HklSzzh536svO94SzeFVEnMb0bZf2A5JwPx_jmXihUG8tbMeOvPfJxBky0FAU0Zv1B_wysx8L7t4LP1Yw53mqhQPVY_OcHP1aYYlysg--NpRpitu_OCypFgyotRyaatoZ0D96kwbVn46wZOrTNHXkRrv5vax79C4NMPhCh8MMYkAkohoHZ-UbqDt1tCH9DJBYWMCp_hwZhtthogmwmlBF0Dh5kHZHBqOZBkG9VYBTSLQtDB90VLL3Q/https%3A%2F%2Fmail.nmr.mgh.harvard.edu%2Fmailman%2Flistinfo%2Ffreesurfer> > 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://secure-web.cisco.com/100tBluS9xJcFiJ197YHQ33n3do_jBMGhoZMVeNukNKJ9BjUuXJdA8z2US9G-JC3go8zk10kcefQEfCUiOBScFKkx_iEiMRYDqBngI1zEu74mXkj4Q7YlmSU6LVcRIXmwLOcKy7KoCrKcW33eLTljEpiWaiu351YNhOzwQJdlH8l-LocvJ0s_YuvI5E77_Oiuc44rWzsP7JNEYfa8QetnEFOXBttR5nN0B5vxXGHNhGsxwKKJa8GwyH2zpzokE4JSWir0Dz8f4bHjHQPrMpOu9PYUZYy_DJbsL3dk_ukcR4gHfPDoUqoZHckQQcCPRv1k/https%3A%2F%2Fwww.massgeneralbrigham.org%2Fcomplianceline<https://secure-web.cisco.com/10m3QHEHQCwnuFw9xDinBnrLfdgRnvf9HjySVii6r93sqQMyJ28naFGPgDmg2bYynaBvLeQYORZBQgZhIDWZveFi6khhiKiToPVj0tiaS3rxsNB7ZMNu8KfI16ZCYD-iqIzacbctVWZD81YN343QwKYED6fEF8gOLKnO0ZHnH7eC9TjI3Q85xyjFuGLvOi9OJd_Wcc1J_VQxbQgKoJxfBaG0xdp5QglhldDKhkoUZCpAjP9Xp8F_bDH_43_wfwsKVlfl6RqZCxTAxEzlrwa5Mq89nwLsX23CxVEPZ_INXbYMgBVTdXTBxDODrLQv6qea3wei6aL-Qbqbo3QS_hf1mEg/https%3A%2F%2Fwww.massgeneralbrigham.org%2Fcomplianceline> > <MailScanner has detected a possible fraud attempt from > "secure-web.cisco.com" claiming to be > https://secure-web.cisco.com/100tBluS9xJcFiJ197YHQ33n3do_jBMGhoZMVeNukNKJ9BjUuXJdA8z2US9G-JC3go8zk10kcefQEfCUiOBScFKkx_iEiMRYDqBngI1zEu74mXkj4Q7YlmSU6LVcRIXmwLOcKy7KoCrKcW33eLTljEpiWaiu351YNhOzwQJdlH8l-LocvJ0s_YuvI5E77_Oiuc44rWzsP7JNEYfa8QetnEFOXBttR5nN0B5vxXGHNhGsxwKKJa8GwyH2zpzokE4JSWir0Dz8f4bHjHQPrMpOu9PYUZYy_DJbsL3dk_ukcR4gHfPDoUqoZHckQQcCPRv1k/https%3A%2F%2Fwww.massgeneralbrigham.org%2Fcomplianceline<https://secure-web.cisco.com/10m3QHEHQCwnuFw9xDinBnrLfdgRnvf9HjySVii6r93sqQMyJ28naFGPgDmg2bYynaBvLeQYORZBQgZhIDWZveFi6khhiKiToPVj0tiaS3rxsNB7ZMNu8KfI16ZCYD-iqIzacbctVWZD81YN343QwKYED6fEF8gOLKnO0ZHnH7eC9TjI3Q85xyjFuGLvOi9OJd_Wcc1J_VQxbQgKoJxfBaG0xdp5QglhldDKhkoUZCpAjP9Xp8F_bDH_43_wfwsKVlfl6RqZCxTAxEzlrwa5Mq89nwLsX23CxVEPZ_INXbYMgBVTdXTBxDODrLQv6qea3wei6aL-Qbqbo3QS_hf1mEg/https%3A%2F%2Fwww.massgeneralbrigham.org%2Fcomplianceline>> > > . > 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. > > > _______________________________________________ > Freesurfer mailing list > Freesurfer@nmr.mgh.harvard.edu > https://secure-web.cisco.com/1KgdeEu7k5JaxFBG5Skz6P20V5tKrNdD7ZWWBmuUmrT40q-UNYv13wbn7KI7bokcn6S9gvTphDc8uXZ1ppciIdgEXJQYYdeDYK4N_7wnvCMem5wuSGWi2jgRIHVlTaPROQoeBbXNNuqSRfzVxgmEnfuTbrsBrdCGyDo5j5UohcFd3gB9eOv78IqwTOkqidOhoDKl-VVb3UQxKOb_VVAPrjZbs3UYmLQLoRU-3LY7o7AX2UGMRfrZ0AEFlhvNmyON5Cs0EXHLfpQU9kLHCFsumgXrYBKbpBMkTL5u36bJSA6VQnT-A8kSmr4E5W7Ny67nm/https%3A%2F%2Fmail.nmr.mgh.harvard.edu%2Fmailman%2Flistinfo%2Ffreesurfer > 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://secure-web.cisco.com/100tBluS9xJcFiJ197YHQ33n3do_jBMGhoZMVeNukNKJ9BjUuXJdA8z2US9G-JC3go8zk10kcefQEfCUiOBScFKkx_iEiMRYDqBngI1zEu74mXkj4Q7YlmSU6LVcRIXmwLOcKy7KoCrKcW33eLTljEpiWaiu351YNhOzwQJdlH8l-LocvJ0s_YuvI5E77_Oiuc44rWzsP7JNEYfa8QetnEFOXBttR5nN0B5vxXGHNhGsxwKKJa8GwyH2zpzokE4JSWir0Dz8f4bHjHQPrMpOu9PYUZYy_DJbsL3dk_ukcR4gHfPDoUqoZHckQQcCPRv1k/https%3A%2F%2Fwww.massgeneralbrigham.org%2Fcomplianceline > > <https://secure-web.cisco.com/100tBluS9xJcFiJ197YHQ33n3do_jBMGhoZMVeNukNKJ9BjUuXJdA8z2US9G-JC3go8zk10kcefQEfCUiOBScFKkx_iEiMRYDqBngI1zEu74mXkj4Q7YlmSU6LVcRIXmwLOcKy7KoCrKcW33eLTljEpiWaiu351YNhOzwQJdlH8l-LocvJ0s_YuvI5E77_Oiuc44rWzsP7JNEYfa8QetnEFOXBttR5nN0B5vxXGHNhGsxwKKJa8GwyH2zpzokE4JSWir0Dz8f4bHjHQPrMpOu9PYUZYy_DJbsL3dk_ukcR4gHfPDoUqoZHckQQcCPRv1k/https%3A%2F%2Fwww.massgeneralbrigham.org%2Fcomplianceline> > . > 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. > > _______________________________________________ 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.