from nipype.interfaces.dcm2nii import Dcm2niix
def convert_dcm_2_nii_x(dcm_folder, output_folder):
converter = Dcm2niix()
converter.inputs.source_dir = dcm_folder
converter.inputs.output_dir = output_folder
converter.inputs.compress = 'i'
converter.run()