Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8090165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:37:55+00:00 2026-06-05T19:37:55+00:00

I am using DICOM with Python and Pydicom library, when I have used .dcm

  • 0

I am using DICOM with Python and Pydicom library, when I have used .dcm files I hadn’t problems. But I am using DICOMDIR data sets now.

My code is the next:

ds = dicom.read_file("dicomdir")

I tried to access to the pixel_array elements as follows:

data = ds.pixel_array

And I get the next error: TypeError: No pixel data found in this dataset.

The output for print ds is more or less the next:

(0004, 1130) File-set ID CS: ‘GEMS_11_10_111’
(0004, 1200) Offset of the First Directory Recor UL: 412
(0004, 1202) Offset of the Last Directory Record UL: 412
(0004, 1212) File-set Consistency Flag US: 0
(0004, 1220) Directory Record Sequence 7 item(s) —-
(0004, 1400) Offset of the Next Directory Record UL: 0
(0004, 1410) Record In-use Flag US: 65535
(0004, 1420) Offset of Referenced Lower-Level Di UL: 558
(0004, 1430) Directory Record Type CS: ‘PATIENT’
(0008, 0005) Specific Character Set CS: ‘ISO_IR 100’
(0010, 0010) Patient’s Name PN: ‘——————‘
(0010, 0020) Patient ID LO: ‘246992’
(0010, 0030) Patient’s Birth Date DA: ‘19630523’
(0010, 0040) Patient’s Sex CS: ‘F’


(0004, 1400) Offset of the Next Directory Record UL: 0
(0004, 1410) Record In-use Flag US: 65535
(0004, 1420) Offset of Referenced Lower-Level Di UL: 800
(0004, 1430) Directory Record Type CS: ‘STUDY’
(0008, 0005) Specific Character Set CS: ‘ISO_IR 100’
(0008, 0020) Study Date DA: ‘20111011’
(0008, 0030) Study Time TM: ‘151535.000000’
(0008, 0050) Accession Number SH: ‘1009819901’
(0008, 1030) Study Description LO: ‘MG CONVENCIONAL’
(0020, 000d) Study Instance UID UI: 1.2.840.113564.9.1.2005121220021252.20110608105548.21009819901
(0020, 0010) Study ID SH: ‘1009819901’


(0004, 1400) Offset of the Next Directory Record UL: 0
(0004, 1410) Record In-use Flag US: 65535
(0004, 1420) Offset of Referenced Lower-Level Di UL: 968
(0004, 1430) Directory Record Type CS: ‘SERIES’
(0008, 0005) Specific Character Set CS: ‘ISO_IR 100’
(0008, 0060) Modality CS: ‘MG’
(0008, 103e) Series Description LO: ‘Screen Save’
(0020, 000e) Series Instance UID UI: 1.2.840.113619.2.144.2347322947.2192645372.5
(0020, 0011) Series Number IS: ‘354’


(0004, 1400) Offset of the Next Directory Record UL: 1298
(0004, 1410) Record In-use Flag US: 65535
(0004, 1420) Offset of Referenced Lower-Level Di UL: 0
(0004, 1430) Directory Record Type CS: ‘IMAGE’
(0004, 1500) Referenced File ID CS: [‘DICOM’, ‘PA1’, ‘ST1’, ‘SE1’, ‘IM1’]
(0004, 1510) Referenced SOP Class UID in File UI: Secondary Capture Image Storage
(0004, 1511) Referenced SOP Instance UID in File UI: 1.2.840.113619.2.144.44653394.14990.1318380911.86
(0004, 1512) Referenced Transfer Syntax UID in F UI: Explicit VR Little Endian
(0008, 0005) Specific Character Set CS: ‘ISO_IR 100’
(0008, 0008) Image Type CS: ‘DERIVED’
(0008, 0023) Content Date DA: ‘20111011’
(0008, 0033) Content Time TM: ‘151909.000000’
(0020, 0013) Instance Number IS: ‘8844’
(0028, 0010) Rows US: 2298
(0028, 0011) Columns US: 1980
(0028, 1052) Rescale Intercept DS: ‘0’
(0028, 1053) Rescale Slope DS: ‘1’


The last part is repeated four times. I have 4 images in my DICOMDIR dataset.

Do you know how access to the field with the Numpy Array for each image?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:37:57+00:00Added an answer on June 5, 2026 at 7:37 pm

    I received an answer in Pydicom User Forum by Suever:

    DICOMDIR files do not contain any pixel information but rather basic header information along with the path to each file in the dataset. In order to get the pixel data from each of the images, you’ll have to traverse the dicomdir dataset to get the filepaths to the individual dicom files (relative to the current directory) and then load the pixel data from each of the individual dicom files.

    A simple way to do this would be (there may be better ways)

        ds = dicom.read_file("dicomdir")
        pixel_data = list()
        for record in ds.DirectoryRecordSequence:
            if record.DirectoryRecordType == "IMAGE":
            # Extract the relative path to the DICOM file
                path = os.path.join(*record.ReferencedFileID)
                dcm = dicom.read_file(path)
    
                # Now get your image data
                pixel_data.append(dcm.pixel_array)
    

    It works 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using open source C++ library DCMTK from http://dicom.offis.de/dcmtk.php.en . I have successfully
I'm using mDCM with C# to view dicom tags, but I'm trying to convert
I have two different types of dicom(medical imaging files) in the same folder. I
I have a raw pixel data in a byte[] from a DICOM image. Now
Using PHP, I can convert MySQL data or static table data to csv, Excel,
Using C# for ASP.NET and MOSS development, we often have to embed JavaScript into
Using top it's easy to identify processes that are hogging memory and cpu, but
I have a stack of 2D dicom images and want to convert to a
For many years I have used the old SAP DCOM Connector to communicate between
I'm new to Python so forgive my ignorance If I don't have all the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.