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

Bug: GDCMImageIO issue loading single-bit binary dcm mask. #1969

Closed
gagandaroach opened this issue Aug 28, 2020 · 5 comments · Fixed by #2010
Closed

Bug: GDCMImageIO issue loading single-bit binary dcm mask. #1969

gagandaroach opened this issue Aug 28, 2020 · 5 comments · Fixed by #2010
Labels
type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances

Comments

@gagandaroach
Copy link

gagandaroach commented Aug 28, 2020

Description

Hello. I am running into an error processing a medical image segmentation DICOM file from The Cancer Imaging Archive. When I call itk.imread() on the datapoint, the GDCMImageIo library is throwing an Unhandled PixelFormat: SamplesPerPixel :1 error.

The python SimpleITK library throws the same error.

Steps to Reproduce

1. itk.imread(seg_file)

Expected behavior

Dicom mask file is loaded into an image.

Actual behavior

Log from crash

>>> segpath
'/nvdata/NSCLC-Radiogenomics-Fresh/NSCLC Radiogenomics/R01-041/09-07-1992-CT THORAX WO DYE-33339/1000.000000-3D Slicer segmentation result-38898/1-1.dcm'
>>> itkseg = itk.imread(segpath)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/gagan/anaconda3/envs/monai/lib/python3.8/site-packages/itkExtras.py", line 645, in imread
    reader = TemplateReaderType.New(**kwargs)
  File "/home/gagan/anaconda3/envs/monai/lib/python3.8/site-packages/itkTemplate.py", line 469, in New
    return self._NewImageReader(itk.ImageFileReader, False, 'FileName', *args, **kwargs)
  File "/home/gagan/anaconda3/envs/monai/lib/python3.8/site-packages/itkTemplate.py", line 555, in _NewImageReader
    imageIO.ReadImageInformation()
RuntimeError: /work/ITK-source/ITK/Modules/IO/GDCM/src/itkGDCMImageIO.cxx:465:
itk::ERROR: itk::ERROR: GDCMImageIO(0x5633c7065c20): Unhandled PixelFormat: SamplesPerPixel    :1
BitsAllocated      :1
BitsStored         :1
HighBit            :0
PixelRepresentation:0
ScalarType found   :SINGLEBIT

Reproducibility

I am using CT scan image data from this NSCLC Radiogenomics TCIA dataset. The error happens every time I try to a patients 3d chest ct segmentation .dcm file.

Environment

Debian Buster, Cmake == 3.16.3, itk == 5.1.1, python == 3.8.3

Additional Information

I want to use the GDCM SingleBit pixelformat in the GDCM docs, but I am not sure how to pass it in through itk.

@gagandaroach gagandaroach added the type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances label Aug 28, 2020
@gagandaroach
Copy link
Author

I've learned the file is saved as a Dicom-RT file. I was able to load it with pydicom and got a pydicom.dataset.FileDataset file. Is it possible to do this with ITK?

@dzenanz
Copy link
Member

dzenanz commented Aug 31, 2020

@issakomi and/or @malaterre can best answer this.

@issakomi
Copy link
Member

Unfortunately singlebit is not implemented in GDCM IO. It is defined in GDCM, should be not very difficult to add, AFAIK.

switch (pixeltype)

@gagandaroach
Copy link
Author

I'm not sure how to add the feature but I would be happy to test it out.

@issakomi
Copy link
Member

issakomi commented Sep 16, 2020

WIP

#2004

Edit:
PR is ready, sample file and simple test s. post

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances
Projects
None yet
3 participants