Data not in correct dimension

Hello,
I am pretty new to the spinal cord toolbox and MRI data analysis. I tried running the propseg command for the t2 weighted data and gets error related to the dimensions of the data. Please see the terminal output.

pawan_0210@DESKTOP-MDS0OFU:/mnt/c/sct_course_london20/Test_Data/Data/t2$ sct_propseg -i 1008_T10-L2_Trans.nii.gz -c t2 -
qc ~/qc-1008_sagView


Spinal Cord Toolbox (5.7)

sct_propseg -i 1008_T10-L2_Trans.nii.gz -c t2 -qc /home/pawan_0210/qc-1008_sagView

Creating temporary folder (/tmp/sct-20220812171336.666343-propseg-qm8r0h8h)
Creating temporary folder (/tmp/sct-20220812171336.850785-label_vertebrae-4ehac8jx)
Creating temporary folder (/tmp/sct-20220812171336.852620-36c5flql)
Remove temporary files…
rm -rf /tmp/sct-20220812171336.852620-36c5flql
/home/pawan_0210/sct_5.7/bin/isct_propseg -t t2 -o /tmp/sct-20220812171336.666343-propseg-qm8r0h8h -verbose -i /mnt/c/sct_course_london20/Test_Data/Data/t2/1008_T10-L2_Trans.nii.gz -init-centerline /tmp/sct-20220812171336.850785-label_vertebrae-4ehac8jx/centerline_optic.nii.gz -centerline-binary # in /mnt/c/sct_course_london20/Test_Data/Data/t2
mv /tmp/sct-20220812171336.666343-propseg-qm8r0h8h/1008_T10-L2_Trans_seg.nii.gz ./1008_T10-L2_Trans_seg.nii.gz
mv /tmp/sct-20220812171336.666343-propseg-qm8r0h8h/1008_T10-L2_Trans_centerline.nii.gz ./1008_T10-L2_Trans_centerline.nii.gz

Check consistency of segmentation…
Creating temporary folder (/tmp/sct-20220812171407.929757-propseg-c3u2clsv)
/tmp/sct-20220812171407.929757-propseg-c3u2clsv/tmp.segmentation.nii.gz
/tmp/sct-20220812171407.929757-propseg-c3u2clsv/tmp.centerline.nii.gz

Get data dimensions…
/tmp/sct-20220812171407.929757-propseg-c3u2clsv/tmp.segmentation_RPI_c.nii.gz
rm -rf /tmp/sct-20220812171407.929757-propseg-c3u2clsv
Copy header input → output(s) to make sure qform is the same.
File /mnt/c/sct_course_london20/Test_Data/Data/t2/1008_T10-L2_Trans_seg.nii.gz already exists. Will overwrite it.
File /mnt/c/sct_course_london20/Test_Data/Data/t2/1008_T10-L2_Trans_centerline.nii.gz already exists. Will overwrite it.

*** Generate Quality Control (QC) html report ***
Resample images to 0.6x0.6 mm
Traceback (most recent call last):
File “/home/pawan_0210/sct_5.7/spinalcordtoolbox/scripts/sct_propseg.py”, line 699, in
main(sys.argv[1:])
File “/home/pawan_0210/sct_5.7/spinalcordtoolbox/scripts/sct_propseg.py”, line 693, in main
dataset=qc_dataset, subject=qc_subject, process=‘sct_propseg’)
File “/home/pawan_0210/sct_5.7/spinalcordtoolbox/reports/qc.py”, line 780, in generate_qc
qcslice_type = qcslice.Axial([Image(fname_in1), Image(fname_seg)])
File “/home/pawan_0210/sct_5.7/spinalcordtoolbox/reports/slice.py”, line 58, in init
img_r = self._resample_slicewise(img, p_resample, type_img=type_img, image_ref=image_ref)
File “/home/pawan_0210/sct_5.7/spinalcordtoolbox/reports/slice.py”, line 350, in _resample_slicewise
nii_r = resample_nib(nii, image_dest=nii_ref, interpolation=dict_interp[type_img])
File “/home/pawan_0210/sct_5.7/spinalcordtoolbox/resampling.py”, line 116, in resample_nib
img, to_vox_map=reference, order=dict_interp[interpolation], mode=mode, cval=0.0, out_class=None)
File “/home/pawan_0210/sct_5.7/python/envs/venv_sct/lib/python3.7/site-packages/nibabel/processing.py”, line 172, in resample_from_to
to_vox2from_vox = npl.inv(a_from_affine).dot(a_to_affine)
ValueError: shapes (4,4) and (5,5) not aligned: 4 (dim 1) != 5 (dim 0)

Any idea why is this happening. As I mentioned, I am new to this type of work and may not have understanding related to the data structure to be used for the spinalcord toolbox.

Thank you,
Pawan

I was using Mango to convert DICOM to NII. As recommended, I used dicm2nii converter and now the data is converted in the correct format.

Thank,
Pawan

1 Like

Hi @pawan_sharma,

My apologies for the late reply, but I’m glad to hear that you were able to resolve this issue on your own. Thank you so much for sharing your solution for others to see. :slight_smile:

Kind regards,
Joshua