Hi,
I am having some trouble with the ‘sct_dmri_moco’ function.
I am using sagittal diffusion-weighted data and think it may be a similar issue to this previous post:
Command:
--
Spinal Cord Toolbox (7.1)
sct_dmri_moco -i sub-2D2A24-1103_ses-01_acq-cervical_dwi.nii.gz -bvec sub-2D2A24-1103_ses-01_acq-cervical_dwi.bvec -bval sub-2D2A24-1103_ses-01_acq-cervical_dwi.bval -m sub-2D2A24-1103_ses-01_acq-cervical_dwi_dwi_mean_mask.nii.gz -g 1
--
Input parameters:
Input file ............ sub-2D2A24-1103_ses-01_acq-cervical_dwi.nii.gz
Group size ............ 1
Creating temporary folder (/var/folders/_c/8y3689616c9d70cywhybh33w0000gn/T/sct_2026-04-30_20-52-05_moco-wrapper_v__ypvd2)
Copying input data to tmp folder and convert to nii...
e[33mImage header specifies datatype 'int16', but array is of type 'float64'. Header metadata will be overwritten to use 'float64'.e[0m
Get dimensions of data...
80 x 80 x 13
Data orientation: AIL
Treated as sagittal
Set suffix of transformation file name, which depends on the orientation:
Orientation is sagittal, suffix is '0GenericAffine.mat'. The image is split across the R-L direction, and the estimated transformation is a 2D affine transfo.
Identify b=0 and DWI images...
NumExpr defaulting to 8 threads.
Identify b=0 and DWI images...
Number of b=0: 1 [0]
Number of DWI: 16 [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
Split along T dimension...
Merge and average b=0 data...
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:
80 x 80 x 13 x 1
Copy file_target to a temporary file...
e[33mImage header specifies datatype 'float64', but array is of type '<class 'numpy.uint8'>'. Header metadata will be overwritten to use '<class 'numpy.uint8'>'.e[0m
Register. Loop across Z (note: there is only one Z if orientation is axial)
-------------------------------------------------------------------------------
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:
80 x 80 x 13 x 16
Copy file_target to a temporary file...
e[33mImage header specifies datatype 'float64', but array is of type '<class 'numpy.uint8'>'. Header metadata will be overwritten to use '<class 'numpy.uint8'>'.e[0m
e[33mFile /private/var/folders/_c/8y3689616c9d70cywhybh33w0000gn/T/sct_2026-04-30_20-52-05_moco-wrapper_v__ypvd2/mask_bin.nii already exists. Will overwrite it.e[0m
Register. Loop across Z (note: there is only one Z if orientation is axial)
Traceback (most recent call last):
File "/Users/georgiabright/sct_7.1/spinalcordtoolbox/scripts/sct_dmri_moco.py", line 220, in <module>
main(sys.argv[1:])
File "/Users/georgiabright/sct_7.1/spinalcordtoolbox/scripts/sct_dmri_moco.py", line 205, in main
fname_output_image = moco_wrapper(param)
File "/Users/georgiabright/sct_7.1/spinalcordtoolbox/moco.py", line 405, in moco_wrapper
copy_mat_files(nt, file_mat_datasub, index_moco, mat_final, param)
File "/Users/georgiabright/sct_7.1/spinalcordtoolbox/moco.py", line 165, in copy_mat_files
copyfile(fsrc, fdest)
File "/Users/georgiabright/sct_7.1/python/envs/venv_sct/lib/python3.10/shutil.py", line 254, in copyfile
with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: 'mat_groups/mat.Z0000T00000GenericAffine.mat'
Total runtime; 32.445 seconds.
Error: Processing of subject sub-2D2A24 failed
Output after running the command “sct_check_dependencies”:
