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

Support DICOM VIDEO #1872

Closed
opennog opened this issue Aug 22, 2023 · 3 comments
Closed

Support DICOM VIDEO #1872

opennog opened this issue Aug 22, 2023 · 3 comments

Comments

@opennog
Copy link

opennog commented Aug 22, 2023

Hi

I'm starting to work with DICOM VIDEOS such as the one attached, but in multiple cases it seems pydicom is not able to read the data.
video_heart.zip

I wanted to ask if you could give support to such type of files. At the time being I'm getting the following error with pydicom==2.3.1

ds.pixel_array
Traceback (most recent call last):
  File "/home/oscar/dev/qmenta_imaging/venv38/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3508, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-967c46e3e5fc>", line 1, in <module>
    ds.pixel_array
  File "/home/oscar/dev/qmenta_imaging/venv38/lib/python3.8/site-packages/pydicom/dataset.py", line 1955, in pixel_array
    self.convert_pixel_data()
  File "/home/oscar/dev/qmenta_imaging/venv38/lib/python3.8/site-packages/pydicom/dataset.py", line 1512, in convert_pixel_data
    self._convert_pixel_data_without_handler()
  File "/home/oscar/dev/qmenta_imaging/venv38/lib/python3.8/site-packages/pydicom/dataset.py", line 1564, in _convert_pixel_data_without_handler
    raise NotImplementedError(
NotImplementedError: Unable to decode pixel data with a transfer syntax UID of '1.2.840.10008.1.2.4.103' (MPEG-4 AVC/H.264 BD-compatible High Profile / Level 4.1) as there are no pixel data handlers available that support it. Please see the pydicom documentation for information on supported transfer syntaxes

Best.

@mrbean-bremen
Copy link
Member

The problem is that pydicom relies on third-party packages to decode compressed files, and these support only a limited number of transfer syntaxes, video codecs not among them.
I agree that it makes sense to also support video transfer syntaxes, but for this we need to have a suitable Python package with a compatible license that is able to decode them and has a suitable interface to write an adapter (image data handler) for pydicom. We certainly won't write a decoder ourselves.
This is not something that will be done in the near future IMHO (except someone turns up with a suitable PR...), so if that is urgent for you I'm afraid yiu are out of luck.

@scaramallion
Copy link
Member

Just to clarify, the Dataset.pixel_array property is unable to return the data as a numpy array, however the raw video data stream is still available in Dataset.PixelData. You should be able to convert that to a regular video file and do with it as you wish.

@opennog
Copy link
Author

opennog commented Aug 24, 2023

Thank you very much for your input. I'll see what I can do and will let you know if I find a decoder.
Best!

@scaramallion scaramallion closed this as not planned Won't fix, can't repro, duplicate, stale May 31, 2024
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