I want to convert a transformation matrix with freesurfer's lta-convert. If I run the following command in my bash-shell (echo $0 shows -bash)
lta_convert -inlta input.lta --outfsl output.mat
it runs without problem:
$Id: lta_convert.cpp,v 1.9.2.1 2016/08/09 02:33:22 zkaufman Exp $
--inlta: input.lta input LTA transform.
--outfsl: output.mat output FSL matrix.
LTA read, type : 1
0.93123 0.02020 0.00726 -12.56508;
-0.00133 0.92407 0.00102 -2.41168;
0.00007 0.02780 1.00388 21.38016;
0.00000 0.00000 0.00000 1.00000;
FSLOUTPUTTYPE NIFTI_GZ
tkreg2FSL: mov det = 8, ref det = 1
INFO: FSL2FreeSurfer: Mov volume is NIFTI with positive det,
applying LR flip to registration matrix.
INFO: FSL2FreeSurfer: Ref volume is NIFTI with positive det,
applying LR flip to registration matrix.
lta_convert successful.`
But if I try to run the same command in a shell script containing the following two lines:
#!/bin/bash
lta_convert -inlta input.lta --outfsl output.mat
it throws me an error.
$Id: lta_convert.cpp,v 1.9.2.1 2016/08/09 02:33:22 zkaufman Exp $
dyld: lazy symbol binding failed: Symbol not found: ___emutls_get_address
Referenced from: /Applications/freesurfer/bin/../lib/gcc/lib/libgomp.1.dylib
Expected in: /usr/lib/libSystem.B.dylib
dyld: Symbol not found: ___emutls_get_address
Referenced from: /Applications/freesurfer/bin/../lib/gcc/lib/libgomp.1.dylib
Expected in: /usr/lib/libSystem.B.dylib
./test.sh: line 3: 91440 Abort trap: 6 lta_convert -inlta input.lta --outfsl output.mat
Why does this happen and how can I resolve this? Other freesurfer commands like mri_robust_register run from the shell without problems. I am running the script on Mac OS 10.12.4.
The issue you're having probably has to do with the environment variable DYLD_LIBRARY_PATH
not being propagated because of System Integrity protection. The work around in your case is checking what is the value of DYLD_LIBRARY_PATH
and LD_LIBRARY_PATH
when freesurfer
works and setting those variables in your bash script before running it.
There is more info in the following question: Why Isn't DYLD_LIBRARY_PATH being propagated here?
Found the solution. Add a line to the script so that it shows:
#!/bin/bash
source $FREESURFER_HOME/SetUpFreeSurfer.sh
lta_convert -inlta input.lta --outfsl output.mat
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.