Calling TORTOISE modules from Python

Submitted by tecork on Sun, 10/03/2021 - 20:01


I have had TORTOISE for a while now and was interested in incorporating the modules into my workflow. I am on MacOS Catalina (Version 10.15.7). and using python 3. I can run the following command from the terminal just fine:

ImportNIFTI -i /Users/Tyler/Vol_1_LR.nii -b /Users/Tyler/Vol_1_LR.bval -v /Users/Tyler/Vol_1_LR.bvec -p vertical

However, when I run it using subprocess in Python 3, like the following:

>>> import subprocess

>>> cmd = 'ImportNIFTI -i /Users/Tyler/Vol_1_LR.nii -b /Users/Tyler/Vol_1_LR.bval -v /Users/Tyler/Vol_1_LR.bvec -p vertical'

>>> list_files = subprocess.run(cmd, shell=True)

I received the following error:

dyld: Library not loaded: /usr/local/opt/llvm/lib/libomp.dylib

Referenced from: /Users/Tyler/TORTOISE_V3.2.0/DIFFPREPV320/bin/bin/ImportNIFTI

Reason: image not found

I suspect the issue is similar, if not the same as the post regarding MATLAB. My intuition was to try getting it to run through MATLAB and that should also fix the python problem if the .bash_profile was updated. 

Using the current setting and a clean install of TORTOISE, these are the paths I currently have in my .bash_profile:

export PATH=/Users/Tyler/TORTOISE_V3.2.0/DIFFPREPV320/bin/bin:$PATH


export PATH=/Users/Tyler/TORTOISE_V3.2.0/DRBUDDIV320/bin:$PATH

export PATH=/Users/Tyler/TORTOISE_V3.2.0/DRTAMASV320/bin:$PATH


Thank you for your help!


Tyler Cork