pydicom

Using dicom Images with OpenCV in Python

扶醉桌前 提交于 2021-02-07 10:23:27
问题 I am trying to use a dicom image and manipulate it using OpenCV in a Python environment. So far I have used the pydicom library to read the dicom(.dcm) image data and using the pixel array attribute to display the picture using OpenCV imshow method. But the output is just a blank window. Here is the snippet of code I am using at this moment. import numpy as np import cv2 import pydicom as dicom ds=dicom.dcmread('sample.dcm') cv2.imshow('sample image dicom',ds.pixel_array) cv2.waitkey() If i

Using dicom Images with OpenCV in Python

淺唱寂寞╮ 提交于 2021-02-07 10:21:28
问题 I am trying to use a dicom image and manipulate it using OpenCV in a Python environment. So far I have used the pydicom library to read the dicom(.dcm) image data and using the pixel array attribute to display the picture using OpenCV imshow method. But the output is just a blank window. Here is the snippet of code I am using at this moment. import numpy as np import cv2 import pydicom as dicom ds=dicom.dcmread('sample.dcm') cv2.imshow('sample image dicom',ds.pixel_array) cv2.waitkey() If i

pydicom Dataset: send_c_find return success but status.pixel_array has error text in it

江枫思渺然 提交于 2021-01-28 00:16:23
问题 I'm using dcm4chee as PACS server and I'm trying to retrieve a study based on a patient name. The relevant code is: ae = AE() ae.add_requested_context(PatientRootQueryRetrieveInformationModelFind) ae.add_requested_context(VerificationSOPClass) assoc = ae.associate(config['pacs_remotehost']['ip'], config['pacs_remotehost']['ports']['DICOM'],ae_title='DCM4CHEE') if assoc.is_established: ds = Dataset() ds.PatientName = '*************' #name erased ds.QueryRetrieveLevel = 'PATIENT' ds

Getting DICOM structure contours as array in Python

…衆ロ難τιáo~ 提交于 2020-08-19 04:14:36
问题 So if I have an image (CT, MRI, etc.) or even a dose from radiation therapy I can pull out the dose or image values into an array through: import dicom ds = dicom.read_file("dicom_file.dcm") print ds.pixel_array This is pretty straightforward, and gives me the ability to manipulate images/doses as I want. However, often you also have a structure file that includes different contoured structures that you can then see in an image viewer or something like that. Again, pretty straightforward. My

Getting DICOM structure contours as array in Python

丶灬走出姿态 提交于 2020-08-19 04:11:13
问题 So if I have an image (CT, MRI, etc.) or even a dose from radiation therapy I can pull out the dose or image values into an array through: import dicom ds = dicom.read_file("dicom_file.dcm") print ds.pixel_array This is pretty straightforward, and gives me the ability to manipulate images/doses as I want. However, often you also have a structure file that includes different contoured structures that you can then see in an image viewer or something like that. Again, pretty straightforward. My

No available image handler could decode this transfer syntax JPEG Lossless when read DICOM and ploting using matplotlib

喜欢而已 提交于 2020-05-17 07:05:52
问题 When i use pydicom in python3.6, there are some problem: import pydicom import matplotlib.pyplot as plt import os import pylab filePath = "/Users/zhuangrui/Documents/Python/Dicom/dicoms/zhang_bo/0001.dcm" dataSet_1 = pydicom.dcmread(filePath) plt.imshow(dataSet_1.pixel_array) plt.show() here is the problem: How can this problem be solved? Thank you very much! 回答1: I've faced with the same problem, after doing some research on the suggested link above. I've managed to solve it by updating to

No available image handler could decode this transfer syntax JPEG Lossless when read DICOM and ploting using matplotlib

只愿长相守 提交于 2020-05-17 07:05:21
问题 When i use pydicom in python3.6, there are some problem: import pydicom import matplotlib.pyplot as plt import os import pylab filePath = "/Users/zhuangrui/Documents/Python/Dicom/dicoms/zhang_bo/0001.dcm" dataSet_1 = pydicom.dcmread(filePath) plt.imshow(dataSet_1.pixel_array) plt.show() here is the problem: How can this problem be solved? Thank you very much! 回答1: I've faced with the same problem, after doing some research on the suggested link above. I've managed to solve it by updating to