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
2 answers

multiple dicom images to grayscale

I m working on image segmentation using region based for this i need to convert my dicom files to grayscale, i have performed in one image it works good but for multiple images in gives me an error. def DicomtoRGB(dicomfile,bt,wt): """Create new…
0
votes
1 answer

Reading 3D DICOM volume, from single file, 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 I am trying to read it into a 3D numpy array as described here. I try the following…
OtagoHarbour
  • 3,969
  • 6
  • 43
  • 81
0
votes
2 answers

DICOM Image segmentation and 3d construction using VTK

I am working on .dcm image (dicom image) In my case there are 152 2D image slices. I have used https://www.raddq.com/dicom-processin... link for segmentation . After segmentation, i used region of interest(ROI) on that segmented area. Now i have…
0
votes
2 answers

Convert gray pixel_array from DICOM to RGB image

I'm reading DICOM gray image file as gray = dicom.dcmread(file).pixel_array There I've got (x,y) shape but I need RGB (x,y,3) shape I'm trying to convert using CV img = cv2.cvtColor(gray, cv2.COLOR_GRAY2RGB) And for testing I'm writing it to file…
cnd
  • 32,616
  • 62
  • 183
  • 313
0
votes
0 answers

Python best-practices and pydicom dataset attributes question

Is adding new attributes to an existing published module class's instances considered a Bad Practice in general, and instead you should sub-class it? Background I'm using pydicom, and want to keep some additional info with the pydicom Datasets (eg…
Richard
  • 3,024
  • 2
  • 17
  • 40
0
votes
2 answers

pydicom: dcm_read specific_taglist argument creates attribute error

I have a tree of four subjects and their DICOM images. Here is an example of one subject's directory structure: 'C:\\DICOM_EXPORT\\four_de-id\\four_de-id\\100013\\100013\\*.dcm*' I'm creating a loop where I recursively go…
florence-y
  • 751
  • 3
  • 8
  • 18
0
votes
1 answer

Write an array of Dicom images

I have a folder of dicom images and I stored these images in an array and I would like to print them out in a different folder. I cannot find a method that will write out each of the images like the cv2.imwrite import pydicom import skimage,…
0
votes
1 answer

Error in saving manipulated dicom to a new readable dicom file?

I have a 2D DICOM image with 12 bits, I need to do some modification on Bits-Store to convert it to 8 bits. For this aim, I modify the pixel_array. To save this new modified pixel_array as a DICOM image I need the same meta_data of the original…
Magi
  • 341
  • 2
  • 15
0
votes
2 answers

Adding new private entry key using pydicom

I need to add the corresponding text keys of tags to pydicom so it can read them from a DICOM file. So far I have been able to add the entries to the DICOM file using the add_new() method. However, I still have to read these values using the hexa…
toing_toing
  • 2,334
  • 1
  • 37
  • 79
0
votes
1 answer

How to create a loop in a user interactive script which can add any number of tags in image series?

I want to loop over dicom tags and image series in my script in a user interactive way. But I am unable to create a loop, which can ask user: Do you want to modify or add tags? if add then How many tags you want to add? and if no then which tags you…
0
votes
1 answer

Encoding issue while reading dicom repo

I am preprocessing a DICOM images repository to feed with it a convolutional neural network, but when I try to read the repository it throws me the following error: LookupError: unknown encoding: ISO 2022 IR 100 Here is the code I used…
lorenzo
  • 11
  • 7
0
votes
0 answers

Loading DICOM data to numpy errors

I am trying to load and display DCM files to Matplotlib but cannot get it to work' Here is the code:' def show_dicom_file(filename): dataset = pydicom.dcmread(filename) print("Filename.........:", filename) print("Storage type.....:",…
David Kabii
  • 642
  • 6
  • 17
0
votes
1 answer

How to save the Dicom tags in any dicom image?

I am new to python and writing a simple python script using pydicom module. I'd like to edit the tags in existing MR dicom image, I have added the code I think is required for the tags but I am unable to save that dicom file. Furthermore I suspect…
0
votes
1 answer

How to create a new dicom image with annotations from other?

I would like to create two pydicom file from one. But I can't save file in *.dcm format with annotations. import pydicom from pydicom.data import get_testdata_files # read the dicom file ds = pydicom.dcmread(test_image_fps[0]) # find the shape of…
Badum
  • 70
  • 1
  • 1
  • 10
0
votes
1 answer

How to divide in half pydicom files (image) using python?

I have a lot of images (pydicom files). I would like to divide in half. From 1 image, I would like 2 images: part left and part right. Input: 1000x1000 Output: 500x1000 (width x height). Currently, I can only read a file. ds =…
James_Hames
  • 59
  • 1
  • 1
  • 7