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

How do I get python to recognize a module from any directory?

I'm installing some additional packages to anaconda and I can't get them to work. One such package is pydicom which I downloaded, unziped, and moved to /usr/local/anaconda/lib/python2.7/site-package/pydicom. In the pydicom folder the is a subfolder…
G Warner
  • 1,309
  • 1
  • 15
  • 27
2
votes
1 answer

How access to a single NumPy array in a DICOMDIR file with pydicom?

I am using DICOM with Python and Pydicom library, when I have used .dcm files I hadn't problems. But I am using DICOMDIR data sets now. My code is the next: ds = dicom.read_file("dicomdir") I tried to access to the pixel_array elements as…
omar
  • 1,541
  • 3
  • 21
  • 36
1
vote
1 answer

get scale of image (px/cm^2) in pydicom

I have multiple ultrasound images in dicom file. I need to extract information about scale of the image, i.e pixels/cm^2. Is there any dicom tag containing following information? Or should I calculate it somehow. My dicom file looks as…
mik.ro
  • 4,381
  • 2
  • 18
  • 23
1
vote
1 answer

Medical Imaging with python

I have an image in DICOM format, this image is composed of a set of RAW files (a specific case 122, which would be the number of slices that the image would have, depth in Z). The size of the image is 512x512x122 voxels. The program I have made…
dms
  • 11
  • 1
1
vote
1 answer

Extract DICOMDIR slices and convert to mp4 file

I have a DICOMDIR file with a lot of dcm files in it. I have extracted the .dcm file with Instance Number 1. It has 49 slices/frames. I wnat to convert those frames into an mp4 format. My code gives and output but the video is still and has a yellow…
1
vote
1 answer

Converting hand radiograph DICOM to PNG returns white/bright image

I am converting hand X-rays in DICOM format to PNG format. The code below does this: import os import cv2 import pydicom import numpy as np from PIL import Image inputdir = "P:/BoneDataset/DICOM-File/0-RefinedDICOM/" outdir =…
Bathtub
  • 91
  • 8
1
vote
1 answer

Converting a series of MR case to numpy array

I have an MR case and i want to to convert the Each series (which consisit of multiple dicoms) into numpy array which i will be sending for an infrencing. But i am not able to convert that MR series (which i am considering as a 3D (number of slices…
NeedToCodeAgain
  • 129
  • 2
  • 9
1
vote
0 answers

How to read a Multiframe Dicom file and display it as video using an UI

I am looking to find a way to read a DICOM file and display the multi frame DICOM file as a video in an UI, I tried reading the multi frame DICOM file using pydicom and I was able to get each frame and appended it into a list and I created a gif out…
RonKing
  • 31
  • 3
1
vote
1 answer

How to apply a low pass filter to a dicom image in python?

I am trying to apply some blur using a low pass filter to a dicom image, however my resulting dicom image is not correct (see image below) (all data below is publicly available) from scipy import fftpack import numpy as np import imageio from PIL…
1
vote
1 answer

Reading the First Frame of a Large Dicom File

Let a large dicom file (for example https://drive.google.com/drive/folders/1ejY0CjfEwS6SGS2qe_uRX2JvlruMKvPX?usp=sharing) be given. I need to read, in numpy array format , the first frame of its pixel array as quickly as possible . import…
温泽海
  • 216
  • 3
  • 16
1
vote
1 answer

Get all images of a multi-frame DICOM file

I'm trying get all images in a multi-frame DICOM file. Right now I was successfully able to see and save a single image in a single-frame DICOM file, by using the pydicom and matplotlib libraries, like so: filename =…
1
vote
0 answers

Stacking multiple Dicom series for a same patient

I have a a sereies of Dicom images for each patient and I would like to stack them and save them as one Volumetric Dicom image, Any idea of how to do that? from glob import glob import dcmstack import dicom src_paths = glob('...../*.dcm') my_stack…
1
vote
1 answer

finding the size of an item in a Siemens DICOM tag

I am tryying to read a multi-slice (Mosaic) DICOM image from a Siemens scanner in C++, using DCMTK to read the tag and information on the nibabel pages. As I understand, Mosaic images have a CSA header and after 8 bytes (CSA1) or 16 bytes (CSA2),…
alle_meije
  • 2,424
  • 1
  • 19
  • 40
1
vote
1 answer

Extracting Data from a DICOMDIR file using Pydicom

I'm unable to read in a DICOM file as I usually would, citing the error: AttributeError: 'DicomDir' object has no attribute 'DirectoryRecordSequence' I've tried: pydicom.fileset.FileSet using specific tags with…
1
vote
0 answers

How do I convert a 4D image to a DICOM image in pydicom?

I have a 4D dicom image which I read with dcmread. Consequently, I change a few pixels to black in order to remove the imprinted patient information. However, if I want so save these changes I get errors. Code: pathFile='...' #Fill in…