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
2
votes
1 answer

How to get 3D reconstruction of dicom slices in python?

I have a directory containing .dcm files of a single scan. I am able to get the 2D views ( which i cross-checked with other dicom viewers ). But i couldn't get the 3D view working. I tried using the vtkDICOMImageReader class but it couldn't read the…
2
votes
3 answers

Is there an easy way to find the type of a DICOM tag?

For creating an anonymization/de-identification tool I would like to delete/overwrite all tags/attributes from the DICOM file that are not necessary. I've searched around the internet, but have not found a clear list of which tags are mandatory for…
Jopie
  • 29
  • 3
2
votes
1 answer

Overwriting DICOMDIR file with pydicom

I am editing the meta data of multiple dicom images, divided between dicomdirs. I have successfully loaded the dicomdir, traversed it to find the images, edited their meta data and overwritten the original dicom files. I then successfully overwrite…
jommi
  • 21
  • 2
2
votes
1 answer

How to fix "LookupError: unknown encoding: ISO_IR 149"

I am working on changing dicom headers using pydicom. PatientName contains Korean, so I modified PatientName to English. After that, ISO_IR_149 Error is output when trying to save. I looked in charset.py for the part related to ISO_IR_149, but I…
KScript
  • 53
  • 7
2
votes
2 answers

How to add dicom tags for a series of dicom images?

I want to add Dicom tags to a series of Dicom images and want to save that modified batch. I have written a simple python script using pydicom which can edit and add dicom tags in a single Dicom image, but i want to do same procedure for complete…
2
votes
2 answers

pydicom Dataset: send_c_find return success but status.pixel_array has error text in it

I'm using dcm4chee as PACS server and I'm trying to retrieve a study based on a patient name. The relevant code is: ae = AE() ae.add_requested_context(PatientRootQueryRetrieveInformationModelFind) ae.add_requested_context(VerificationSOPClass) assoc…
sha1111
  • 31
  • 1
2
votes
2 answers

dicom file read error: 'RuntimeError: generator raised StopIteration'

below is the python code def load_scan(path): print(path) slices = [dicom.read_file(path + '/' + s) for s in os.listdir(path)] slices.sort(key = lambda x: int(x.InstanceNumber)) try: slice_thickness = np.abs(slices[0].ImagePositionPatient[2] -…
Radhi
  • 6,289
  • 15
  • 47
  • 68
2
votes
3 answers

No available image handler could decode this transfer syntax JPEG Lossless when read DICOM and ploting using matplotlib

When i use pydicom in python3.6, there are some problem: import pydicom import matplotlib.pyplot as plt import os import pylab filePath = "/Users/zhuangrui/Documents/Python/Dicom/dicoms/zhang_bo/0001.dcm" dataSet_1 =…
2
votes
1 answer

Support for pydicom library when viewing DICOM files on python lost content

I'm using the pydicom library to see a DICOM file as shown in Figure 2, but I want to figure out the number 3. I do not know how to do that. You help guide me. I thank you import matplotlib.pyplot as plt from matplotlib import pylab import…
2
votes
1 answer

Read DICOM objects from PosixPath, Python

I have 20,000 PosixPath, each one pointing at a different .dcm object. I need to read .dcm objects one by one. Here is my code so far: from pathlib import Path import glob import dicom data = Path('/data') path_to_dcm_objects =…
user9439906
  • 433
  • 2
  • 7
  • 17
2
votes
1 answer

Dimensional axis when using read_file in dicom package in python

I have a stack of DICOM images that I'm reading in with the Python dicom package: my_dicom = dicom.read_file('my_dicom.dcm') my_dicom = my_dicom.pixel_array My image is a actually a stack of 256 images, each with 3 channels and with dimensions of…
Monica Heddneck
  • 2,973
  • 10
  • 55
  • 89
2
votes
1 answer

How to fix encoding issues of pydicom in python

This is the code: import dicom ds = dicom.read_file(FILE_PATH) print(ds) Error: LookupError: unknown encoding: ISO 2022 IR 100 When using pydicom in order to look at data, I got the error above. I found 'ISO 2022 IR 100': 'latin_1' ,according…
2
votes
1 answer

pydicom 'Dataset' object has no attribute 'TransferSyntaxUID'

I'm using pydicom 1.0.0a1, downloaded from here, When I run the following code: ds=pydicom.read_file('./DR/abnormal/abc.dcm',force=True) ds.pixel_array this error…
user6191682
  • 67
  • 1
  • 3
  • 9
2
votes
4 answers

Python error with dicom.read_file()

I am writing an app to do something with DICOM images with Python (using Pydicom library). Unfortunately I am stuck at the very beginning with a problem that shouldn't exist, according to the tutorials I read (f.e. here ). The code is simple and…
jakubkrol
  • 65
  • 1
  • 9
2
votes
2 answers

Annotate DICOM files

I am looking for an application, either inside or outside Python, that will allow me to take an existing DICOM file, subsequently add some markers to the medical image (e.g. coloured points) and then save the coordinates of these markers and the…
user1885116
  • 1,757
  • 4
  • 26
  • 39