Error when running sct_get_centerline

Dear SCT Experts,

Thank you very much for your continues help and support. I have Human Ex-vivo DWI dataset. I would like to use SCT toolbox to analyze them. I tried to run sct_get_centerline to start but unfortunately ended with the following error (please have a look at the data details, command, output).

fslinfo 3890_dwi_res.nii.gz

data_type FLOAT32

dim1 250

dim2 1000

dim3 250

dim4 38

datatype 16

pixdim1 0.080000

pixdim2 0.080000

pixdim3 0.080000

pixdim4 nan

cal_max 0.0000

cal_min 0.0000

file_type NIFTI-1+

I then swapped dim using sct_image -i 3890_dwi_res.nii.gz -setorient RPI -o dwi_3890_RPI.nii.gz as the orientation of the dwi data was set in ASL.

data_type FLOAT32

dim1 250

dim2 250

dim3 1000

dim4 38

datatype 16

pixdim1 0.080000

pixdim2 0.080000

pixdim3 0.080000

pixdim4 nan

cal_max 0.0000

cal_min 0.0000

file_type NIFTI-1+

s4333238@cai-wks6:/30days/s4333238$ sct_get_centerline -i dwi_3890_RPI.nii.gz -method viewer


Spinal Cord Toolbox (4.2.0)

Traceback (most recent call last):
File “/data/home/s4333238/sct_4.2.0/scripts/sct_get_centerline.py”, line 147, in
run_main()
File “/data/home/s4333238/sct_4.2.0/scripts/sct_get_centerline.py”, line 127, in run_main
im_labels = _call_viewer_centerline(Image(fname_data), interslice_gap=interslice_gap)
File “/data/home/s4333238/sct_4.2.0/spinalcordtoolbox/centerline/core.py”, line 286, in call_viewer_centerline
launch_centerline_dialog(im_data, im_mask_viewer, params)
File “/data/home/s4333238/sct_4.2.0/spinalcordtoolbox/gui/centerline.py”, line 260, in launch_centerline_dialog
dialog
= Centerline(controller)
File “/data/home/s4333238/sct_4.2.0/spinalcordtoolbox/gui/centerline.py”, line 138, in init
super(Centerline, self).init(*args, **kwargs)
File “/data/home/s4333238/sct_4.2.0/spinalcordtoolbox/gui/base.py”, line 122, in init
self._init_ui()
File “/data/home/s4333238/sct_4.2.0/spinalcordtoolbox/gui/base.py”, line 130, in _init_ui
self._init_canvas(layout)
File “/data/home/s4333238/sct_4.2.0/spinalcordtoolbox/gui/centerline.py”, line 144, in _init_canvas
self.sagittal_canvas = widgets.SagittalCanvas(self, plot_points=True, horizontal_nav=True)
File “/data/home/s4333238/sct_4.2.0/spinalcordtoolbox/gui/widgets.py”, line 289, in init
self._init_ui(self._image.data[:, :, self._z], dx / dy)
File “/data/home/s4333238/sct_4.2.0/spinalcordtoolbox/gui/widgets.py”, line 154, in _init_ui
alpha=self._params.alpha)
File “/data/home/s4333238/sct_4.2.0/python/envs/venv_sct/lib/python3.6/site-packages/matplotlib/init.py”, line 1599, in inner
return func(ax, *map(sanitize_sequence, args), **kwargs)
File “/data/home/s4333238/sct_4.2.0/python/envs/venv_sct/lib/python3.6/site-packages/matplotlib/cbook/deprecation.py”, line 369, in wrapper
return func(*args, **kwargs)
File “/data/home/s4333238/sct_4.2.0/python/envs/venv_sct/lib/python3.6/site-packages/matplotlib/cbook/deprecation.py”, line 369, in wrapper
return func(*args, **kwargs)
File “/data/home/s4333238/sct_4.2.0/python/envs/venv_sct/lib/python3.6/site-packages/matplotlib/axes/_axes.py”, line 5679, in imshow
im.set_data(X)
File “/data/home/s4333238/sct_4.2.0/python/envs/venv_sct/lib/python3.6/site-packages/matplotlib/image.py”, line 690, in set_data
.format(self._A.shape))
TypeError: Invalid shape (1000, 250, 38) for image data

