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

Pydicom private tag written as "UN"

I am adding some private tags with VR "LO" to an already existing DICOM file. With something like: dcm.add_new("70d12000", "LO", "Private tag content") Getting the following output when printing the DICOM object: (70d1, 2000) Private tag data …
2
votes
1 answer

Conversion not working properly using dicom2nifti

I have a series of dicom files (.dcm) for each patient that I want to convert to nii.gz files, but nothing happens (even error info) with the following conversion... import dicom2nifti dicom2nifti.settings.set_gdcmconv_path('C:/Program Files/GDCM…
Linminxiang
  • 325
  • 2
  • 14
2
votes
1 answer

How to display Series data from DICOM C-FIND results?

I'm new to DICOM and was wondering how I would be able to return results of a C-FIND similar to how applications like Osirix display them after a query. I'm doing this strictly in Python with pynetdicom and displaying results back in a GUI. At the…
Sun B
  • 25
  • 1
  • 7
2
votes
2 answers

Reading CT Scan dicom file

i am trying to read CT scan Dicom file using pydicom python library but i just can't get rid of this below error even when i install gdcm and pylibjpeg RuntimeError: The following handlers are available to decode the pixel data however they are…
2
votes
2 answers

Dicom to PNG Conversion - output image is completely black

While conversion of dicom to png using Python, without getting any error. Output file is complete Black, although image array have variable values. Code: import pydicom import cv2 import os dicom = pydicom.dcmread(inputdir + f) # print("dicom",…
Saksham Jain
  • 49
  • 1
  • 10
2
votes
1 answer

Issue with Setting the Command Set in N_CREATE Response, pydicom

I'm working on a MPPS SCP as described here: MPPS SCP as a basic framework. I've been able to test it a bit with DVTk, with some tools that are available here: DVTk Most of it seems to be working correctly, but the issue I seem to be having is…
SScotti
  • 2,158
  • 4
  • 23
  • 41
2
votes
1 answer

Efficiently re-shaping a numpy ndarray from 2-D to 3-D based on elements from 2-D

I'm working with DICOM files that contain image data. I am using pydicom to read the metadata from the .DCM file. Now, the pixel data that is extracted from the .DCM file is returned as a 2 dimensional numpy ndarray. The particular DICOM files I…
Luke Mueller
  • 263
  • 2
  • 8
2
votes
1 answer

How do I fix pydicom's dcmread() preamble error?

I am having trouble with dcmread() on a DICOM file that does exists at given path. I'm not sure what went wrong. Here is my code: import pydicom f = "/exact/path/hi.dcm" fn = get_testdata_file(f) ds = pydicom.dcmread(fn) ds.SOPClassUID =…
j. doe
  • 163
  • 3
  • 11
2
votes
1 answer

Why importing pydicom rise AttributeError: module 'gdcm' has no attribute 'DataElement'

After having installed libgdcm-tools (2.6.6-3) on my system (via apt install libgdcm-tools) I am not longer able to import pydicom in Python. When running import pydicom as pdc I got the following error AttributeError: module 'gdcm' has no attribute…
fednem
  • 95
  • 2
  • 13
2
votes
1 answer

Adding pixelData to pydicom dataset causes VR Error

I am working with a set of dicom images. I would like to create a new image with a header similar to an existing image. However, I already propagate the images in numpy arrays, so to avoid duplication I propagate the headers without PixelData:…
illan
  • 163
  • 1
  • 13
2
votes
1 answer

Creating new DICOM from sratch using 12 bit images

I am trying to create a new dicom file from sratch using pydicom. I have built a file with help from the following links from stackoverflow and the pydicom github examples.THis is my function: def generate_dicom(pixel_array,filename): sop_uid =…
toing_toing
  • 2,334
  • 1
  • 37
  • 79
2
votes
1 answer

How to read DICOM private tags without reading/loading pixel data?

I would like to read DICOM private tags. These private tags are under hexadecimal tag x7fe11001. I know one of the pydicom configurations that read till pixel data starts (so the memory is not loaded up). pydicom.dcmread(raw, defer_size="2 MB",…
Deepak
  • 962
  • 4
  • 17
  • 38
2
votes
1 answer

Display Dicom image using PIL(PILLOW) Python Library

I am trying to read and display DICOM(.dcm) images using below code:- import pydicom as dicom import numpy as np from PIL import Image, ImageEnhance, ImageOps from PIL.ImageQt import ImageQt def display_dicom_images(self, folder_Path): try: …
Sanjiv
  • 980
  • 2
  • 11
  • 29
2
votes
1 answer

How to transform stored values in a DICOM file to real world units?

I am trying to calculate radioactivity concentrations on a PET DICOM image using either Matlab or python. I have read in the DICOM standard that (0028,1053) Rescale Slope (0028,1052) Rescale Intercept can be used to map the stored 16 bit uints…
David
  • 107
  • 5
2
votes
2 answers

Removing CT bed from image using python

I would like to remove CT bed from the image. Basically I would want to remove everything below the red line in this image and subsequent ones (i would fill with 0 zeros or something) Is there a way to get the location of the highest non zero…
MikeDoho
  • 552
  • 2
  • 5
  • 18