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

ValueError: The length of the pixel data in the dataset (524285 bytes) doesn't match the expected length (524288 bytes). #45

Closed
dinhanhx opened this issue Jan 3, 2021 · 5 comments

Comments

@dinhanhx
Copy link

dinhanhx commented Jan 3, 2021

  File "/home/lungsegment/virtualenv/medic/lib/python3.7/site-packages/pylidc/Scan.py", line 644, in to_volume
    for x in images
  File "/home/lungsegment/virtualenv/medic/lib/python3.7/site-packages/pylidc/Scan.py", line 644, in <listcomp>
    for x in images
  File "/home/lungsegment/virtualenv/medic/lib/python3.7/site-packages/pydicom/dataset.py", line 1716, in pixel_array
    self.convert_pixel_data()
  File "/home/lungsegment/virtualenv/medic/lib/python3.7/site-packages/pydicom/dataset.py", line 1435, in convert_pixel_data
    self._convert_pixel_data_without_handler()
  File "/home/lungsegment/virtualenv/medic/lib/python3.7/site-packages/pydicom/dataset.py", line 1545, in _convert_pixel_data_without_handler
    raise last_exception
  File "/home/lungsegment/virtualenv/medic/lib/python3.7/site-packages/pydicom/dataset.py", line 1525, in _convert_pixel_data_without_handler
    self._do_pixel_data_conversion(handler)
  File "/home/lungsegment/virtualenv/medic/lib/python3.7/site-packages/pydicom/dataset.py", line 1554, in _do_pixel_data_conversion
    arr = handler.get_pixeldata(self)
  File "/home/lungsegment/virtualenv/medic/lib/python3.7/site-packages/pydicom/pixel_data_handlers/numpy_handler.py", line 317, in get_pixeldata
    .format(actual_length, padded_expected_len)
ValueError: The length of the pixel data in the dataset (524285 bytes) doesn't match the expected length (524288 bytes). The dataset may be corrupted or there may be an issue with the pixel data handler.

This error encounter when I try to convert LIDC-IDRI-0401 to numpy array

@dinhanhx
Copy link
Author

dinhanhx commented Jan 3, 2021

On Debian with python 3.7

@notmatthancock
Copy link
Owner

It loads OK for me. Perhaps one of the DICOM files is corrupted as the exception message from pydicom suggests. Maybe try redownloading 0401 to see if the error persists?

@dinhanhx
Copy link
Author

dinhanhx commented Jan 3, 2021

It loads fine but on Windows. I will try redownload it later.

@notmatthancock
Copy link
Owner

It loads fine but on Windows.

FTR, the machine on which I loaded it is Ubuntu.

@notmatthancock
Copy link
Owner

stale

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

No branches or pull requests

2 participants