Error with sct_smooth_spinalcord v4.0.2


I am trying to smooth my T2 images and I call the smoothing function like this:
'sct_smooth_spinalcord -i T2.nii.gz -s T2_seg.nii.gz -smooth 0 0 8 ’

This function runs without any problem in my data set except for one participant. For that participant, I get the following error (I checked the segmentation and it seems fine to me as well) :

Error on approximation = 0.12 mm
Error on approximation = 0.11 mm
Error on approximation = 0.1 mm
Error on approximation = 0.1 mm
Error on approximation = 0.09 mm
Traceback (most recent call last):
File “/home/willi/sct_4.0.2/scripts/”, line 289, in
File “/home/willi/sct_4.0.2/scripts/”, line 272, in main
fname_straight = sc_straight.straighten()
File “/home/willi/sct_4.0.2/spinalcordtoolbox/”, line 152, in straighten
centerline = _get_centerline(img_ctl, self.param_centerline, verbose)
File “/home/willi/sct_4.0.2/spinalcordtoolbox/”, line 625, in _get_centerline
_, arr_ctl, arr_ctl_der, _ = get_centerline(img, param_centerline, verbose=verbose)
File “/home/willi/sct_4.0.2/spinalcordtoolbox/centerline/”, line 173, in get_centerline
z_ref] = 1
IndexError: shape mismatch: indexing arrays could not be broadcast together with shapes (240,) (240,) (241,)

Could you please point to me what may be wrong for this T2 ?

Thank you very much!

Kind Regards,

Hi Merve
Would you be able to send me the data?

Hi Merve,

I was able to reproduce your issue. A ticket has been opened here and we are working on it with top priority.

Thank you very much for reporting this bug.

Hi Dr Cohen-Adad,

Thank you very much!

Kind Regards,

Hi @Merve,

Sorry for the delay. The issue has been fixed in this PR.

The fix is already available in the SCT’s master branch (git installation), and it will be available in a future release.

Thank you for having reported this issue,