pydicom

How to fix encoding issues of pydicom in python

假如想象 提交于 2019-12-06 05:21:50
This is the code: import dicom ds = dicom.read_file(FILE_PATH) print(ds) Error: LookupError: unknown encoding: ISO 2022 IR 100 When using pydicom in order to look at data, I got the error above. I found 'ISO 2022 IR 100': 'latin_1' ,according to here . However, I didn't get how to fix this problem. Can you help me to solve this error? As indicated in the comments, the culprit was an out-of-date version of pydicom. Upgrading to a more recent version fixed this issue. 来源: https://stackoverflow.com/questions/45528897/how-to-fix-encoding-issues-of-pydicom-in-python

how to replace pixel data on same dicom file using pydicom to read it again with any dicom viewer?

拥有回忆 提交于 2019-12-05 03:20:49
问题 I want to treat some DICOM files, so I'm testing pydicom for my work, which I think is considerably useful. And now I want to load existing DICOM files, replace the pixel data array with another pixel array (e.g. preprocessing or literally another DICOM pixel array) and most of all, I want to treat it again with any DICOM viewer application. For this test, I used the tutorial code below. This code loads a test data file. The size of image is 64*64. The code below does subsampling from the

Create pydicom file from numpy array

核能气质少年 提交于 2019-12-04 11:44:19
问题 I'm trying to create a mew dicom image from a standard-sized (512 x 512 or 256 x 256) numpy array. It seems like this should be straightforward, and I've adapted my code from http://code.google.com/p/pydicom/source/browse/source/dicom/examples/write_new.py, which appears to execute the same process, but when I save the file, I can't view it either in RadiAnt or MicroDicom. import dicom, dicom.UID from dicom.dataset import Dataset, FileDataset def write_dicom(pixel_array,filename): file_meta =

how to replace pixel data on same dicom file using pydicom to read it again with any dicom viewer?

。_饼干妹妹 提交于 2019-12-03 17:19:10
I want to treat some DICOM files, so I'm testing pydicom for my work, which I think is considerably useful. And now I want to load existing DICOM files, replace the pixel data array with another pixel array (e.g. preprocessing or literally another DICOM pixel array) and most of all, I want to treat it again with any DICOM viewer application. For this test, I used the tutorial code below. This code loads a test data file. The size of image is 64*64. The code below does subsampling from the original data. After that, the size of image is 8*8, and the result is saved to "after.dcm". But when I

Create pydicom file from numpy array

蓝咒 提交于 2019-12-03 07:18:25
I'm trying to create a mew dicom image from a standard-sized (512 x 512 or 256 x 256) numpy array. It seems like this should be straightforward, and I've adapted my code from http://code.google.com/p/pydicom/source/browse/source/dicom/examples/write_new.py , which appears to execute the same process, but when I save the file, I can't view it either in RadiAnt or MicroDicom. import dicom, dicom.UID from dicom.dataset import Dataset, FileDataset def write_dicom(pixel_array,filename): file_meta = Dataset() ds = FileDataset(filename, {},file_meta = file_meta,preamble="\0"*128) ds.PixelData = pixel

PyDICOM can't read pixel data and needs GDCM or Pillow

╄→尐↘猪︶ㄣ 提交于 2019-12-02 02:13:52
问题 I'm using pydicom and my code is pretty straightforward: image = np.stack([s.pixel_array for s in scans]) But this gives a runtime error: RuntimeError: The following handlers are available to decode the pixel data however they are missing required dependencies: GDCM (req. GDCM), Pillow (req. Pillow) I'm not sure what to do. Any help would be.. helpful. 回答1: If GDCM is giving you problems, give Pillow a go. python -m pip install pillow Make sure to install in the correct environment. 来源: https

PyDICOM can't read pixel data and needs GDCM or Pillow

血红的双手。 提交于 2019-12-02 00:24:11
I'm using pydicom and my code is pretty straightforward: image = np.stack([s.pixel_array for s in scans]) But this gives a runtime error: RuntimeError: The following handlers are available to decode the pixel data however they are missing required dependencies: GDCM (req. GDCM), Pillow (req. Pillow) I'm not sure what to do. Any help would be.. helpful. If GDCM is giving you problems, give Pillow a go. python -m pip install pillow Make sure to install in the correct environment. 来源: https://stackoverflow.com/questions/54657768/pydicom-cant-read-pixel-data-and-needs-gdcm-or-pillow