Open MattP1994 opened 1 year ago
Your pycharm instance doesn't seem to be loading the same environment variables as your shell. I don't know anything about pycharm, but if you open it from your shell, that may be enough. Otherwise, there may be pycharm support that can help. Searching for PATH and subprocess launching could be a good start.
Goodmorning, I'm having troubles while running Freesurfer mri_convert command using PyCharm. Here's the code:
import os import dicom2nifti from nipype.interfaces.freesurfer import MRIConvert from nipype.interfaces.matlab import MatlabCommand
MatlabCommand.set_default_paths('/Applications/spm12') os.environ['FREESURFER_HOME'] = '/Applications/freesurfer/7.1.1/'
mriconv = MRIConvert() mriconv.inputs.in_file = INPUT FILE mriconv.inputs.out_file = OUTPUT FILE mriconv.inputs.out_type = 'mgz' mriconv.cmdline print(mriconv.cmdline) mriconv.run()
The error I'm obtaining is the following one: OSError: No command "mri_convert" found on host. Please check that the corresponding package is installed.
Whereas, when running the same command from the terminal: mri_convert --out_type mgz --input_volume INPUT FILE --output_volume OUTPUT FILE no error occurs (i.e. it manages to convert .nii file into .mgz correctly).
Can someone help?
Thanks in advance!