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
0
votes
0 answers

Find images with similar content to the source image on python

I'm working on a subject that identifies areas of cerebral hemorrhage and there is a problem like this: I use the tensorflow library to format the cerebral hemorrhage, then save it as a png file. Now I want to find images of cerebral hemorrhage like…
0
votes
1 answer

How can I display image without CT with pydicom?

How can I display image without CT (contouring) with pydicom? Currently it shows the image but it includes the contouring and I would like to show the root image and if it could, the contouring without the root image and here is my code for…
0
votes
1 answer

Speed up extraction of coordinates from DICOM structure set

Using numpy.reshape helped a lot and using map helped a little. Is it possible to speed this up some more? import pydicom import numpy as np import cProfile import pstats def parse_coords(contour): """Given a contour from a DICOM…
0
votes
2 answers

Replace AttributeError with NAN in python

I am using the following code in python to read the series description from the dicom header. ds = dicom.read_file(mydcmfile.dcm) a=ds.SeriesDescription However, I get the following error because this part is blank in the dicom header for this…
Mehdi
  • 1,146
  • 1
  • 14
  • 27
0
votes
1 answer

I install gdcm in windows ,then i "import gdcm" in python, I got anerror

I install gdcm in windows ,then I "import gdcm" in python, I got this error, My environment is python2.7.9, gdcm is GDCM-2.8.4-Windows-x86_64,
zhangyaoyao
  • 11
  • 1
  • 4
0
votes
1 answer

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

import pydicom filename = r"E:\Codes\Python\tt.dcm"; ds = pydicom.read_file(filename,force=True) ds.pixel_array then, this error occurs : AttributeError: 'FileDataset' object has no attribute 'PixelRepresentation' the error information : wrong…
zhangyaoyao
  • 11
  • 1
  • 4
0
votes
1 answer

Can't convert 'bytes' object to str implicitly for DCM to raw file

I learn how to convert DCM file to Raw file .Got the code from Git Hub: https://github.com/xiasun/dicom2raw/blob/master/dicom2raw.py And it got a error"Can't convert 'bytes' object to str implicitly" on the line "allInOne += dataset.PixelData" I try…
PHE
  • 63
  • 8
0
votes
2 answers

pydicom is not defined

I'm trying to learn how to use pydicom for reading and processing dicom images. I'm using Python 3. import dicom import numpy ds = pydicom.read_file(lstFilesDCM[0]) print(ds.pixel_array)` I get an error NameError: name 'pydicom' is not defined. If…
Kuni
  • 817
  • 1
  • 9
  • 24
0
votes
1 answer

Siemens CT dose report/patient protocol PixelData

I’m trying to extract dicom PixelData from Siemens’ dose report but it contains only zeros. With GE dose report I read the data without a trouble with pydicom or simpleITK. Any ideas why siemens report contains only zeros? Thanks! Came this far, but…
davidx300
  • 1
  • 2
0
votes
1 answer

How to extract and save video inside a DICOM?

I have a dicom file containing ultrasound video and images. I can extract the image (BaseJPEG) but can not extract the video sequence. The data is definitely available inside the dicom file, I can see it in tag ('7fe1','1001'). The string of the…
0
votes
1 answer

dicom image resizing before converting to numpy array

I have thousands of dicom images in a folder. I read them with pydicom like this import numpy as np import dicom folder = "/images" imgs = [dicom.read_file(folder + '/' + s) for s in os.listdir(folder)] I then want to stack all images as a numpy…
spore234
  • 3,550
  • 6
  • 50
  • 76
0
votes
2 answers

Trying to edit private dicom tag

I'm currently trying to edit a private dicom tag which is causing problems with a radiotherapy treatment, using pydicom in python. Bit of a python newbie here so bear with me. The dicom file imports correctly into python; I've attached some of the…
Piethon
  • 227
  • 2
  • 11
0
votes
1 answer

Shutil multiple files after reading with "pydicom"

What I basicalling want is for myvar to vary between 1-280 so that I can use this to read the file using pydicom. I.e. I want to read the files between /data/lfs2/model-mie/inputDataTest/subj2/mp2rage/0-280_tfl3d1.IMA. Then if M is true in gender…
0
votes
2 answers

I installed pydicom through pip but it somehow cannot be found when I try to import the library. Could someone give a suggestion to fix this?

Please see this screenshot: Isn't the package pydicom already installed? Credit to Igor: It looks like that it's working in Sublime Text 2's build using "import dicom". However it is still somehow not working in my Eclipse with PyDev…
A. Z. Guo
  • 11
  • 1
  • 3
0
votes
2 answers

How to get a picture out of raw hex data in python?

I am using pydicom for extracting image data out of a dicom file. Unfortunately pydicom fails to directly extract a numpy array of data I can directly use, but I get a data string containing all values in hex (i.e. f.eks.…
arc_lupus
  • 3,942
  • 5
  • 45
  • 81