You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey,
I've implemented a simple "DICOM listener" that listens to incoming DICOM objects (code later) and I've an issue that when sending a DICOM echo from a DCM4CHE server I get an exception:
Exception in thread Thread-1:
**> Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pynetdicom-0.8.1-py2.7.egg/netdicom/DULprovider.py", line 274, in run
if self.CheckNetwork():
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pynetdicom-0.8.1-py2.7.egg/netdicom/DULprovider.py", line 256, in CheckNetwork
self.CheckIncomingPDU()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pynetdicom-0.8.1-py2.7.egg/netdicom/DULprovider.py", line 183, in CheckIncomingPDU
self.pdu = Socket2PDU(rawpdu)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pynetdicom-0.8.1-py2.7.egg/netdicom/DULprovider.py", line 327, in Socket2PDU
pdu.Decode(data)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pynetdicom-0.8.1-py2.7.egg/netdicom/PDU.py", line 171, in Decode
tmp.Decode(Stream)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pynetdicom-0.8.1-py2.7.egg/netdicom/PDU.py", line 907, in Decode
while NextSubItemType(Stream) is not None:
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pynetdicom-0.8.1-py2.7.egg/netdicom/PDU.py", line 1136, in NextSubItemType
return SOPClassExtentedNegociationSubItem
NameError: global name 'SOPClassExtentedNegociationSubItem' is not defined**
It's important to say that DICOM PUSH (C-MOVE) is working good,
I saw comment in saying SOPClassExtentedNegociationSubItem on class SOPClassExtentedNegociationSubItem, where in , if ItemType == 0x56 it should return this class
What could be wrong??
As for my code (maybe I'm doing something wrong):
author = 'talbarda'
from netdicom.applicationentity import AE
from netdicom.SOPclass import *
from dicom.dataset import Dataset, FileDataset
from dicom.UID import ExplicitVRLittleEndian, ImplicitVRLittleEndian, ExplicitVRBigEndian
import os
Hey,
I've implemented a simple "DICOM listener" that listens to incoming DICOM objects (code later) and I've an issue that when sending a DICOM echo from a DCM4CHE server I get an exception:
Exception in thread Thread-1:
**> Traceback (most recent call last):
It's important to say that DICOM PUSH (C-MOVE) is working good,
I saw comment in saying SOPClassExtentedNegociationSubItem on class SOPClassExtentedNegociationSubItem, where in , if ItemType == 0x56 it should return this class
What could be wrong??
As for my code (maybe I'm doing something wrong):
author = 'talbarda'
from netdicom.applicationentity import AE
from netdicom.SOPclass import *
from dicom.dataset import Dataset, FileDataset
from dicom.UID import ExplicitVRLittleEndian, ImplicitVRLittleEndian, ExplicitVRBigEndian
import os
TRANSFER_SYNTAX = [ExplicitVRLittleEndian,
ImplicitVRLittleEndian,
ExplicitVRBigEndian]
ae_title = 'SOME_AE_TITLE'
pacs_port = 9996
STUDIES_PATH='/tmp/studies'
def ensure_dir(f):
d = os.path.dirname(f)
if not os.path.exists
def _get_study_path(study_id):
return os.path.join(STUDIES_PATH, study_id)
def _get_series_path(study_path, series_id):
return os.path.join(study_path, series_id)
def get_dicom_path(DS):
series_path = _get_series_path(_get_study_path(DS.StudyInstanceUID), DS.SeriesInstanceUID)
dicomUID = str(DS.InstanceNumber) + "" + str(DS.SOPInstanceUID) + '.dcm'
return os.path.join(series_path, dicomUID)
def get_dataset_meta():
file_meta = Dataset()
file_meta.MediaStorageSOPClassUID = '1.2.840.10008.5.1.4.1.1.2'
file_meta.MediaStorageSOPInstanceUID = "1.2.3" # !! Need valid UID here
file_meta.ImplementationClassUID = "1.2.3.4" # !!! Need valid UIDs here
return file_meta
def store_ds(dataset_to_store, sop_instance_uid, study_id):
filename = _get_dicom_path(dataset_to_store)
ds = FileDataset(filename_or_obj=filename, dataset=dataset_to_store, file_meta=get_dataset_meta(),
preamble="\0" * 128)
validate the file's directory exists, and if not create it
ensure_dir(filename)
ds.save_as(filename)
def on_receive_store(SOPClass, received_dataset):
curr_study_id = received_dataset.StudyInstanceUID
curr_series_id = received_dataset.SeriesInstanceUID
curr_sop_instance_uid = received_dataset.SOPInstanceUID
print(
"Got message of:\nstudy %r\nseries %r\nsop %r" % (curr_study_id, curr_series_id, curr_sop_instance_uid))
try:
store_ds(received_dataset, curr_sop_instance_uid, curr_study_id)
# must return appropriate status
return SOPClass.Success
except:
print("Failed storing ds %s" % received_dataset)
raise # TODO - return failure?
def on_receive_echo(association):
print("Association response received")
def on_associate_response(association):
print("Association response received")
def on_associate_request(association):
print("Association requested")
return True
print("Starting AE %r on port %s" % (ae_title, pacs_port))
MyAE = AE(AET=ae_title,
port=pacs_port,
SOPSCU=[PatientRootFindSOPClass,
PatientRootMoveSOPClass,
StudyRootMoveSOPClass,
StudyRootFindSOPClass,
VerificationSOPClass],
SOPSCP=[VerificationSOPClass, StorageSOPClass], SupportedTransferSyntax=TRANSFER_SYNTAX)
MyAE.OnAssociateResponse = on_associate_response
MyAE.OnAssociateRequest = on_associate_request
MyAE.OnReceiveStore = on_receive_store
MyAE.OnReceiveEcho = on_receive_echo
MyAE.start()
MyAE.QuitOnKeyboardInterrupt()
The text was updated successfully, but these errors were encountered: