Skip to content

DICOM not loading #1713

@JumpLK

Description

@JumpLK

Describe the bug
I'm trying to load some data from the CHAOS challenge : https://zenodo.org/record/3431873#.YEX2o7rPyUk
I got an ITK error while trying to load it but I think that my version is up to date

To Reproduce
Download the dataset from the link above
Run this code (replace root_dir by the folder where you downloaded the data) :

from monai.transforms import LoadImage
import os

root_dir = r'..\datas\data_chaos\\'
CT_dir = root_dir + r'\train\Train_Sets\CT'

train_images_chaos = [os.path.join(CT_dir, x, 'DICOM_anon')  for x in os.listdir(CT_dir)]
data, meta = LoadImage()(train_images_chaos[0] +  "\i0000,0000b.dcm")

Expected behavior
Data should load

Environment

================================
Printing MONAI config...
================================
MONAI version: 0.4.0+127.g380f042
Numpy version: 1.19.2
Pytorch version: 1.7.1
MONAI flags: HAS_EXT = False, USE_COMPILED = False
MONAI rev id: 380f042dec9c55ba1a5ab241ae6b1a7b3e2b07fb

Optional dependencies:
Pytorch Ignite version: 0.4.2
Nibabel version: 3.2.1
scikit-image version: 0.18.1
Pillow version: 8.1.1
Tensorboard version: 2.4.1
gdown version: 3.12.2
TorchVision version: 0.8.2
ITK version: 5.1.2
tqdm version: 4.56.0
lmdb version: 1.1.1
psutil version: 5.8.0

For details about installing the optional dependencies, please visit:
    https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies


================================
Printing system config...
================================
System: Windows
Win32 version: ('10', '10.0.18362', 'SP0', 'Multiprocessor Free')
Win32 edition: Core
Platform: Windows-10-10.0.18362-SP0
Processor: Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
Machine: AMD64
Python version: 3.8.8
Process name: python.exe
Command: ['C:\\Users\\Camille\\anaconda3\\envs\\kitware\\python.exe', 'c:\\Users\\Camille\\Desktop\\important\\Kitware\\liver-segmentation\\segmentation\\tmp2.py']
Open files: [popenfile(path='C:\\Program Files\\WindowsApps\\Microsoft.LanguageExperiencePackfr-FR_18362.35.108.0_neutral__8wekyb3d8bbwe\\Windows\\System32\\fr-FR\\kernel32.dll.mui', fd=-1), popenfile(path='C:\\Program Files\\WindowsApps\\Microsoft.LanguageExperiencePackfr-FR_18362.35.108.0_neutral__8wekyb3d8bbwe\\Windows\\System32\\fr-FR\\KernelBase.dll.mui', fd=-1)]
Num physical CPUs: 6
Num logical CPUs: 12
Num usable CPUs: 12
CPU usage (%): [55.9, 22.3, 46.7, 11.4, 36.4, 12.4, 29.5, 25.8, 26.1, 22.5, 30.3, 48.9]
CPU freq. (MHz): 2208
Load avg. in last 1, 5, 15 mins (%): [0.0, 0.0, 0.0]
Disk usage (%): 90.1
Avg. sensor temp. (Celsius): UNKNOWN for given OS
Total physical memory (GB): 15.9
Available memory (GB): 8.8
Used memory (GB): 7.0

================================
Printing GPU config...
================================
Num GPUs: 1
Has CUDA: True
CUDA version: 10.2
cuDNN enabled: True
cuDNN version: 7605
Current device: 0
Library compiled for CUDA architectures: ['sm_37', 'sm_50', 'sm_60', 'sm_61', 'sm_70', 'sm_75', 'compute_37']
GPU 0 Name: GeForce GTX 1070 with Max-Q Design
GPU 0 Is integrated: False
GPU 0 Is multi GPU board: False
GPU 0 Multi processor count: 16
GPU 0 Total memory (GB): 8.0
GPU 0 Cached memory (GB): 0.0
GPU 0 Allocated memory (GB): 0.0
GPU 0 CUDA capability (maj.min): 6.1

Additional Context
Here is the error message I got :

Traceback (most recent call last):
  File "C:\Users\Camille\anaconda3\envs\kitware\lib\site-packages\itkTemplate.py", line 336, in __getitem__
    return(self.__template__[tuple(cleanParameters)])
KeyError: (<itkCType signed int>, 3)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Camille\anaconda3\envs\kitware\lib\site-packages\itkTemplate.py", line 340, in __getitem__
    return(self.__template__[tuple(cleanParameters)])
KeyError: (<itkCType signed int>, 3)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Users\Camille\Desktop\important\Kitware\liver-segmentation\segmentation\tmp2.py", line 9, in <module>
    data, meta = LoadImage()(train_images_chaos[0] +  "\i0000,0000b.dcm")
  File "C:\Users\Camille\anaconda3\envs\kitware\lib\site-packages\monai\transforms\io\array.py", line 149, in __call__
    img = reader.read(filename)
  File "C:\Users\Camille\anaconda3\envs\kitware\lib\site-packages\monai\data\image_reader.py", line 191, in read
    img_.append(itk.imread(name, **kwargs_))
  File "C:\Users\Camille\anaconda3\envs\kitware\lib\site-packages\itkExtras.py", line 645, in imread
    reader = TemplateReaderType.New(**kwargs)
  File "C:\Users\Camille\anaconda3\envs\kitware\lib\site-packages\itkTemplate.py", line 469, in New
    return self._NewImageReader(itk.ImageFileReader, False, 'FileName', *args, **kwargs)
  File "C:\Users\Camille\anaconda3\envs\kitware\lib\site-packages\itkTemplate.py", line 579, in _NewImageReader
    ImageType = itk.Image[PixelType, dimension]
  File "C:\Users\Camille\anaconda3\envs\kitware\lib\site-packages\itkTemplate.py", line 342, in __getitem__
    raise TemplateTypeError(self, tuple(cleanParameters))
itkTemplate.TemplateTypeError: itk.Image is not wrapped for input type `itk.SI, int`.

To limit the size of the package, only a limited number of
types are available in ITK Python. To print the supported
types, run the following command in your python environment:

    itk.Image.GetTypes()

Possible solutions:
* If you are an application user:
** Convert your input image into a supported format (see below).
** Contact developer to report the issue.
* If you are an application developer, force input images to be
loaded in a supported pixel type.

    e.g.: instance = itk.Image[itk.RGBPixel[itk.UC], int].New(my_input)

* (Advanced) If you are an application developer, build ITK Python yourself and
turned to `ON` the corresponding CMake option to wrap the pixel type or image
dimension you need. When configuring ITK with CMake, you can set
`ITK_WRAP_${type}` (replace ${type} with appropriate pixel type such as
`double`). If you need to support images with 4 or 5 dimensions, you can add
these dimensions to the list of dimensions in the CMake variable
`ITK_WRAP_IMAGE_DIMS`.

Supported input types:

itk.RGBPixel[itk.UC]
itk.RGBAPixel[itk.UC]
itk.Vector[itk.F,2]
itk.Vector[itk.F,3]
itk.Vector[itk.F,4]
itk.CovariantVector[itk.F,2]
itk.CovariantVector[itk.F,3]
itk.CovariantVector[itk.F,4]
itk.SS
itk.UC
itk.US
itk.F
itk.D
itk.complex[itk.F]
itk.Vector[itk.D,2]
itk.Vector[itk.D,3]
itk.Vector[itk.D,4]
itk.UL
itk.ULL
itk.B
itk.FixedArray[itk.F,2]
itk.FixedArray[itk.D,2]
itk.Offset[2]
itk.SymmetricSecondRankTensor[itk.D,2]
itk.RGBPixel[itk.UC]
itk.RGBAPixel[itk.UC]
itk.Vector[itk.F,2]
itk.Vector[itk.F,3]
itk.Vector[itk.F,4]
itk.CovariantVector[itk.F,2]
itk.CovariantVector[itk.F,3]
itk.CovariantVector[itk.F,4]
itk.SS
itk.UC
itk.US
itk.F
itk.D
itk.complex[itk.F]
itk.Vector[itk.D,2]
itk.Vector[itk.D,3]
itk.Vector[itk.D,4]
itk.UL
itk.ULL
itk.B
itk.FixedArray[itk.F,3]
itk.FixedArray[itk.D,3]
itk.Offset[3]
itk.SymmetricSecondRankTensor[itk.D,3]
itk.Vector[itk.F,1]
itk.Vector[itk.D,2]
itk.Vector[itk.D,3]
itk.Vector[itk.D,4]
itk.Vector[itk.F,1]
itk.CovariantVector[itk.D,2]
itk.CovariantVector[itk.D,3]
itk.CovariantVector[itk.D,4]
itk.CovariantVector[itk.D,2]
itk.CovariantVector[itk.D,3]
itk.CovariantVector[itk.D,4]
itk.NormalBandNode[itk.Image[itk.F,2]]
itk.NormalBandNode[itk.Image[itk.D,2]]
itk.NormalBandNode[itk.Image[itk.F,3]]
itk.NormalBandNode[itk.Image[itk.D,3]]

Metadata

Metadata

Assignees

No one assigned

    Labels

    WG: IOFor the IO working groupquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions