Skip to content

Compatibility Query: Using PathML for X-Ray Images with Missing 'TotalPixelMatrixRows' Attribute #401

@xinyuejohn

Description

@xinyuejohn

Describe the bug
I was trying to load a chest X-ray image in DICOM format, but encountered an error. It seems my DICOM file lacks an attribute called 'TotalPixelMatrixRows,' which is part of the DICOM Whole Slide Microscopy Image Module (for more information, see: https://dicom.innolitics.com/ciods/vl-whole-slide-microscopy-image/whole-slide-microscopy-image/00480007).

Since PathML is primarily used for cell images captured by microscopy, I'm curious to know if it can also handle other types of medical images, such as X-ray images. Could you please advise on this?

To Reproduce

  1. Download Data from https://www.visus.com/fileadmin/content/pictures/Downloads/JiveX_DICOME_Viewer/case1.zip (8 MB)
  2. Read data
from pathml.core import HESlide
my_dcm_image = HESlide("case1/case1_008.dcm", backend = "DICOM")

Traceback

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-15-a1c013ee4f14> in <cell line: 1>()
----> 1 my_dcm_image = HESlide("./data/case1_008.dcm", backend = "DICOM")

3 frames
/usr/local/lib/python3.10/dist-packages/pathml/core/slide_data.py in __init__(self, *args, **kwargs)
    510     def __init__(self, *args, **kwargs):
    511         kwargs["slide_type"] = pathml.core.types.HE
--> 512         super().__init__(*args, **kwargs)
    513 
    514 

/usr/local/lib/python3.10/dist-packages/pathml/core/slide_data.py in __init__(self, filepath, name, masks, tiles, labels, backend, slide_type, stain, platform, tma, rgb, volumetric, time_series, counts, dtype)
    166             backend_obj = pathml.core.BioFormatsBackend(filepath, dtype)
    167         elif backend.lower() == "dicom":
--> 168             backend_obj = pathml.core.DICOMBackend(filepath)
    169         elif backend.lower() == "h5path":
    170             backend_obj = None

/usr/local/lib/python3.10/dist-packages/pathml/core/slide_backends.py in __init__(self, filename)
    643         # can use frame shape, total shape to map between frame index and coords
    644         self.frame_shape = (metadata.Rows, metadata.Columns)
--> 645         self.shape = (metadata.TotalPixelMatrixRows, metadata.TotalPixelMatrixColumns)
    646         self.n_frames = int(metadata.NumberOfFrames)
    647         # use ceiling division to account for padding (i.e. still count incomplete frames on edge)

/usr/local/lib/python3.10/dist-packages/pydicom/dataset.py in __getattr__(self, name)
    906             return {}
    907         # Try the base class attribute getter (fix for issue 332)
--> 908         return object.__getattribute__(self, name)
    909 
    910     @property

AttributeError: 'FileDataset' object has no attribute 'TotalPixelMatrixRows'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions