5ttgen: Note that this script makes use of commands / algorithms that have relevant articles for citation; INCLUDING FROM EXTERNAL SOFTWARE PACKAGES. Please consult the help page (-help option) for more information.
5ttgen:
5ttgen: Generated temporary directory: ./5ttgen-tmp-ROVGCQ/
Traceback (most recent call last):
File “C:/msys64/home/Administrator/mrtrix3/scripts/5ttgen”, line 46, in
runCommand('mrconvert ’ + getUserPath(lib.app.args.input, True) + ’ ’ + os.path.join(lib.app.tempDir, ‘input.mif’))
File “C:/msys64/home/Administrator/mrtrix3/scripts/lib/runCommand.py”, line 57, in runCommand
if not binary_sys or not os.path.samefile(binary_sys, binary_manual):
AttributeError: ‘module’ object has no attribute ‘samefile’
OK, looks like Windows does not support that particular function (os.path.samefile()) prior to Python version 3.2. We’ll have to achieve that functionality using some other method (it’s trying to verify that the MRtrix3 binaries that it’s running come from the same installation as the script you’re running). I’ll look into posting a fix.
In the meantime, you may find that running the same script using Python3 runs just fine.
Hi Rob,
Please help how to run the same script from python3. I don’t find any documentation of running script using python3
in mrtrix3.
Thanks for the support.
Sarbani
Hi @jdtournier,
I run the script from python3 as below:
$ python3 5ttgen fsl T1w_acpc_dc_restore_brain.nii.gz 5TT.mif -premasked
but got error :
5ttgen: Note that this script makes use of commands / algorithms that have relevant articles for citation; INCLUDING FROM EXTERNAL SOFTWARE PACKAGES. Please consult the help page (-help option) for more information.
5ttgen:
5ttgen: Generated temporary directory: /tmp/5ttgen-tmp-PDOGAU/
Command: mrconvert /home/Administrator/mrtrix3/scripts/T1w_acpc_dc_restore_brain.nii.gz /tmp/5ttgen-tmp-PDOGAU/input.mif
5ttgen: Changing to temporary directory (/tmp/5ttgen-tmp-PDOGAU/)
5ttgen: [ERROR] Script cannot run in FSL mode on Windows
5ttgen: Changing back to original directory (/home/Administrator/mrtrix3/scripts)
5ttgen: Deleting temporary directory /tmp/5ttgen-tmp-PDOGAU/
Then I try to execute the script without FSL as below:
$ python3 5ttgen T1w_acpc_dc_restore_brain.nii.gz 5TT.mif -premasked
and got error:
Error: invalid choice: ‘T1w_acpc_dc_restore_brain.nii.gz’ (choose from ‘freesurfer’, ‘fsl’)
Please help how should I proceed.
@rsmith Thanks for the reply. Do I need to download the msys package and run the .build again before executing the command, as it seems to me a fix in the msys package.
The line you provided here: python3 5ttgen T1w_acpc_dc_restore_brain.nii.gz 5TT.mif -premasked
does not specify which algorithm is to be used, which is expected as the first argument. Therefore, since the path to your input image is the first thing provided to the script, it reads that expecting to see the name of an algorithm; hence the error message: Error: invalid choice: 'T1w_acpc_dc_restore_brain.nii.gz' (choose from 'freesurfer', 'fsl')
Do I need to download the msys package and run the .build again before executing the command, as it seems to me a fix in the msys package.
No, this was purely a fix in the MRtrix3 script library. You should therefore only need to update MRtrix3 using: