NoneType error in StorageSOPClass SCU

37 views
Skip to first unread message

dustin....@gmail.com

unread,
May 12, 2017, 1:01:56 PM5/12/17
to pynetdicom
I'm trying to send locally stored DICOM files to a C-Store SCP, but I'm running into some issues. I've been able to successfully send one Secondary Capture to the destination, but it seems like all other SOP classes give the same error:

"---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-58-4a75243e3526> in <module>()
42
43 #send DICOM file to SCP AE
---> 44 st = assoc.SCU(d,1)
45
46 #kill association and SCU AE

C:\ProgramData\Anaconda2\lib\site-packages\pynetdicom-0.8.1-py2.7.egg\netdicom\applicationentity.pyc in SCU(self, ds, id)
51 threading.Thread.__init__(self)
52 self.daemon = True
---> 53 self.SOPClassesAsSCP = []
54 self.SOPClassesAsSCU = []
55 self.AssociationEstablished = False

TypeError: 'NoneType' object is not callable"

First, is there any documentation for pynetdicom? I've been basing my work off of the Typical Use Cases at Pythonhosted.org, but they aren't perfectly applicable to what I'm doing (i.e., sending an assortment of locally stored DICOM files into a specific C-Store SCP). I'm wondering if my issue is stemming from incorrect assumptions about "assoc.SCU(d,1)".

Second, where is the NoneType coming from? I don't see anything out of the ordinary in the files' DICOM headers. Nothing is deprecated, and I've found class definitions for their SOP classes in the applicationentity.py file. Why would a Secondary Capture function, but an Ultrasound Multi-frame Image Storage (1.2.840.10008.5.1.4.1.1.6.1) wouldn't?

I couldn't figure out how to attach a file, so here's the text of my script. Apologies. I can provide excerpts from the relevant DICOM header if necessary, as well.

____________________________________

from netdicom import AE, StorageSOPClass
from dicom.UID import ExplicitVRLittleEndian, ImplicitVRLittleEndian, ExplicitVRBigEndian
from dicom import read_file
import os

#Callback functions defined
def OnAssociateResponse(association):
print "Association response received"

#define working directory and list of studies to be moved
file_path = 'C:\\DICOM'
study_list = os.listdir(file_path)

#define the SCU AE
MyAE = AE('PYDUSTIN', 9999, [StorageSOPClass], [], [ExplicitVRLittleEndian, ImplicitVRLittleEndian, \
ExplicitVRBigEndian])
MyAE.OnAssociateResponse = OnAssociateResponse

#define C-Store SCP
RemoteAE = dict(Address='172.23.164.212', Port=8028, AET='DICOM_STORAGE')

#create association between SCU and SCP; define failure notification
assoc = MyAE.RequestAssociation(RemoteAE)
if not assoc:
print 'Association Failed'
sys.exit(1)

#look through each study
for study in study_list:

#define filepath for current study and list of DICOM files
files_loc = os.path.join(file_path, study)
file_list = os.listdir(files_loc)

#loop through each file in current study
for dicom_file in file_list:

#define file path for current DICOM file and read it into script
file_loc = os.path.join(files_loc, dicom_file)
d = read_file(file_loc)

#send DICOM file to SCP AE
st = assoc.SCU(d,1)

#kill association and SCU AE
assoc.Release(0)
MyAE.Quit()

Reply all
Reply to author
Forward
0 new messages