Questions tagged [pydicom]

pydicom is a pure Python package for working with DICOM files such as medical images, reports, and radiotherapy objects.

pydicom is a pure Python package for working with DICOM files. pydicom makes it easy to read these complex files into natural pythonic structures for easy manipulation. Modified datasets can be written again to DICOM format files.

Resources

276 questions
1
vote
2 answers

How can I save the metadata only of a dicom image, without the PixelArray?

I have a Dicom Image and I did read it with pydicom.dcmread('1.dcm'). how can I write just the metadata, without the pixel_array? either as dictionary, or as dicom format. I tried to do it with the following piece of code, but it didn't…
Bilal
  • 3,191
  • 4
  • 21
  • 49
1
vote
1 answer

How to save Dicom Image with dicom format after anonymization?

I read a dicom image with all metadate, and anonymized some fields, I want to write it again after that, but I get the error: if None in (dataset.is_little_endian, dataset.is_implicit_VR): AttributeError: 'dict' object has no attribute…
Bilal
  • 3,191
  • 4
  • 21
  • 49
1
vote
1 answer

KeyError due to missing tag when converting DCM to CSV

I would appreciate your help with this. I want to convert DCM to CSV here's the code that I try PathDicom = "path image" dicom_image_description = pd.read_csv("dicom_image_description.csv") # Specify the .dcm folder path folder_path =…
tae
  • 21
  • 4
1
vote
1 answer

JPEG2000 Losses Read DICOM in Python 3.7

In my Python 3.7, I want to read DICOM. But I face this notification: NotImplementedError: this transfer syntax JPEG 2000 Image Compression (Lossless Only), can not be read because Pillow lacks the jpeg 2000 decoder plugin. I've tried this…
1
vote
2 answers

Cannot find DICOM attribute (0020,4000 [Image Comments])

I am writing a script using pydicom to automatize ultrasound medical reports. However, I cannot find the 0020,4000 [Image Comments] attribute. I have tried with different images from different ultrasound machines and also with dcmdump from dcmtk…
Brainsdead
  • 13
  • 3
1
vote
0 answers

Convert the audio data from a DICOM file in a numpy array with pydicom

I want to access the audio data in a DICOM file. According to the page about DICOM attributes, the audio data in dicom file has the following attributes: Audio Sample Data: OW or OB (50xx,200C) indeed when looking at the list of available…
ecjb
  • 5,169
  • 12
  • 43
  • 79
1
vote
1 answer

Can not display Image read with pydicom (Invalid Image Shape)

I am writing a simple code to read dicom images, But it gives me an error when i try to displaying it whith matplotlib here is my code : import pydicom import matplotlib.pyplot as plt ds = pydicom.dcmread("C:/Users/A763194/Desktop/Cone…
Salma Hakim
  • 105
  • 8
1
vote
2 answers

Can't pickle a pydicom Dataset and not sure why

I've got a problem where a list of pydicom Dataset (ie dicom images) isn't picklable, and I'm not sure why. This is a pydicom specific question - I tried first posting to their google mailing list, but for some reason there list server was failing -…
Richard
  • 3,024
  • 2
  • 17
  • 40
1
vote
2 answers

How to fetch a dicom element from a .dcm file using pydicom if an element is in square brackets

I am trying to extract a dicom file using pydicom library. filename="C:\\Users\\1016086\\PycharmProjects\\untitled\\dicomeSample.dcm' dataset = pydicom.dcmread(filename) So, I have to get the value of below element (0011, 1004) [Acquisition…
Baburaj V
  • 63
  • 1
  • 2
  • 12
1
vote
3 answers

How to adjust the viewing window of .mhd file to get a better look at medical images?

I load some .mdh and .raw files for medical images, but one thing bothers me. I understand that in .dicom file, you can convert pixel intensity to HU by using rescale.slope and rescale.intercept, which .mhd file fail to include. Therefore, I am…
yujuezhao
  • 1,015
  • 3
  • 11
  • 21
1
vote
1 answer

Issue with pixel_array using pydicom on python 3.x

I'm using pydicom (installed with pip3, on python 3.7, using Idle) and I need to access pixel_array values. I just copy-paste the example provided into the documentation and this leads to two errors: first is about the get_testdata_files operation,…
1
vote
1 answer

How to create a pydicom Tag from its name?

Is it possible to create a Tag (pydicom.tag.Tag) only from its name? For instance, 'Rows' is associated to (0028,0010). Creating a Tag for it would be: tag=pydicom.tag.Tag(0x28,0x10) I would like to create the same tag from its name,…
BayesianMonk
  • 540
  • 7
  • 23
1
vote
2 answers

What is the difference between ds.get() and ds.get_item() in pydicom

Does anyone know what is the difference in Pydicom between the two methods FileDataset.get() and FileDataset.get_item()? Thanks!
BayesianMonk
  • 540
  • 7
  • 23
1
vote
2 answers

Unable to read dicom file with Python3 and pydicom

I trying to read dicom file with python3 and pydicom library. For some dicom data, I can't get data correctly and get error messages when I tried to print the result of pydicom.dcmread. However, I have tried to use python2 and it worked well. I…
Tom
  • 21
  • 1
  • 2
1
vote
1 answer

Can't write details extracted from DICOM file to csv file

I am not able to write the details extracted from a DICOM file to a CSV file. Here's the code which I have used - import pydicom import os import pandas as pd import csv import glob data_dir= 'C:\\Users\\dmgop\\Personal\\TE Project -…
Dev
  • 62
  • 7