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

How to get a list of all SOP instances that were not successfully retrieved during a C-MOVE call?

I'm using PyNetDicom to download (C-MOVE) images from a PACS server. I've implemented a SCU that sends C-MOVE requests to PACS, and a SCP that receives the C-STORE requests. I download entire studies, meaning a few thousand DICOM images at a time.…
LidiaLu
  • 43
  • 5
4
votes
3 answers

Resize a DICOM image in python

I am trying to resize DICOM images of different dimensions into a common dimension size for training my neural network. I thought that cv2 could solve my problem. But I am getting a 'datatype not understood error' in my jupyter notebook I am trying…
4
votes
2 answers

How to convert a DICOM from Monochrome 1 to Monochrome 2?

I am working on a project with DICOM images where I need to compare two DICOM images. The problem is, one is in monochrome 1 and the other is in monochrome 2 (zero means white and black, respectively). How can I convert these pixel intensities to…
Sean M
  • 91
  • 2
  • 5
4
votes
4 answers

Unable to get dicom image for display in python

I'm trying to display a DICOM image in opencv-python.I am using the pydicom library,And then adding API's to create a full fledged DICOM viewer with DOTNET, that runs python(C# calls python with process instance of course!!). I am unable to convert…
4
votes
1 answer

Transform DICOM Image to a list of XYZ coordinates and their values - Python

Here is what I am trying to accomplish in Python (please keep in mind that I'm relatively new to Python): Convert a DICOM image into a list of xyz coordinates along with their respective pixel values and export the list to a .csv file. Regenerate…
Masrawy
  • 41
  • 1
  • 3
3
votes
2 answers

Convert DICOM to TIFF

I'm new to Python so forgive my ignorance If I don't have all the info correct. I'm trying raster through a directory and convert all the DICOM files within to TIFF files. I have gotten the search functionality to work, but I am having a hard time…
Masrawy
  • 33
  • 1
  • 5
3
votes
2 answers

Extracting specific data from multiple DICOM files

I have multiple DICOM files with similar data, for example: (0008, 0023) Content Date DA: '20200209' (0008, 0033) Content Time TM: '192356.853736' (0010, 0010) Patient's Name PN:…
3
votes
1 answer

Rescaling Dicom pixel values to be in the range [0,1]

I haven't been able to find the range of values that is returned from .pixel_array so I'm not sure how to scale the values to a custom range like [0,1]. Is there a pydicom inbuilt function that does this already?
3
votes
1 answer

How to replace pixel data in dicom image with pydicom?

I'm trying to replace pixel data in given example image. My code: import matplotlib.pyplot as plt from pydicom import dcmread from pydicom.data import get_testdata_file fpath = get_testdata_file('CT_small.dcm') ds = dcmread(fpath) # replacing rows…
3
votes
1 answer

Create a Dicom from multiple jpg images

I've successfully built dicoms with one images but I cannot find a way to add more... I think the problem may be in my pixel array, can anyone help me correct it ? # Populate required values for file meta information meta =…
Johann
  • 73
  • 7
3
votes
1 answer

Trying to crop image and save dicom with pydicom,

Trying to load a chest x-ray DICOM file that has JPEG2000 compression, extract the pixel array, crop it, and then save as a new DICOM file. Tried this on a Windows10 and MacOS machine, but getting similar errors. Running Python 3.6.13, GDCM 2.8.0,…
anbk
  • 63
  • 1
  • 7
3
votes
1 answer

Convert DICOM tag into something more readable

I'm working with pydicom and a DICOMWeb client. The latter I use to fetch metadata from a DICOM repository. When retrieving DICOM metadata, I only get the DICOM tags as tuples of hexadecimals. I was wondering how to look up the tags and get a…
normanius
  • 8,629
  • 7
  • 53
  • 83
3
votes
1 answer

Generate determinisitic UID dependent on the MAC adress and user name

I am writing a Python routine to generate DICOM files. In that case, I need to specify the Instance Creator UID tag, that is used to uniquely identify the device that created the DICOM file. So I would need a function that generates such a UID for a…
BayesianMonk
  • 540
  • 7
  • 23
3
votes
1 answer

"TypeError: a bytes-like object is required, not 'str'" reading compressed DICOM volume into numpy array

I am using Python 3.7.3 on Anaconda Spyder on CentOS 7. I have a 3D DICOM volume that is in a single file:/usr/share/aliza/datasets/DICOM/00_MR/Tra_FLAIR.dcm print(image.file_meta.TransferSyntaxUID) returns 1.2.840.10008.1.2.4.70 import pydicom…
OtagoHarbour
  • 3,969
  • 6
  • 43
  • 81
3
votes
2 answers

Medical Image quality problem with DICOM files

I am trying to make some segmentation tasks on CT images which are in DICOM format, using python. The main problem is that when I am trying to read the DICOM file…
robertg
  • 73
  • 1
  • 8
1
2
3
18 19