Rat cord registration to template

Hi Experts,

We are using the sct_register_to_template for rat spinal cords.

With the default settings, we get an error (copied below, but the error details are not really important). If we modify the hardcoded resampling factors in sct_register_to_template from their 1.0mm defaults:
resample_file(ftmp_data, add_suffix(ftmp_data, ‘_1mm’), ‘1.0x1.0x1.0’, ‘mm’, ‘linear’, verbose)
resample_file(ftmp_seg, add_suffix(ftmp_seg, ‘_1mm’), ‘1.0x1.0x1.0’, ‘mm’, ‘linear’, verbose)

to 0.1mm (rat) (resampling input dimensions are changed, suffix doesn’t matter):
resample_file(ftmp_data, add_suffix(ftmp_data, ‘_1mm’), ‘0.1x0.1x0.1’, ‘mm’, ‘linear’, verbose)
resample_file(ftmp_seg, add_suffix(ftmp_seg, ‘_1mm’), ‘0.1x0.1x0.1’, ‘mm’, ‘linear’, verbose)

We can run it successfully without issues. I know rescaling of voxel sizes of the original data to 10x is a common workaround that can be done, but is there anything else we should be doing to circumvent this natively without modifying the sct code or voxel sizes? Everything else seem to work well besides this one issue.
A flag to override these defaults could be useful.:wink:

thanks,
-matt

Error trace:
Straighten the spinal cord using centerline/segmentation…
Creating temporary folder (/var/folders/tr/th7v_k5936l9hrf28f9p_7dsb3_0zd/T/sct-20210303065118.512614-straighten_spinalcord-ang0a8nh)
Copy files to tmp folder…
Traceback (most recent call last):
File “/usr/local/sct_v5.2/spinalcordtoolbox/scripts/sct_register_to_template.py”, line 1281, in
main(sys.argv[1:])
File “/usr/local/sct_v5.2/spinalcordtoolbox/scripts/sct_register_to_template.py”, line 533, in main
sc_straight.straighten()
File “/usr/local/sct_v5.2/spinalcordtoolbox/straightening.py”, line 149, in straighten
centerline = _get_centerline(img_ctl, self.param_centerline, verbose)
File “/usr/local/sct_v5.2/spinalcordtoolbox/straightening.py”, line 621, in _get_centerline
_, arr_ctl, arr_ctl_der, _ = get_centerline(img, param_centerline, verbose=verbose)
File “/usr/local/sct_v5.2/spinalcordtoolbox/centerline/core.py”, line 123, in get_centerline
x_centerline_fit, x_centerline_deriv = curve_fitting.bspline(z_mean, x_mean, z_ref, param.smooth, pz=pz)
File “/usr/local/sct_v5.2/spinalcordtoolbox/centerline/curve_fitting.py”, line 53, in bspline
tck = interpolate.splrep(x, y, s=s, k=deg_bspline)
File “/usr/local/sct_v5.2/python/envs/venv_sct/lib/python3.6/site-packages/scipy/interpolate/fitpack.py”, line 288, in splrep
res = _impl.splrep(x, y, w, xb, xe, k, task, s, t, full_output, per, quiet)
File “/usr/local/sct_v5.2/python/envs/venv_sct/lib/python3.6/site-packages/scipy/interpolate/_fitpack_impl.py”, line 465, in splrep
raise TypeError(‘m > k must hold’)
TypeError: m > k must hold

A flag to override these defaults could be useful.:wink:

Great idea! Issue opened here. Thanks for the suggestion!