Any suggestion to address this issue please?

Thanks a lot!

Regards,

Hattan

Hi @ihattan,
Your message is incomplete. What do you need help with?

@jcohenadad thank you very much for your prompt response. Just re-posted completely.

Your data are 4d. The input of sct_get_centerline should be 3d.
You could do e.g.:

sct_dmri_separate_b0_and_dwi -i dwi_3890_RPI.nii.gz -bvec YOUR_BVECS_FILE
sct_get_centerline -i dwi_3890_RPI_dwi_mean.nii.gz
1 Like

Another question please,
I went through your recent great and useful course about SCT and was for in vivo spinal cord. In case, I would like to use batch_processing.sh for our ex vivo dwi cervical cord what should I amend/delete or add into it in order to use it?
I would then segment GM/WM and register our template to PAM50 and extract DTI metrices for further quantification.

Some of our dwi datasets are one shell and some 2 shells with 18 direction each+2b0 images.

I would be more than happy to share the some sample of my dataset if needed.

Thanks once again for your efforts and support.

Many thanks Julien. Ok I’ll give it a try and keep you posted.

There is part of the batch_processing script that you could use (segmentation, registration to template, etc.), but some parameters might need to be tweaked. You would also need to add some commands to accommodate your specific needs. If you share a representative dataset I could make a script for you.

Cheers,
Julien

1 Like

Thank you very much for your help Julien. I shared the data via cloudstore.

Many thanks in advance.

Cheers,
Ibrahim

Thank you very much for your help Julien. I shared the data via cloudstore.

i received it but it is password-protected

Password is Juliencohen-2020

Let me know please whether it works or not. So, I may need to re-send them again.

1 Like

working!

1 Like

@ihattan I’ve looked at the data, they are superbe. The plan is to generate a specific deep learning model for your data, make it available in a new release of SCT, so you will be able to use it. It should take ~1w.

1 Like

Julein I really appreciate your great help and support.

Thank you very much.

Cheers,

Ibrahim Hattan

1 Like

Hi @ihattan,

What has been done:

  • We used a deep learning model trained on exvivo T1w data 0.08mm isotropic, to infer on your DWI data the spinal cord and grey matter segmentation.
  • The results are encouraging, but not great because of the contrast difference / image appearance between the data used for the original model training and your new data (DWI), see here.

What we plan to do:

  • Manually segment few slices (~40 slices on both images you sent) based on the model predictions
  • Use the pre-trained model and fine-tune the parameters (using the new ground-truth generated on your data).
  • Test the new generated model.

I will message you next Monday morning, Hobart time, to give you updates.

Cheers,
Charley

Hi @ihattan,

Just a quick Monday update: we are still working on generating some ground truth to fine tune a model for your data. It should not be too long now (1 or 2 more days to generate the GT, then model generation).

I will make sure to keep you posted.
Cheers,
Charley

1 Like

Hi @ihattan,
I will be working on your model today and tomorrow. And will let you know how it goes by the end of the week.
Apologies for the delay.
Cheers,
Charley

1 Like

The new trained model reaches 80-85% of Dice score! We will manually segment 40 more slices and hope to reach 90% of Dice score before putting the model into production.
Regards,
Charley

1 Like

Hi Charley,

Thank you very much for your help and continues support.

Ok almost there and Many thanks once again.

Cheers,

Ibrahim

Hi @ihattan, just following on this issue. Has this been resolved with the new model?

1 Like

Hi @jcohenadad,

I’ll share with you the outcome soon with screenshots for the results.

Many thanks for your help and continues support.

Cheers,

Ibrahim