Skip to content

Using FileSet to read a DICOMDIR file generates a deprecation warning #1752

@marcelzwiers

Description

@marcelzwiers

Describe the bug
I am reading a DICOMDIR file using fileset.Fileset, as advised in the docs, but I get a dcmread deprecation warning:

    dicomdir = fileset.FileSet(folder/'DICOMDIR')
/opt/bidscoin/lib/python3.10/site-packages/pydicom/fileset.py:1003: in __init__
    self.load(ds)
/opt/bidscoin/lib/python3.10/site-packages/pydicom/fileset.py:1646: in load
    ds = dcmread(ds_or_path)
/opt/bidscoin/lib/python3.10/site-packages/pydicom/filereader.py:1021: in dcmread
    dataset = read_partial(
_ _ _

        # (0002, 0002) Media Storage SOP Class UID
        elem = file_meta.get(0x00020002, None)
        sop_class = elem.value.name if (elem and elem.VM == 1) else ""
        if sop_class == "Media Storage Directory Storage":
>           warnings.warn(
                "The 'DicomDir' class is deprecated and will be removed in v3.0, "
                "after which 'dcmread()' will return a normal 'FileDataset' "
                "instance for 'Media Storage Directory' SOP Instances.",
                DeprecationWarning
            )
E           DeprecationWarning: The 'DicomDir' class is deprecated and will be removed in v3.0, after which 'dcmread()' will return a normal 'FileDataset' instance for 'Media Storage Directory' SOP Instances.

/opt/bidscoin/lib/python3.10/site-packages/pydicom/filereader.py:872: DeprecationWarning

A clear and concise description of what the bug is.

Expected behavior
I expect this warning to be generated only if I had used dcmread directly.

Steps To Reproduce
See code above

Your environment

module       | version
------       | -------
platform     | Linux-4.19.94-300.el7.x86_64-x86_64-with-glibc2.17
Python       | 3.10.4 (main, Mar 31 2022, 08:41:55) [GCC 7.5.0]
pydicom      | 2.3.0
gdcm         | _module not found_
jpeg_ls      | _module not found_
numpy        | 1.23.2
PIL          | 9.2.0
pylibjpeg    | _module not found_
openjpeg     | _module not found_
libjpeg      | _module not found_

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions