Skip to content

Error when running mri_convert from pycham #3580

Open
@MattP1994

Description

@MattP1994

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    faqIssues that are candidates for a FAQ

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions