Issue calling sct_dmri_moco in version 5.3.0

no

I met another issue when applying sct_dmri_moco, even after changing bvals file, however this happens only for one subject:
sct_dmri_moco -i kurtosis_crop.nii.gz -bvec bvecs_modif.txt -x spline
–

Input parameters:
  Input file ............ kurtosis_crop.nii.gz
  Group size ............ 3
Creating temporary folder (/tmp/sct-20210507103613.690089-moco-98nb2gyo)

Copying input data to tmp folder and convert to nii...

Get dimensions of data...
  42 x 42 x 21

Data orientation: RAI
  Treated as axial

Set suffix of transformation file name, which depends on the orientation:
Orientation is axial, suffix is 'Warp.nii.gz'. The estimated transformation is a 3D warping field, which is composed of a stack of 2D Tx-Ty transformations

Identify b=0 and DWI images...
  WARNING: bvecs file is 3xn instead of nx3. Consider using sct_dmri_transpose_bvecs.
  Transpose bvecs...
  Number of b=0: 6 [0, 7, 12, 17, 22, 27]
  Number of DWI: 26 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 13, 14, 15, 16, 18, 19, 20, 21, 23, 24, 25, 26, 28, 29, 30, 31]

Split along T dimension...

Merge and average b=0 data...
Merge within groups: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 9/9 [00:00<00:00, 107.49iter/s]

Merge across groups...

-------------------------------------------------------------------------------
  Estimating motion on b=0 images...
-------------------------------------------------------------------------------

Input parameters:
  Input file ............ b0.nii
  Reference file ........ data_T0000.nii.gz
  Polynomial degree ..... 2
  Smoothing kernel ...... 1
  Gradient step ......... 1
  Metric ................ MI
  Sampling .............. None
  Todo .................. estimate_and_apply
  Mask  .................
  Output mat folder ..... mat_b0groups

Data dimensions:
  42 x 42 x 21 x 6

Copy file_target to a temporary file...

Register. Loop across Z (note: there is only one Z if orientation is axial)
Z=0/0:  67%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ            | 4/6 [00:03<00:01,  1.08iter/s]
Traceback (most recent call last):
  File "/home/synapsi/sct_5.3.0/spinalcordtoolbox/scripts/sct_dmri_moco.py", line 225, in <module>
    main(sys.argv[1:])
  File "/home/synapsi/sct_5.3.0/spinalcordtoolbox/scripts/sct_dmri_moco.py", line 210, in main
    fname_output_image = moco_wrapper(param)
  File "/home/synapsi/sct_5.3.0/spinalcordtoolbox/moco.py", line 327, in moco_wrapper
    file_mat_b0, _ = moco(param_moco)
  File "/home/synapsi/sct_5.3.0/spinalcordtoolbox/moco.py", line 623, in moco
    file_data_splitZ_splitT_moco[it], im_mask=input_mask)
  File "/home/synapsi/sct_5.3.0/spinalcordtoolbox/moco.py", line 765, in register
    status, output = run_proc(cmd, verbose=1 if param.verbose == 2 else 0, env=env, **kw)
  File "/home/synapsi/sct_5.3.0/spinalcordtoolbox/utils/sys.py", line 320, in run_proc
    raise RuntimeError(output)
RuntimeError: Exception caught:
itk::ExceptionObject (0x294ac30)
Location: "unknown"
File: /__w/ANTs/ANTs/antsbin/staging/include/ITK-5.1/itkMattesMutualInformationImageToImageMetricv4.hxx
Line: 312
Description: itk::ERROR: MattesMutualInformationImageToImageMetricv4(0x293b370): Joint PDF summed to zero

thanks,
Rosella

Hi @Rosella_Tro,

This issue is caused by ANTs software failing to co-register two volumes because they are two far apart and/or too noisy. It has notably been raised here.

Possible workarounds include:

  • using another metric: -param MeanSquares or -param CC (slower, better results)
  • use more grouping: -g 5 (although I don’t recommend this one in your case, as you have low amount of volumes, and possibly high motion between adjacent volumes).

In the future, could you please open a new issue with a specific title corresponding to the error? Otherwise, if a single thread includes many different issues, it makes it difficult for other researchers to use the search module of this forum in case they encounter the same issue. For example, you could have opened an issue with the title: β€œERROR: MattesMutualInformationImageToImageMetricv4 with sct_dmri_moco on SCT v5.3.0”

Thanks,
Julien

1 Like

Sure, sorry for that.
thank you,
Rosella