Screenwriter Marc
Screenwriter Marc

Reputation: 3

'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 dose

I keep receiving this error while trying to import dose

ImportError                               Traceback (most recent call last)
<ipython-input-120-6605335fa321> in <module>
      5 import glob
      6 from dicompylercore import dicomparser, dvh, dvhcalc
----> 7 from dicompylercore import dose

ImportError: cannot import name 'dose' from 'dicompylercore'

Because of this import error, I think that is why there is no attribute to be found when I try and add the two dose grids together

dose1 = dicomparser.DicomParser("RD.CW.dcm")
dose2 = dicomparser.DicomParser("RD.CCW.dcm")

grid_1 = dose.DoseGrid()
grid_2 = dose.DoseGrid()
grid_sum = grid_1 + grid_2
grid_sum.save_dcm("grid_sum.dcm")  

It gives me this error

~\Anaconda3\lib\site-packages\pydicom\dataset.py in __getattr__(self, name)
    550         if tag is None:  # `name` isn't a DICOM element keyword
    551             # Try the base class attribute getter (fix for issue 332)
--> 552             return super(Dataset, self).__getattribute__(name)
    553         tag = Tag(tag)
    554         if tag not in self._dict:  # DICOM DataElement not in the Dataset

AttributeError: 'FileDataset' object has no attribute 'DoseGrid'

I am new to working with dicom files and with dicompylercore. I am unsure if this is related to the dicom files I am working itself or if there is some issue with the dicomplyercore package itself. Are there any suggestions on what I could do to fix this?

Upvotes: 0

Views: 365

Answers (1)

MrBean Bremen
MrBean Bremen

Reputation: 16855

The dose module has been added to dicompylercore after the last PyPi release, so you have to install the version from GitHub, if you want to use it:

pip install git+https://github.com/dicompyler/dicompyler-core

I'm not sure how stable this version is, but you can ask about the next release on the development site.

Upvotes: 2

Related Questions