Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sci-colorado/sub-5740_T2w.nii.gz - weird intensity range #59

Open
valosekj opened this issue Sep 11, 2023 · 3 comments
Open

sci-colorado/sub-5740_T2w.nii.gz - weird intensity range #59

valosekj opened this issue Sep 11, 2023 · 3 comments

Comments

@valosekj
Copy link
Member

The sci-colorado/sub-5740/anat/sub-5740_T2w.nii.gz image has a weird intensity range:

$ fslstats sub-5740_T2w.nii.gz -R
-32767.000000 32516.000000

This results in a "gray nothing" when opening the image in FSLeyes:

image

When manually adjusting the min and max to 0-1000 interval, the image looks good:

image

The weird intensity range results in the failure of sct_deepseg_sc:

$ sct_deepseg_sc -i sub-5740_T2w.nii.gz -c t2 -kernel 2d 

--
Spinal Cord Toolbox (git-jv/sct_analyze_lesion_improvements-16742e4eada8e9853993e61fe4ce559767d4f42a*)

sct_deepseg_sc -i sub-5740_T2w.nii.gz -c t2 -kernel 2d
--

Config deepseg_sc:
  Centerline algorithm: svm
  Brain in image: True
  Kernel dimension: 2d
  Contrast: t2
  Threshold: 0.7
Creating temporary folder (/var/folders/w6/bnzr2qls11l69w0_8q95ghtr0000gn/T/sct_2023-09-11_10-43-36_deepseg-sc_sk1d9x5y)
Reorient the image to RPI, if necessary...
Finding the spinal cord centerline...
Creating temporary folder (/var/folders/w6/bnzr2qls11l69w0_8q95ghtr0000gn/T/sct_2023-09-11_10-43-37_optic-detect-centerline_8wgfjh8r)
/Users/valosek/code/sct_latest/spinalcordtoolbox/centerline/optic.py:102: RuntimeWarning: overflow encountered in short_scalars
  data_rescaled = img_data.astype('float') * (max_out - min_out) / (max_in - min_in)
To avoid intensity overflow due to convertion to +uint16+, intensity will be rescaled to the maximum quantization scale
Remove temporary files...
rm -rf /var/folders/w6/bnzr2qls11l69w0_8q95ghtr0000gn/T/sct_2023-09-11_10-43-37_optic-detect-centerline_8wgfjh8r
Cropping the image around the spinal cord...
Normalizing the intensity...
Segmenting the spinal cord using deep learning on 2D patches...
Reassembling the image...
Resampling the segmentation to the native image resolution using linear interpolation...
Spinal cord could not be detected for /Users/valosek/data/data.neuro.polymtl.ca/sci-colorado/sub-5740/anat/sub-5740_T2w.nii.gz
    EmptyArrayError: 'Spinal cord not detected. Please make sure that there is sufficient contrast between the spinal cord and CSF to ensure good results.'
@jcohenadad
Copy link
Member

jcohenadad commented Sep 11, 2023

Very interesting bug! Thank you for reporting this, Jan. Maybe we could consider also reporting in SCT.

@valosekj
Copy link
Member Author

Note that this intensity issue results in the failure of the baselines/comparison_with_other_methods_sc.sh script for
seed710 and seed123 train-test splits. --> we have no SC predictions for this subject for these two seeds.

@mguaypaq
Copy link

mguaypaq commented Sep 18, 2023

I had a quick look at the data for this image (sub-5740_T2w.nii.gz), and all the values which are outside the range [0, 10000] are concentrated in a small region of the image:

  • z-coordinate = 33 (the last slice)
  • y-coordinate in [0, 12] (out of 512)
  • all 512 x-coordinates.

So maybe it would make sense to zero out this part of the image.

Edit: outside of this part of the image, the range of values is [0, 1839].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants