pydicom.read_file() --> _get_pixel_array() no longer exists
See original GitHub issueAttempting to use the DicomCleaner class to do pixel-level cleaning.
Looks like I keep getting an error in the clean.py
file:
<ipython-input-41-aa448e009737> in <module> 5 print(out) 6 if out[‘flagged’]: ----> 7 client.clean()
/opt/conda/lib/python3.6/site-packages/deid-0.1.23-py3.6.egg/deid/dicom/pixels/clean.py in clean(self) 106 107 # We will set original image to image, cleaned to clean –> 108 self.original = dicom._get_pixel_array() 109 self.cleaned = self.original.copy() 110
/opt/conda/lib/python3.6/site-packages/pydicom/dataset.py in getattr(self, name) 530 if tag is None: #
name
isn’t a DICOM element keyword 531 # Try the base class attribute getter (fix for issue 332) –> 532 return super(Dataset, self).getattribute(name) 533 tag = Tag(tag) 534 if tag not in self.tags: # DICOM DataElement not in the DatasetAttributeError: ‘FileDataset’ object has no attribute ‘_get_pixel_array’
Tracing this issue back it looks like pydicom’s FileDataset doesn’t actually have a _get_pixel_array() function, as follows:
from pydicom import read_file dicom = read_file(dicom_files[0]) dicom._get_pixel_array()
(dicom_files is a list of local paths to DICOM files). Gives the same error at the same location:
AttributeError Traceback (most recent call last) <ipython-input-51-f7f42af5b358> in <module> 1 from pydicom import read_file 2 dicom = read_file(dicom_files[0]) ----> 3 dicom._get_pixel_array()
/opt/conda/lib/python3.6/site-packages/pydicom/dataset.py in getattr(self, name) 530 if tag is None: #
name
isn’t a DICOM element keyword 531 # Try the base class attribute getter (fix for issue 332) –> 532 return super(Dataset, self).getattribute(name) 533 tag = Tag(tag) 534 if tag not in self.tags: # DICOM DataElement not in the DatasetAttributeError: ‘FileDataset’ object has no attribute ‘_get_pixel_array’
On the other hand, I seem to be able to call for the variable directly using dicom.pixel_array
or, alternatively, dicom.__getattribute__("pixel_array")
Maybe pydicom changed the Dataset class at some point and broke the clean.py
implementation?
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (5 by maintainers)
Top GitHub Comments
Please review --> https://github.com/pydicom/deid/pull/84
Vanessa thanks for the recommendation! In all honesty I’ve not thought about it till now because it always feels like I might just not be using the package right instead of a bug. Thanks for the encouragement and will recommend pull requests for basic fixes here on out!