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

Error when converting DICOM image to pixel_array using tensorflow_io

I am trying to create a TensorFlow Dataset from DICOM images using the tf.data API and tensorflow_io, and I want to perform some pre-processing using Hounsfield units from the images. The DICOM images have a shape of (512,512). I have extracted the…
1
vote
1 answer

Trying to input a RGB fMRI DICOM image, modify it, and save it as a grayscale dicom image in Python using pydicom

I am trying to take in an RGB fMRI scan as input and output the same scan but in grayscale with the color parts "burned" white essentially. Whenever I try and modify any of the Data Elements, such as Photometric Interpretation and Samples Per Pixel,…
Ben77
  • 13
  • 2
1
vote
1 answer

How to edit nested/child DICOM tags for sequences using pyDicom?

I'm trying to set all the TIME (VR = TM) tags contained within the DICOM dataset to a placeholder value, using pyDicom. I can remove the value of all the TIME (VR = TM) tags that are within the root of the DICOM metadata: TIME_TAGS = [ (0x10,…
moo
  • 1,597
  • 1
  • 14
  • 29
1
vote
1 answer

Generating spatially correlated statistical noise using autocorrelation and python

I’m trying to emulate the methodology described in this paper: http://www.ajnr.org/content/34/8/1506 under the heading “Noise Addition to Simulate Dose Reduction” As far as I understand the authors basically completed the following steps. First,…
1
vote
1 answer

Sorting DICOM images without SliceLocation attribute

Does anyone know if it is possible to sort dicom files if there is no SliceLocation attribute? By "sort" I mean arrange the images longitudinally (in a craniocaudal orientation) with the most superior images first followed by the inferior…
patrick
  • 19
  • 3
1
vote
2 answers

how to open dicom image using fastai?

I am working on Dicom images using pydicom. But my project is in fasai and I want to open that Dicom image using the fastai library. In fastai, we normally do open_image(path) its work fine for png or jpg but if we have Dicom images we have no…
Engr Ali
  • 409
  • 1
  • 5
  • 13
1
vote
1 answer

adding an overlay on a DICOM image using open CV

I am trying to create a layer on a DICOM image, below code works fine for jpg/png images but not for DICOM. import cv2 import numpy as np import pydicom as dicom ds=dicom.dcmread('D0009.dcm') img=ds.pixel_array blank =…
1
vote
0 answers

How to Apply maximum intensity projection and Minimum intensity projection on DICOM file using python?

I wanted to Apply maximum intensity projection and Minimum intensity projection on DICOM file using python? i used the following code from GitHub but i am facing issue while i give image to this function def createMIP(np_img, slices_num = 15): …
1
vote
2 answers

How do I convert STL file to numpy array and format it to overlay with Dicom data?

I have STL files of 3D objects and I have converted them into both mesh objects and numpy arrays using the numpy-stl package. I have also converted DCM data into numpy arrays with the pydicom package, but the numpy array versions of the STL files…
1
vote
1 answer

How do I read and then write a multi-frame DICOM file in pydicom without an image offset?

I read a multi-frame DICOM file with pydicom, after that I write it into a new file. However when I open the DICOM file, the image has an offset/shift. ds = pydicom.dcmread('./Multiframe/0020.dcm') arr = ds.pixel_array ds.PixelData =…
csadom
  • 43
  • 4
1
vote
4 answers

Converting YBR_RCT Photometric Interpretation to RGB

I have a J2k Lossless dicom image and upon reading it with pydicom I see that it's in the YBR_RCT Color Space. I want to convert the Color Space to RGB. I tried using the convert_color_space method from pydicom however, apparently this conversion is…
Gaurav Fotedar
  • 715
  • 1
  • 6
  • 11
1
vote
0 answers

cx_Freeze error: ModuleNotFoundError: No module named 'pydicom'

Problem: I get the error "ModuleNotFoundError: No module named 'pydicom'" when trying to run an executable created from a python program using cx_Freeze. Background: I am using Python 3.8 with Anaconda 2020.02 on Windows 10 with PyCharm 2019.3.3…
1
vote
1 answer

How to get affine information from a DICOM file in python?

I have a folder with DICOM files inside (CT scan for example) and I need to extract affine information of the volume since I will produce a mask and need it later to align the volume and mask. However the solution I have now is not optimal at all. I…
1
vote
2 answers

3D visualization of .dicom files with ipyvolume

i'm trying to visualize a set of .dicom files using pydicom and ipyvolume. I used pydicom to read files and then sorted them by their location and turned the slices into a 3D array. I could draw a 3D model of the data using…
1
vote
1 answer

How to decode and visualize DICOM curve data in Python 3?

I am trying to visualize a DICOM file with Python 3 and pyDicom which should contain a black 100x100 image with some curves drawn in it. The pixel data is extracted from header (7fe0,0010) and when printed shows b'\x00\x00\x00...'. This I can easily…
SMey1908
  • 21
  • 4