Spinal cord DKI processing

sct_check_dependencies


Spinal Cord Toolbox (4.1.0)

SCT info:

  • version: 4.1.0
  • path: /home/rosella/sct_4.1.0
    OS: linux (Linux-3.16.0-4-amd64-x86_64-with-debian-8.11)
    CPU cores: Available: 8, Used by SCT: 8
    RAM: MemTotal: 32970652 kB
    total used free shared buffers cached
    Mem: 32197 6822 25374 77 359 3834
    -/+ buffers/cache: 2628 29569
    Swap: 57218 0 57218
    Check Python executable…[OK]
    Using bundled python 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 19:07:31)
    [GCC 7.3.0] at /home/rosella/sct_4.1.0/python/envs/venv_sct/bin/python
    Check if data are installed…[OK]
    Check if numpy is installed…[OK] (1.17.4)
    Check if cryptography is installed…[OK] (2.8)
    Check if dipy is installed…[OK] (1.0.0)
    Check if futures is installed…[OK]
    Check if h5py is installed…[OK] (2.10.0)
    Check if Keras is installed…[OK] (2.3.1)
    Check if matplotlib is installed…[OK] (3.1.1)
    Check if nibabel is installed…[OK] (2.5.1)
    Check if pandas is installed…[OK] (0.25.3)
    Check if psutil is installed…[OK] (5.6.5)
    Check if pyqt5 is installed…[OK]
    Check if pytest is installed…[OK] (5.2.2)
    Check if pytest-cov is installed…[OK] (2.8.1)
    Check if raven is installed…[OK]
    Check if requests is installed…[OK] (2.22.0)
    Check if scipy is installed…[OK] (1.3.2)
    Check if scikit-image is installed…[OK] (0.16.2)
    Check if scikit-learn is installed…[OK] (0.21.3)
    Check if tensorflow is installed…[OK] (2.0.0)
    Check if xlrd is installed…[OK] (1.2.0)
    Check if xlutils is installed…[OK]
    Check if xlwt is installed…[OK] (1.3.0)
    Check if tqdm is installed…[OK] (4.38.0)
    Check if transforms3d is installed…[OK] (0.3.1)
    Check if urllib3[secure] is installed…[OK] (1.25.7)
    Check if spinalcordtoolbox is installed…[OK]
    Check ANTs compatibility with OS …[OK]
    Check PropSeg compatibility with OS …[OK]
    Check if figure can be opened…[OK]

rosella@vivi:~$ sct_testing


Spinal Cord Toolbox (4.1.0)

Will run through the following tests:

  • sequentially: sct_deepseg_gm sct_deepseg_lesion sct_deepseg_sc
  • in parallel with 8 jobs: sct_analyze_lesion sct_analyze_texture sct_apply_transfo sct_convert sct_compute_ernst_angle sct_compute_hausdorff_distance sct_compute_mtr sct_compute_mscc sct_compute_snr sct_concat_transfo sct_create_mask sct_crop_image sct_dice_coefficient sct_detect_pmj sct_dmri_compute_dti sct_dmri_concat_b0_and_dwi sct_dmri_concat_bvals sct_dmri_concat_bvecs sct_dmri_create_noisemask sct_dmri_compute_bvalue sct_dmri_moco sct_dmri_separate_b0_and_dwi sct_dmri_transpose_bvecs sct_extract_metric sct_flatten_sagittal sct_fmri_compute_tsnr sct_fmri_moco sct_get_centerline sct_image sct_label_utils sct_label_vertebrae sct_maths sct_merge_images sct_process_segmentation sct_propseg sct_qc sct_register_multimodal sct_register_to_template sct_resample sct_smooth_spinalcord sct_straighten_spinalcord sct_warp_template
    Checking sct_deepseg_gm…[OK]
    Checking sct_deepseg_lesion…[OK]
    Checking sct_deepseg_sc…[OK]
    Checking sct_analyze_lesion…[OK]
    Checking sct_analyze_texture…[OK]
    Checking sct_apply_transfo…[OK]
    Checking sct_convert…[OK]
    Checking sct_compute_ernst_angle…[OK]
    Checking sct_compute_hausdorff_distance…[OK]
    Checking sct_compute_mtr…[OK]
    Checking sct_compute_mscc…[OK]
    Checking sct_compute_snr…[OK]
    Checking sct_concat_transfo…[OK]
    Checking sct_create_mask…[OK]
    Checking sct_crop_image…[OK]
    Checking sct_dice_coefficient…[OK]
    Checking sct_detect_pmj…[OK]
    Checking sct_dmri_compute_dti…[OK]
    Checking sct_dmri_concat_b0_and_dwi…[OK]
    Checking sct_dmri_concat_bvals…[OK]
    Checking sct_dmri_concat_bvecs…[OK]
    Checking sct_dmri_create_noisemask…[OK]
    Checking sct_dmri_compute_bvalue…[OK]
    Checking sct_dmri_moco…[OK]
    Checking sct_dmri_separate_b0_and_dwi…[OK]
    Checking sct_dmri_transpose_bvecs…[OK]
    Checking sct_extract_metric…[OK]
    Checking sct_flatten_sagittal…[OK]
    Checking sct_fmri_compute_tsnr…[OK]
    Checking sct_fmri_moco…[OK]
    Checking sct_get_centerline…[OK]
    Checking sct_image…[OK]
    Checking sct_label_utils…[OK]
    Checking sct_label_vertebrae…[OK]
    Checking sct_maths…[OK]
    Checking sct_merge_images…[OK]
    Checking sct_process_segmentation…[OK]
    Checking sct_propseg…[OK]
    Checking sct_qc…[OK]
    Checking sct_register_multimodal…[OK]
    Checking sct_register_to_template…[OK]
    Checking sct_resample…[OK]
    Checking sct_smooth_spinalcord…[OK]
    Checking sct_straighten_spinalcord…[OK]
    Checking sct_warp_template…[OK]
    status: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    Finished! Elapsed time: 112s

