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

'FileDataset' object has no attribute 'DoseGrid'

I have been trying to use the dicompyler-core to put together two dose grids from two different dose dicoms. import pydicom import numpy as np import os import glob from dicompylercore import dicomparser, dvh, dvhcalc from dicompylercore import…
0
votes
0 answers

Getting back the StudyInstanceUID when association sudenlly is aborted

I am writing a sample DICOM SCP Store. I simulate a transfer of many DCM folders (from another computer connected to my LAN) using SCU Store command. 3 transfers are simulated at the same time. for unkonwn reason, one of the transfer is aborted. I a…
0
votes
2 answers

Is it possible to read a DICOM file from a BytesIO object?

I am using python 3.6 on Windows to fetch a DICOM file from a database as a string of bytes. Now, I would like to use the Pydicom library to read the content of the file. The dcmread() method takes a file-like object as main argument, however the…
SpaceBurger
  • 537
  • 2
  • 12
0
votes
1 answer

Positional Argument error with pydicom.dcmread

I have just started playing around with the pydicom module. I've just tried to implement this example in PyCharm : https://pydicom.github.io/pydicom/dev/old/viewing_images.html However, for some reason I keep getting this error: TypeError: new()…
0
votes
1 answer

How to slice region of numpy array surrounding minimum value (i.e. 100 pixels on each side of a point)

I have a 2D numpy array which is image data, and contains a dot with a lower pixel value than the rest of the image. This dot is not necessarily in the centre of the image. I've found the coordinates of the dot from my dataset ('data', Array of…
Georgia
  • 11
  • 2
0
votes
1 answer

Python - vtkDICOMImageReader array input?

I'm building a system for viewing DICOM files. DICOM files located in the specified folder are read with dcmread and put in a list. I check the metadata to separate the series by the series number in the information, then I create a dictionary with…
Gibser
  • 197
  • 8
0
votes
2 answers

Why visualize DICOM file with pyDICOM and matplotlib return an greenish colour image

I have a DICOM file with an image that I would like to visualize. The image looks fine when I opened with DICOM software. However, when I tried to visualize the image in python with pyDICOM using the following code: ds =…
Nugliar
  • 17
  • 3
0
votes
1 answer

How do I display all 8-bits image on python

first of all, sorry for my bad english, im a spanish speaker so Im gonna try my best to explain my problem. I have a normalized ([0-255]) dicom image, and I want to display 8 images, but changing the bit depth, I mean like: 1bit image, 2bit image,…
Nicolas
  • 1
  • 4
0
votes
1 answer

Two functions in a loop, but only one is executed (anonymizing of DICOM files + moving them)

so I have a question regarding a script i wrote including two functions. The idea is to anonymize all DICOM files (the dataformat for CT files) in a given folder, and move the anonymized files to new folder. The issue is - the anonymizing function…
Anna Bleha
  • 63
  • 1
  • 1
  • 7
0
votes
0 answers

pydicom AttributeError: Dataset does not have attribute 'ImagePositionPatient'

I'm new to python. I'm trying to import dicom files. The following code is used in many tutorials for import dicom files using pydicom (for example https://www.kaggle.com/gzuidhof/full-preprocessing-tutorial): INPUT_FOLDER =…
0
votes
2 answers

How to fix this code to display images thumbnails

The following code is supposed to display thumbnails of different images that are available in the \data directory. However, something is wrong with it. from os import listdir from os.path import isfile, join mypath = "data/" file_names = [mypath+f…
Best_fit
  • 165
  • 7
0
votes
2 answers

Error While converting Dicom tags into excel using python

I am trying to convert and list DICOM tags from .dcm files into Excel (using pydicom), but it is showing an error while converting Some of the tags are showing 'None' in the Excel file although they contain/show data…
0
votes
2 answers

DICOM to Nifti metadata not transfering

I am trying to take a number of DICOM stacks and convert them to Nifti files. When I do the conversion and open the new Nifti file in a 3D viewer the volume is smashed together in the z direction. The Nifti files do not know what the spacing is…
rzaratx
  • 756
  • 3
  • 9
  • 29
0
votes
1 answer

Converting DICOM image to numpy array of shape (s, 3, 256, 256)

I've got folders with MRI images in them and I'm trying to replicate the MRnet study with my own data. Their model works on 1 .npy file per subject, shape (s, 3, 256, 256), with s being number of slices for a given subject (varies between…
user3078100
  • 169
  • 4
  • 12
0
votes
1 answer

extract 40 mm cube from 3d volume data

I have created a 3d numpy array of data (shape: 133 x 512 x 512) from dicom format. Given a center point of a nodule location, how would i extract a 3d volume of size 40mm x 40mm x 40mm. I am not sure how would the pixel to mm conversion happens? I…
Anil Yadav
  • 149
  • 1
  • 14