Motion correction for dMRI

Hello SCT team.

I tried to calculate DTI metrics. When I run the motion correction step with

sct_dmri_moco -i diff06.nii.gz -m mask_diff06_dwi_mean.nii.gz -bvec bvecs.txt -qc ~/qc -qc-seg diff06_dwi_mean_seg.nii.gz

I got this error:

Estimating motion across groups…

Input parameters:
Input file … datasub-groups.nii
Reference file … datasub_0_mean.nii.gz
Polynomial degree … 2
Smoothing kernel … 1
Gradient step … 1
Metric … MI
Sampling … None
Todo … estimate_and_apply
Mask … mask.nii
Output mat folder … mat_groups

Data dimensions:
156 x 156 x 30 x 20

Copy file_target to a temporary file…

Register. Loop across Z (note: there is only one Z if orientation is axial)
Z=0/0: 5%|█▊ | 1/20 [00:08<02:37, 8.31s/iter]
Traceback (most recent call last):
File “/Users/hedi/sct_5.8/spinalcordtoolbox/scripts/”, line 226, in
File “/Users/hedi/sct_5.8/spinalcordtoolbox/scripts/”, line 211, in main
fname_output_image = moco_wrapper(param)
File “/Users/hedi/sct_5.8/spinalcordtoolbox/”, line 336, in moco_wrapper
file_mat_datasub_group, _ = moco(param_moco)
File “/Users/hedi/sct_5.8/spinalcordtoolbox/”, line 603, in moco
failed_transfo[it] = register(param, file_data_splitZ_splitT[it], file_target_splitZ[iz], file_mat[iz][it],
File “/Users/hedi/sct_5.8/spinalcordtoolbox/”, line 747, in register
status, output = run_proc(cmd, verbose=1 if param.verbose == 2 else 0, env=env, **kw)
File “/Users/hedi/sct_5.8/spinalcordtoolbox/utils/”, line 411, in run_proc
raise RuntimeError(output)
RuntimeError: setting mask /private/var/folders/d7/6n0293712vb_3j2xk6g5_00r0000gn/T/sct-20230109195349.303325-moco-wxs76ugw/mask.nii
Exception caught:
itk::ExceptionObject (0x600000b38e90)
Location: “unknown”
File: /Users/runner/work/build_ANTs/build_ANTs/antsbin/staging/include/ITK-5.1/itkMattesMutualInformationImageToImageMetricv4.hxx
Line: 312
Description: itk::ERROR: MattesMutualInformationImageToImageMetricv4(0x7fba36f060e0): Joint PDF summed to zero

What is the problem?

Hi @omidetemadi,

This issue was previously reported: Issue calling sct_dmri_moco in version 5.3.0 - #23 by Rosella_Tro

This link includes an explanation and possible workarounds.


Thank you for your answer.

1 Like