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

how to rescale dicom slices to 1mm x 1mm x 1mm

I have dicom files with slice thickness 2.5 and pixel spacing ['0.703125', '0.703125'] mentioned in the header. I followed a tutorial to convert the raw data into HU with rescale slope and intercept. After processing, my image data is of size 120 x…
Anil Yadav
  • 149
  • 1
  • 14
0
votes
0 answers

Writing multiple data to a csv, np array gets converted to string

I'm trying to write pixel_array data and patientID from multiple Dicom files to a CSV. The pixel arrays, which are np arrays get saved like this; [[0 0 0 ... 0 0 0]\n [0 0 0 ... 0 0 0]\n [0 0 0 ... 0 0 0]\n ...\n [0 0 0 ... 0 0 0]\n [0 0 0 ... 0…
Akshay Ram
  • 25
  • 9
0
votes
1 answer

NotImplementedError: this transfer syntax JPEG 2000 Image Compression, can not be read because Pillow lacks the jpeg 2000 decoder plugin

I am running codes to visualizing and analyzing DICOM images in Python. The time I run the code to extract DICOM pixels for each slice location and display a single slice, I am getting the following error: NotImplementedError: this transfer syntax…
ShadowEspada
  • 192
  • 2
  • 10
0
votes
0 answers

Pydicom with Heroku

I wrote a code in streamlit with pydicom and published in heroku. So I got the error: Error My code is below: import streamlit as st from matplotlib import pyplot as plt import numpy as np import cv2 from pydicom import dcmread import…
Lenon
  • 1
  • 1
0
votes
1 answer

Is there a way to add MultiValues and lists in pydicom

I am trying to add a MultiValue to a list. But I am getting an error stating that I can't. I have also tried .append and .extend the multivalues to the list but get the error that you cannot add NaN values to a list. Also, I am having trouble…
tata
  • 67
  • 2
  • 9
0
votes
0 answers

pydicom error found file when using pydicom.dcmread(path + '/' + s) for s in os.listdir(path)

I am starting to use the pydicom package. I am following the instructions here https://medium.com/@hengloose/a-comprehensive-starter-guide-to-visualizing-and-analyzing-dicom-images-in-python-7a8430fcb7ed But I cannot figure out why I always get…
Lis Lou
  • 41
  • 5
0
votes
1 answer

Defining variables in a loop based on a dictionary

I am converting DICOMs to PNGs with Python 3.x and Pydicom. There are occasional errors when reading DICOM header tags, causing the script to crash. Until now, I worked around it by using exceptions like below: try: studyd = ds.StudyDate except:…
0
votes
1 answer

How to improve speed of ploting DICOM in the matplotlib

I am trying to create the DICOM viewer in python. I would like to use scroll mouse to skip images. It is working quite nice but the process is very slow, especially if I would like to do it in the full screen mode. I know that matplotlibt is not the…
Kamil
  • 1
0
votes
1 answer

DICOM slicing orders in python

I have a question about slices ordering: I have about 80 pictures of hip joint but there are not arranged from feet to head or head to feet. Is there any way to arrange them in an intended order? # pixel aspects, assuming all slices are the same ps…
0
votes
1 answer

How to standardize multiple DICOM images?

I'm working with multiple DICOM files, most of which are vastly different pixel wise. For example one ranges from -1024 to 2815 and another ranges from 0 to 2378. Is there a way to standardise them all into the same range. Also to note I'm utilising…
Faffy
  • 63
  • 1
  • 9
0
votes
2 answers

ModuleNotFoundError: No module named 'dicom' in a python env (tensorflow issue ?)

That's my first question here, but that won't be the first time Stack Overflow save me ! I am using conda on a windows10 machine and created my env with tensorflow 2.0 When I tried to add pydicom (v1.4 from condaforge) there was an issue with…
Alex Nérot
  • 1
  • 1
  • 2
0
votes
2 answers

Permission denied error when reading files in zip folder using python in Django

I'm trying to read dicom files in a zip folder but when I run this code it gives me this error: [Errno 13] Permission denied: 'PATIENT_DICOM/' file = patient.PATIENT_DICOM with zipfile.ZipFile(file,'r') as zip: zip.extractall() ls=…
0
votes
1 answer

Display multiple frames from a DCM image using python pydicom

I am trying to read and display a dicom image. The image has 49 frames. The PixelData has 24887296 elements in the array. Since the pixel_array cannot be used directly, please guide me on how to display the multiple frames from .dcm image? The input…
Smitha
  • 69
  • 6
0
votes
1 answer

Opening a compressed Dicom (MONOCHROME2) file in Python

I tried to open a Dicom file which is a compressed version (JPEG 2000 Image Compression). I used different free software tools as well as Python libraries (pydicom, VTK, OpenCV) to open it, but they were unsuccessful In pydicom, decompress()…
Amin
  • 63
  • 10
0
votes
1 answer

How to sort DICOM Slices in correct order?

I am trying to sort DICOM files in correct order, and I not able to use Image Position Patient descriptor as it's giving me an error "AttributeError: 'FileDataset' object has no attribute 'sort'". code: for paths in a: for root, dirs, files in…
Mike
  • 51
  • 1
  • 6