Thanks, when you run the following command, do you see a window popping up?

sct_label_utils -i kurtosis_dwi_mean.nii -create-viewer 1

If not, could you copy/paste then entire terminal output (including the syntax)?

Are you running SCT remotely by connecting via ssh to a server?

rosella@vivi:~/1/Rm_Encefalo/DKI_b700_b2100_6b0$ sct_label_utils -i kurtosis_dwi_mean.nii -create-viewer 1


Spinal Cord Toolbox (4.1.0)

/home/rosella/sct_4.1.0/python/envs/venv_sct/bin/python: relocation error: /home/rosella/sct_4.1.0/python/envs/venv_sct/lib/python3.6/site-packages/PyQt5/Qt/plugins/platforms/…/…/lib/libQt5DBus.so.5: symbol dbus_message_get_allow_interactive_authorization, version LIBDBUS_1_3 not defined in file libdbus-1.so.3 with link time reference


I am using SCT on my PC without connection via ssh
Rosella

OK, I will need to do some investigations by trying to reproduce your OS setup. Sorry about the inconvenience.

Do not worry, is there some information I can provide in order to help?
thank you,
Rosella

Hi,
Waiting for resolving the problem with the viewer I found a temporary solution which consists in using deepseg with a centerline file provided by the user and created in fsl. This way I manage to segment the image, to crop it and compute subsequent DTI and DKI metrics. Segmentation is not optimal since it depends on the mask I created manually, and DTI and DKI maps have some white or black voxels which I will have to remove somehow, but this is probably due to noise.
The next issue is to provide a gray and white matter segmentation from b0 images. I have tried with deepseg_gm but results are poor. Is there a way to compute automatic segmentation from b0 images, even if the contrast between grey and white matter is poor?
thank you ,
Rosella
ps. Please find attached the script I used and a link with all output images.script_soggetti_spinale.sh (8.9 KB)
https://drive.google.com/drive/u/0/folders/1ZPG8B0Yo8ySpcG_L3ltPv9hg67HnEfxs

Hi,

I strongly advise against running sct_deepseg_gm on your b=0 DWI data. Even with the naked eye, we don’t see the GM. It would produce spurious results that you should not trust.

Instead, I suggest you to rely on the average GM mask (part of the PAM50 template), which can be warped after you run sct_register_to_template.

Thank you very much,
In the meantime I continue trying to solve the problem with the viewer.
Best regards,
Rosella

How can I resolve the problem of spurious (black and white) voxels inside my DKI or DTI maps?
Is this a problem of noise related to the quality of my images? is there anything I can do?
Here is a link to the maps:
https://drive.google.com/drive/u/0/folders/1Ow7zh9wxHv7Tqa74MQ7gEnuyNQ9OD16N
Thank you
Rosella

Hi,

If you are talking about the white/black pixels that you see in this red circle below, then please note that these pixel are not located in the spinal cord (probably in muscles/bone, hence diffusion signal is small, isotropic, and hence noisy). The spinal cord is located where the green cross is.

I am talking about some voxels that are located inside the spinal cord and that appear in some DKI and DTI maps as brighter or darker voxels, an example can be see in axial kurtosis below.

One more question, If I want to compute DKI metrics in some white matter areas and do some statistics on them , is it better to register my diffusion images to PAM50 template or the opposite?
thank you,
Rosella

What I specifically need, is to compute DKI metrics on lateral WM bundles (Cortico-Spinal tracts).
Thank you,
Rosella

Apart from the problem with the viewer interface in order to interactively initialize and select the centerline, I manged to build up a script whose aim is: compute DTI and DKI maps and compute them in Lateral Cortico-Spinal Bundles. I would like to know wheter all the steps I implemented are correct.
Please find attached the final script.
Thank you,
Rosella
script_kurtosis.sh (5.4 KB)

Hi,

I am talking about some voxels that are located inside the spinal cord and that appear in some DKI and DTI maps as brighter or darker voxels, an example can be see in axial kurtosis below.

It could indeed be noise. I suggest you look into outputting STD maps of your diffusion model fitting. Based on this map, you could setup a threshold to mask out those noisy voxels and not include them in your analysis.

One more question, If I want to compute DKI metrics in some white matter areas and do some statistics on them , is it better to register my diffusion images to PAM50 template or the opposite?

I believe your script below answers this question

Apart from the problem with the viewer interface in order to interactively initialize and select the centerline, I manged to build up a script whose aim is: compute DTI and DKI maps and compute them in Lateral Cortico-Spinal Bundles. I would like to know wheter all the steps I implemented are correct.

The script looks good! I suggest you use the -qc flag on the segmentation, registration to template, etc. to facilitate your qc.

best,
julien

ok thank you! My only question remains the fact that using sct_extract_metric a different result is generated in the csv file of results.

Different from what? If you are referring to the dark/white pixels, then you can create a mask with zero on those pixels and one everywhere else, and multiply this mask with each file of the registered PAM50 atlas

I mean the DKI metric’s value in left and right cortico-spinal tract are far different from each other and change every time I run sct_extract_metric.
Rosella

Here is an example of the cdv results file where the value changes. DWI_MK.csv (833 Bytes)