Sct_deepseg_sc error using 3d kernel (v4.0.0-beta.2)

Hi developers:

I have observed an error using the “-kernel 3d” option for sct_deepseg_sc (v.4.0.0-beta.2). The use of the “-kernel 2d” option works just fine when applied to the same data. The outputs are copied below.

I was previously using ver 3.2.7 and observed that the “-kernel 3d” option did not work, which is why I upgraded to v.4.0.0-beta.2 (although I don’t recall if the error message was the same in ver 3.2.7 - I can check if that’s important). I’d be happy to help test this further…

Thanks,

-Rob


barryrl% sct_deepseg_sc -i t2.nii -c t2 -brain 1 -kernel 2d

Method:
Centerline algorithm: svm
Assumes brain section included in the image: True
Dimension of the segmentation kernel convolutions: 2d

Create temporary folder (/var/folders/mf/5wv63z61295dcfvzm_l2llh8003jn9/T/sct-20190416141552.661809-v1M9wH)…
Reorient the image to RPI, if necessary…
Finding the spinal cord centerline…
Remove temporary files…
rm -rf /var/folders/mf/5wv63z61295dcfvzm_l2llh8003jn9/T/sct-20190416141620.975540-FSPxzN
Resample the image to 0.5 mm isotropic resolution…
Cropping the image around the spinal cord…
Normalizing the intensity…
Segmenting the spinal cord using deep learning on 2D patches…
Reassembling the image…
WARNING: To avoid intensity overflow due to convertion to uint8, intensity will be rescaled to the maximum quantization scale.
Resampling the segmentation to the original image resolution…
Binarizing the segmentation to avoid interpolation effects…
Removing small objects above slice#590
Removing small objects above slice#590
Filling a hole in the segmentation around z_slice #:55
Filling a hole in the segmentation around z_slice #:62
Filling a hole in the segmentation around z_slice #:67
Remove temporary files…
rm -rf /var/folders/mf/5wv63z61295dcfvzm_l2llh8003jn9/T/sct-20190416141552.661809-v1M9wH


barryrl% sct_deepseg_sc -i t2.nii -c t2 -brain 1 -kernel 3d

Method:
Centerline algorithm: svm
Assumes brain section included in the image: True
Dimension of the segmentation kernel convolutions: 3d

Create temporary folder (/var/folders/mf/5wv63z61295dcfvzm_l2llh8003jn9/T/sct-20190416141856.379420-OT_qWu)…
Reorient the image to RPI, if necessary…
Finding the spinal cord centerline…
Remove temporary files…
rm -rf /var/folders/mf/5wv63z61295dcfvzm_l2llh8003jn9/T/sct-20190416141926.368940-MHyE7_
Resample the image to 0.5 mm isotropic resolution…
Cropping the image around the spinal cord…
Normalizing the intensity…
Traceback (most recent call last):
File “/Applications/SCT/ver_4_0_0_beta_2/scripts/sct_deepseg_sc.py”, line 185, in
main()
File “/Applications/SCT/ver_4_0_0_beta_2/scripts/sct_deepseg_sc.py”, line 159, in main
brain_bool=brain_bool, kernel_size=kernel_size, remove_temp_files=remove_temp_files, verbose=verbose)
File “/Applications/SCT/ver_4_0_0_beta_2/spinalcordtoolbox/deepseg_sc/core.py”, line 640, in deep_segmentation_spinalcord
‘mm’, ‘linear’, verbose=0)
File “/Applications/SCT/ver_4_0_0_beta_2/spinalcordtoolbox/resampling.py”, line 138, in resample_file
nii = nipy.load_image(fname_data)
File “/Applications/SCT/ver_4_0_0_beta_2/python/lib/python2.7/site-packages/nipy/io/files.py”, line 57, in load
img = nib.load(filename)
File “/Applications/SCT/ver_4_0_0_beta_2/python/lib/python2.7/site-packages/nibabel/loadsave.py”, line 42, in load
raise FileNotFoundError(“No such file or no access: ‘%s’” % filename)
nibabel.py3k.FileNotFoundError: No such file or no access: ‘image_in_RPI_norm.nii’

Hi Rob,

Thank you for reporting this error. I confirm that we can reproduce on our end. We are working on it with top priority. You can follow the issue here.

Best,
Julien

1 Like

Hi Rob,
The issue has been fixed. Do you want to do a git pull and try re-running the command?
Cheers,
Julien

1 Like

Hi Julien,

Just a quick note to confirm that the use of a 3d kernel no longer produces this error. The output of the function is copied below. Thank you for the quick resolution!! :slight_smile:

Kind regards,

-Rob


barryrl% sct_deepseg_sc -i t2.nii -c t2 -brain 1 -kernel 3d

Method:
Centerline algorithm: svm
Assumes brain section included in the image: True
Dimension of the segmentation kernel convolutions: 3d

Create temporary folder (/var/folders/mf/5wv63z61295dcfvzm_l2llh8003jn9/T/sct-20190418173649.551060-ZRvEv3)…
Reorient the image to RPI, if necessary…
Finding the spinal cord centerline…
Remove temporary files…
rm -rf /var/folders/mf/5wv63z61295dcfvzm_l2llh8003jn9/T/sct-20190418173718.741418-H9Ul_v
Resample the image to 0.5x0.5 mm in-plane resolution…
Cropping the image around the spinal cord…
Normalizing the intensity…
Segmenting the spinal cord using deep learning on 3D patches…
Reassembling the image…
WARNING: To avoid intensity overflow due to convertion to uint8, intensity will be rescaled to the maximum quantization scale.
Resampling the segmentation to the original image resolution…
Binarizing the segmentation to avoid interpolation effects…
Removing small objects above slice#671
Removing small objects above slice#671
Remove temporary files…
rm -rf /var/folders/mf/5wv63z61295dcfvzm_l2llh8003jn9/T/sct-20190418173649.551060-ZRvEv3
swig/python detected a memory leak of type ‘int64_t *’, no destructor found.