Sct_register_to_template problem with multiple disc labels (sct_4.0.1)

Dear SCT experts,

I am facing a problem while using the command sct_register_to_template.

I just call the command like this: sct_register_to_template -i T2.nii.gz -s T2_seg.nii.gz -ldisc T2_seg_labeled_discs_edited.nii.gz I created the labeled_discs by using sct_label_vertebrae command (which work quite well). I have 8 labels in this nifti file (from 2 to 9).

When I run the command I get the following error:

"…

Straighten the spinal cord using centerline/segmentation…

Create temporary folder (/tmp/sct-20190903104329.637122-straighten_spinalcord-etincqvm)…

Copy files to tmp folder…
Create the straight space and the safe zone
Length of spinal cord: 134.47821556475964
Size of spinal cord in z direction: 127.99999999985897
Ratio length/size: 1.0506110591008422
Safe zone boundaries (curved space): [-86.1999969487103, 41.80000305114868]
Safe zone boundaries (straight space): [-89.43910473116063, 45.03911083359901]
Traceback (most recent call last):
File “/home/willi/sct_4.0.1/scripts/sct_register_to_template.py”, line 871, in
main()
File “/home/willi/sct_4.0.1/scripts/sct_register_to_template.py”, line 437, in main
sc_straight.straighten()
File “/home/willi/sct_4.0.1/spinalcordtoolbox/straightening.py”, line 218, in straighten
centerline_straight = _get_centerline(image_centerline_straight, algo_fitting, self.degree, verbose)
NameError: name ‘algo_fitting’ is not defined "

When I just give one label instead of 8, function runs without any errors.

Before switching to 4.0.1, I was using 4.0.0- beta 5 and I did not have this problem.
Should I straighten the cord first, and then use this as an input ?

Thanks a lot!

Best,
Merve

Hi Merve,

I can reproduce this issue. We have opened a ticket here and will address this bug with top priority.

Thank you very much for reporting this issue.

Best,
Julien

Thank you very much!

Best,
Merve

Hi @Merve,

The issue has been fixed in this new SCT release 4.0.2.

Cheers,
Julien

Dear Dr Cohen-Adad

Thank you very much!

Best,
Merve