Dwifslpreproc after SynB0 results in error (unhandled python exception)

Dear MRtrix users

I’m trying to use SynB0 and the updated version of dwifslpreproc (described here: Dwifslpreproc output is the same as input)

However, the command results in an error

dwifslpreproc: [ERROR] Unhandled Python exception:
dwifslpreproc: [ERROR] UnboundLocalError: local variable ‘applytopup_cmd’ referenced before assignment
dwifslpreproc: [ERROR] Traceback:
dwifslpreproc: [ERROR] /usr/local/bin/dwifslpreproc:893 (in execute())
dwifslpreproc: [ERROR] run.command(applytopup_cmd + ’ --imain=’ + input_path + ’ --datain=applytopup_config.txt --inindex=’ + str(index) + ’ --topup=field --out=’ + temp_path + ’ --method=jac’)

My command:

dwifslpreproc dwi_denoised_unringed.mif dwi_denoised_unringed_susc_corrected_preproc.mif -pe_dir AP -rpe_none -topup_files topup_fieldcoef.nii.gz

Could anybody give me a hint what the problem might be?

Thank you very much

Hi Hannes,

Moving my response to here from the original thread since it’ll be easier for others to find based on the title.

I’m trying to use SynB0 and the updated version of dwifslpreproc but the command results in an error

Looks like a glitch in the logical nightmare that is the dwifslpreproc code. Please let me know if the fix in #2266 works for you.

Cheers
Rob

Dear Rob

thank you very much for you reply and your work! It is highly appreciated. However, the updated code seems to result in a similar error

dwifslpreproc: [ERROR] Unhandled Python exception:
dwifslpreproc: [ERROR] UnboundLocalError: local variable ‘applytopup_cmd’ referenced before assignment
dwifslpreproc: [ERROR] Traceback:
dwifslpreproc: [ERROR] /usr/local/bin/dwifslpreproc:893 (in execute())
dwifslpreproc: [ERROR] run.command(applytopup_cmd + ’ --imain=’ + input_path + ’ --datain=applytopup_config.txt --inindex=’ + str(index) + ’ --topup=field --out=’ + temp_path + ’ --method=jac’)

Would be happy if you can provide any additional tipps or updates.

Thank you again

Hi Hannes,

The fact that the same error occurs and that it additionally references the same line of code means that most likely you are still executing the same version of dwifslpreperoc. Following the changes in #2266, invocation of FSL’s applytopup now occurs on line 903 of dwifslpreproc; but your error message still references line 893. So you need to look at how you’ve done this installation locally and how you’ve invoked the updated version of the script.

Rob

Of course you are right. I’m very sorry. Thank you for the hint.

The new version is running without problems. Thank you very much!