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

Created on 28 Aug 2020  路  5Comments  路  Source: InsightSoftwareConsortium/ITK

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.

Bug

All 5 comments

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?

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

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

https://github.com/InsightSoftwareConsortium/ITK/blob/9b7a28032ef46034f91cdc98bb99f4b3f24f270c/Modules/IO/GDCM/src/itkGDCMImageIO.cxx#L429

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

WIP

https://github.com/InsightSoftwareConsortium/ITK/pull/2004

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Leengit picture Leengit  路  6Comments

blowekamp picture blowekamp  路  4Comments

dzenanz picture dzenanz  路  8Comments

thewtex picture thewtex  路  6Comments

issakomi picture issakomi  路  3Comments