Dear @joshuacwnewton,
I think I solved it, the b0 volumes are included as the first column and there was a duplicated column for one of the DWI volumes which I removed. Unfortunately now, I’m having this issue and im wondering if when I generated the 3d image containing the mean if there is a problem:
Spinal Cord Toolbox (6.5)
sct_dmri_moco -i IMAGES_AXIAL_DTI_AND_DIFFUSION_20160515110901_23_dwi.nii -m mask_IMAGES_AXIAL_DTI_AND_DIFFUSION_20160515110901_23_dwi_mean.nii -bval IMAGES_AXIAL_DTI_AND_DIFFUSION_20160515110901_23_trimmed.bval -bvec IMAGES_AXIAL_DTI_AND_DIFFUSION_20160515110901_23_trimmed.bvec -qc /home/saif/qc_singleSubj -qc-seg IMAGES_AXIAL_DTI_AND_DIFFUSION_20160515110901_23_dwi_mean_seg.nii.gz
--
Input parameters:
Input file ............ IMAGES_AXIAL_DTI_AND_DIFFUSION_20160515110901_23_dwi.nii
Group size ............ 3
Creating temporary folder (/tmp/sct_2025-06-11_23-35-04_moco-wrapper_pgv4txtc)
Copying input data to tmp folder and convert to nii...
Get dimensions of data...
166 x 66 x 20
Data orientation: RPI
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...
Identify b=0 and DWI images...
Number of b=0: 1 [0]
Number of DWI: 19 [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
Split along T dimension...
Merge and average b=0 data...
Image header specifies datatype 'int16', but array is of type 'float64'. Header metadata will be overwritten to use 'float64'.
Merge within groups: 0%| | 0/7 [00:00<?, ?iter/s]Image header specifies datatype 'int16', but array is of type 'float64'. Header metadata will be overwritten to use 'float64'.
Image header specifies datatype 'int16', but array is of type 'float64'. Header metadata will be overwritten to use 'float64'.
Merge within groups: 29%|██████▎ | 2/7 [00:00<00:00, 15.80iter/s]Image header specifies datatype 'int16', but array is of type 'float64'. Header metadata will be overwritten to use 'float64'.
Image header specifies datatype 'int16', but array is of type 'float64'. Header metadata will be overwritten to use 'float64'.
Merge within groups: 57%|████████████▌ | 4/7 [00:00<00:00, 15.21iter/s]Image header specifies datatype 'int16', but array is of type 'float64'. Header metadata will be overwritten to use 'float64'.
Image header specifies datatype 'int16', but array is of type 'float64'. Header metadata will be overwritten to use 'float64'.
Merge within groups: 86%|██████████████████▊ | 6/7 [00:00<00:00, 15.18iter/s]Image header specifies datatype 'int16', but array is of type 'float64'. Header metadata will be overwritten to use 'float64'.
Merge within groups: 100%|██████████████████████| 7/7 [00:00<00:00, 16.35iter/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 ................. mask.nii
Output mat folder ..... mat_b0groups
Data dimensions:
166 x 66 x 20 x 1
Copy file_target to a temporary file...
Image header specifies datatype 'int64', but array is of type '<class 'numpy.uint8'>'. Header metadata will be overwritten to use '<class 'numpy.uint8'>'.
Register. Loop across Z (note: there is only one Z if orientation is axial)
Z=0/0: 0%| | 0/1 [00:00<?, ?iter/s]
Traceback (most recent call last):
File "/home/saif/sct_6.5/spinalcordtoolbox/scripts/sct_dmri_moco.py", line 235, in <module>
main(sys.argv[1:])
File "/home/saif/sct_6.5/spinalcordtoolbox/scripts/sct_dmri_moco.py", line 220, in main
fname_output_image = moco_wrapper(param)
File "/home/saif/sct_6.5/spinalcordtoolbox/moco.py", line 330, in moco_wrapper
file_mat_b0, _ = moco(param_moco)
File "/home/saif/sct_6.5/spinalcordtoolbox/moco.py", line 610, in moco
failed_transfo[it] = register(param, file_data_splitZ_splitT[it], file_target_splitZ[iz], file_mat[iz][it],
File "/home/saif/sct_6.5/spinalcordtoolbox/moco.py", line 754, in register
status, output = run_proc(cmd, verbose=1 if param.verbose == 2 else 0, env=env, **kw)
File "/home/saif/sct_6.5/spinalcordtoolbox/utils/sys.py", line 342, in run_proc
raise RuntimeError(output)
RuntimeError: setting mask /tmp/sct_2025-06-11_23-35-04_moco-wrapper_pgv4txtc/mask_bin.nii
Exception caught:
itk::ExceptionObject (0x2b86520)
Location: "unknown"
File: /__w/build_ANTs/build_ANTs/antsbin/staging/include/ITK-5.1/itkMattesMutualInformationImageToImageMetricv4.hxx
Line: 312
Description: itk::ERROR: MattesMutualInformationImageToImageMetricv4(0x2996860): Joint PDF summed to zero