Giter Site home page Giter Site logo

pynetdicom_legacy's People

Contributors

alexwhittemore avatar cancan101 avatar edmcdonagh avatar naggie avatar patmun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pynetdicom_legacy's Issues

Missing SOPClass

Still missing the following SOPClass:

+class SpatialRegistrationSOPClass(StorageSOPClass):
+    UID = '1.2.840.10008.5.1.4.1.1.66.1'
+
+
+class EnhancedSRSOPClass(StorageSOPClass):
+    UID = '1.2.840.10008.5.1.4.1.1.88.22'
+
+
+class XRayRadiationDoseSRSOPClass(StorageSOPClass):
+    UID = '1.2.840.10008.5.1.4.1.1.88.67'
+
+
+class DigitalXRayImageStorageForPresentationSOPClass(StorageSOPClass):
+    UID = '1.2.840.10008.5.1.4.1.1.1.1'
+
+
+class DigitalXRayImageStorageForProcessingSOPClass(StorageSOPClass):
+    UID = '1.2.840.10008.5.1.4.1.1.1.1.1'
+
+
+class 
DigitalMammographyXRayImageStorageForPresentationSOPClass(StorageSOPClass):  # 
noqa
+    UID = '1.2.840.10008.5.1.4.1.1.1.2'
+
+
+class DigitalMammographyXRayImageStorageForProcessingSOPClass(StorageSOPClass):
+    UID = '1.2.840.10008.5.1.4.1.1.1.2.1'
+
+
+class DigitalIntraOralXRayImageStorageForPresentationSOPClass(StorageSOPClass):
+    UID = '1.2.840.10008.5.1.4.1.1.1.3'
+
+
+class DigitalIntraOralXRayImageStorageForProcessingSOPClass(StorageSOPClass):
+    UID = '1.2.840.10008.5.1.4.1.1.1.3.1'
+
+

Original issue reported on code.google.com by agrothberg on 19 Jan 2015 at 10:55

Python 3?

I don't know if this is still being actively developed but are their plans to port to Python 3?

QR: cannot move images

Hi Patrice,
First of all, thank you for making pynetdicom publicly availabe!
I have recently started playing with pynetdicom. While querying remote Dicom hosts as described in the "Typical use cases" of the documentation works like a charm in various variants, I have so far not managed to retrieve an image from any of 4 Dicom nodes from which a transfer using different software, but identical Dicom node definitions, works.

I am mostly following code as examplified in "qrscu.py". I define the local AE, e.g., as follows:
ae = netdicom.applicationentity.AE(node.AET, node.port,
[netdicom.StorageSOPClass,
netdicom.PatientRootFindSOPClass,
netdicom.PatientRootMoveSOPClass,
netdicom.StudyRootFindSOPClass,
netdicom.StudyRootMoveSOPClass,
netdicom.VerificationSOPClass
],
[#netdicom.PatientRootFindSOPClass,
netdicom.StorageSOPClass,
netdicom.VerificationSOPClass,
netdicom.MRImageStorageSOPClass
],
[dicom.UID.ImplicitVRLittleEndian,
])
where "node" is a named tuple (DicomNode('local', 'XXX.XXX.XXX.X', 104, 'AE Title')), with
DicomNode = namedtuple('DicomNode', 'name ip port AET'). I varied the list of SCUs and SCPs in various shades and would think that if the example in "qrscu.py" is complete I most likely have tried with a "correct" version. (I would first like to retrieve a single MR Image, using the StudyRootMoveSOPClass.)

Running the code, the call to the SCU, which looks something like:

for result in association.StudyRootMoveSOPClass.SCU(query_dataset, local_aet, 1):
yield result

yields a single "Pending" string. The program execution ends without error, but the
ae.OnReceiveStore
method of the local application entity is never called. (query_dataset is, e.g., a pydicom dataset obtained from a prior query of the same remote Dicom node, identifying a single image, and having set the "QueryRetrieveLevel" attribute to 'IMAGE'.)

(By the way the AE title in the SCU call example in the "qrscu.py" documentation is hard coded to 'PYNETDICOM', even though it is parsed as an input argument. I assume this is the title of the local, move-target AE?).

I also tried to move series, studies, or patients, with what I thought according modifications, so far without success.

If I call logger_setup() and debug(True) just before the intended move, many
netdicom.DIMSEprovider In DIMSEprovider.Receive
lines are printed.

The output ends with the following:


netdicom.fsm
netdicom.fsm Thread-8: current state is: Sta6 Association established and ready for data transfer
netdicom.fsm Thread-8: event: Evt10 P-DATA-TF PDU (on transport connection)
netdicom.fsm Thread-8: entering action: (Evt10, Sta6) DT-2 Send P-DATA indication primitive
netdicom.fsm Thread-8: action complete. State is now Sta6 Association established and ready for data transfer
netdicom.DIMSEprovider In DIMSEprovider.Receive
netdicom.DIMSEmessages command fragment 7
netdicom.DIMSEmessages last command fragment 7
netdicom.DIMSEprovider Received DIMSE message: (0000, 0000) CommandGroupLength UL: 106
(0000, 0002) Affected SOP class UI: Study Root Query/Retrieve Information Model - MOVE
(0000, 0100) CommandField US: 32801
(0000, 0120) MessageIDBeingRespondedTo US: 1
(0000, 0800) DataSetType US: 257
(0000, 0900) Status US: 0
(0000, 1021) NumberOfCompletedSubOperations US: 1
(0000, 1022) NumberOfFailedSubOperations US: 0
(0000, 1023) NumberOfWarningSubOperations US: 0

netdicom.fsm
netdicom.fsm Thread-8: current state is: Sta6 Association established and ready for data transfer
netdicom.fsm Thread-8: event: Evt11 A-RELEASE request primitive
netdicom.fsm Thread-8: entering action: (Evt11, Sta6) AR-1 Send A-RELEASE-RQ PDU
netdicom.fsm Thread-8: action complete. State is now Sta7 Awaiting A-RELEASE-RP PDU
netdicom.fsm
netdicom.fsm Thread-8: current state is: Sta7 Awaiting A-RELEASE-RP PDU
netdicom.fsm Thread-8: event: Evt13 A-RELEASE-RP PDU (on transport)
netdicom.fsm Thread-8: entering action: (Evt13, Sta7) AR-3 Issue A-RELEASE confirmation primitive and close transport connection
netdicom.fsm Thread-8: action complete. State is now Sta1 Idle


This seems to indicate the image may have indeed been transferred? (Which would also be congruent with - terse - logging information in some of the remote hosts.) But still the "OnReceiveStore" method of the local AE is never called.

This is
Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit (AMD64)] on win32
with

netdicom.version
'0.8.1'

Is this sufficient information to guess what I'm doing wrong?

Broken Pipe Issue

I think this patch: 
https://code.google.com/p/pynetdicom/source/detail?r=59c538098e9153cc605392ac6df
b5e2709bbea55 solved some problems but just kicked the can down to cause this 
issue:

  File "/Users/alex/git/pynetdicom/source/netdicom/DULprovider.py", line 294, in run
    self.SM.Action(evt, self)
  File "/Users/alex/git/pynetdicom/source/netdicom/fsm.py", line 505, in Action
    action[1](c)
  File "/Users/alex/git/pynetdicom/source/netdicom/fsm.py", line 36, in AE_2
    provider.RemoteClientSocket.send(provider.pdu.Encode())
error: [Errno 32] Broken pipe

Original issue reported on code.google.com by agrothberg on 12 Feb 2015 at 7:26

pydicom is changing the package name

It looks like the package name will change from dicom to pydicom (see: 
https://github.com/darcymason/pydicom/issues/46).

One option during the transition would be something like:
try:
   import pydicom as dicom
except ImportError:
   import dicom

Original issue reported on code.google.com by agrothberg on 5 Feb 2015 at 4:51

Migration to GitHub (or another place)

Google Code will become read only in less than a month, and the project should 
be moved somewhere else.

Are you going to mantain it?
Are you going to move it somewhere else?
Should we just fork it?

Thanks!

Original issue reported on code.google.com by [email protected] on 4 Aug 2015 at 7:46

Missing StorageSOPClasses

See GitHub fork: https://github.com/alexwhittemore/pynetdicom

Under the change list: https://github.com/alexwhittemore/pynetdicom#change-list

Added (numerous) StorageSOPClasses (IDs found at 
http://www.dicomlibrary.com/dicom/sop/)

Original issue reported on code.google.com by agrothberg on 21 Oct 2014 at 3:53

C-GET Only Supports the Client Side (SCU) not the Server (SCP)

This method exists, but not the SCP:

    def SCU(self, ds, msgid):
        # build C-GET primitive
        cget = C_GET_ServiceParameters()
        cget.MessageID = msgid
        cget.AffectedSOPClassUID = self.UID
        cget.Priority = 0x0002
        cget.Identifier = dsutils.encode(ds,
                                         self.transfersyntax.is_implicit_VR,
                                         self.transfersyntax.is_little_endian)

        # send c-get primitive
        self.DIMSE.Send(cget, self.pcid, self.maxpdulength)

        while 1:
            # receive c-store
            msg, id = self.DIMSE.Receive(Wait=True)

Original issue reported on code.google.com by agrothberg on 22 Apr 2015 at 9:19

import dicom error

Hi all,
  I use the pynetdicom 0.8.0, and test the example(findscu.py), but there is an import error. Like below:

  File "C:\Program Files\Python 2.7\Lib\site-packages\netdicom\dsutils.py", line 9, in <module>
    import dicom
ImportError: No module named dicom

  I just install the "pynetdicom-0.8.0.win32.exe" by double click, and add the "C:\Program Files\Python 2.7\Lib\site-packages\netdicom" to the Eclipse option.

  So, how to fix this issue? Thanks!

OS: Win7 32 bit
IDE: Eclipse 


Original issue reported on code.google.com by [email protected] on 25 Apr 2012 at 2:52

no timeout if DICOM port doesn't answer

If you will try to connect to wrong port, you connection will be waiting 
forever, if server doesn't broke it.
To fix this problem i changed line 63 at "ACSEprovider.py" from assrsp = 
self.DUL.Receive(True) to assrsp = self.DUL.Receive(True, 
self.RemoteAE['Timeout'])
Now, i has to setting timeout in seconds for DICOM connection from my script or 
set None:
RemoteAE = dict(Address=host, Port=port, AET='DICOM', Timeout=10)

Original issue reported on code.google.com by nixargh on 28 May 2012 at 2:12

distribute_setup is forcing install of distribute

I already have distribute-0.7.3 but the installer is also installing 0.6.25.

This then causes problems for other installations. 

Original issue reported on code.google.com by agrothberg on 22 Jan 2015 at 11:53

Improve applicationentity.Association::__getattr__

Improve applicationentity.Association::__getattr__

See:
http://stackoverflow.com/a/15805499/2638485

patch:
diff --git a/source/netdicom/applicationentity.py 
b/source/netdicom/applicationentity.py
index 71219d8..a6f13bf 100755
--- a/source/netdicom/applicationentity.py
+++ b/source/netdicom/applicationentity.py
@@ -75,7 +75,11 @@ class Association(threading.Thread):
     def __getattr__(self, attr):
         # while not self.AssociationEstablished:
         #    time.sleep(0.001)
-        obj = eval(attr)()
+        try:
+           obj = eval(attr)()
+        except NameError:
+           raise AttributeError
+
         try:
             obj.pcid, obj.sopclass, obj.transfersyntax = \
                 [x for x in self.SOPClassesAsSCU if

Original issue reported on code.google.com by agrothberg on 12 Feb 2015 at 7:17

can't install from requirements.txt

What steps will reproduce the problem?
1. Set up a clean virtualenv
2. Create a requirements.txt with lines for pydicom and pynetdicom
3. pip install -r requirements.txt

We get:

in <module>
        import netdicom
      File "netdicom/__init__.py", line 7, in <module>
        from applicationentity import AE
      File "netdicom/applicationentity.py", line 15, in <module>
        from SOPclass import *
      File "netdicom/SOPclass.py", line 7, in <module>
        import dsutils
      File "netdicom/dsutils.py", line 9, in <module>
        import dicom
    ImportError: No module named dicom

because pynetdicom's setup.py imports netdicom, which has an import-time 
requirement on pydicom. See this:

https://github.com/pypa/pip/issues/25

for details.

Original issue reported on code.google.com by [email protected] on 16 Jan 2014 at 7:45

Incorrect indentation

Incorrect indentation here: 
https://code.google.com/p/pynetdicom/source/browse/source/netdicom/applicationen
tity.py?spec=svnbcdde35b2aaea722b9c58477cee10f2d302360cc&r=bcdde35b2aaea722b9c58
477cee10f2d302360cc#327

Should look like: 
https://github.com/cancan101/pynetdicom/commit/981ec10dc8cc554d7ba7e864d932ea18a
df7a88c

Original issue reported on code.google.com by agrothberg on 19 Jan 2015 at 10:52

Unable to run Client and Server on the Same Machine

For example try to run both of the examples: storescu and storescp on the same 
machine and you get:

Traceback (most recent call last):
  File "storescu.py", line 54, in <module>
    MyAE = AE(args.aet, 9999, [StorageSOPClass,  VerificationSOPClass], [], ts)
  File "/usr/local/Cellar/python/2.7.7_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pynetdicom-0.8.1-py2.7.egg/netdicom/applicationentity.py", line 226, in __init__
    self.LocalServerSocket.bind(('', port))
  File "/usr/local/Cellar/python/2.7.7_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 48] Address already in use

I assume this is because both want to bind exclusively to the port.

Original issue reported on code.google.com by agrothberg on 21 Oct 2014 at 2:14

Missing re-raise

Probably want except clause to look like: 
https://github.com/cancan101/pynetdicom/blob/00f24611d5538c08e2f8112520375b2d3e1
7d051/source/netdicom/DULprovider.py#L299

rather than: 
https://code.google.com/p/pynetdicom/source/browse/source/netdicom/DULprovider.p
y?spec=svnbcdde35b2aaea722b9c58477cee10f2d302360cc&r=bcdde35b2aaea722b9c58477cee
10f2d302360cc#292

Original issue reported on code.google.com by agrothberg on 19 Jan 2015 at 10:58

C_GET_RQ_Message::ToParams Inconsistent with All Other ToParams

.value is call on numeral fields:

    def ToParams(self):
        tmp = C_GET_ServiceParameters()
        tmp.MessageID = self.CommandSet[(0x0000, 0x0110)].value
        tmp.AffectedSOPClassUID = self.CommandSet[(0x0000, 0x0002)].value
        tmp.Priority = self.CommandSet[(0x0000, 0x0700)].value
        tmp.Identifier = self.DataSet
        return tmp

compare that to C_MOVE_RQ_Message:
    def ToParams(self):
        tmp = C_MOVE_ServiceParameters()
        tmp.MessageID = self.CommandSet[(0x0000, 0x0110)]
        tmp.AffectedSOPClassUID = self.CommandSet[(0x0000, 0x0002)]
        tmp.Priority = self.CommandSet[(0x0000, 0x0700)]
        tmp.MoveDestination = self.CommandSet[(0x0000, 0x0600)]
        tmp.Identifier = self.DataSet
        return tmp

Original issue reported on code.google.com by agrothberg on 22 Apr 2015 at 9:34

Retrieve entire Dataset/metadata from remote PACS?

Hi, it seems as though you have to specify each key you want returned from the Remote PACS. Is there a way to say "give me all of the meta data that match this query"? For example, I want to find all Patients and their respective metadata that look like *john*.

Thanks

Add timeout option

Consider adding a timeout here so that if the host is down, the thread doesn't 
hang for a long time:
https://code.google.com/p/pynetdicom/source/browse/source/netdicom/fsm.py#22

Original issue reported on code.google.com by agrothberg on 12 Feb 2015 at 7:23

Missing self

https://code.google.com/p/pynetdicom/source/browse/source/netdicom/SOPclass.py?s
pec=svn2ebb51548127bf4cc6de867e550f44102e7c4cbf&r=2ebb51548127bf4cc6de867e550f44
102e7c4cbf#351

should be self.CannotUnderstand

Original issue reported on code.google.com by agrothberg on 22 Apr 2015 at 8:06

Example should use port 0 (ephemeral port) rather than 9999

Currently the example shows starting the AE with a client port of 9999:
https://code.google.com/p/pynetdicom/source/browse/source/netdicom/examples/stor
escu.py#54
rather than using port 0 (OS assigned ephemeral port).

See for reference: http://en.wikipedia.org/wiki/Ephemeral_port

I don't see a reason to always start the client port on 9999 as this causes 
port conflicts. 

Original issue reported on code.google.com by agrothberg on 24 Oct 2014 at 2:24

Consider Moving to GitHub

pydicom recently moved to GitHub: https://github.com/darcymason/pydicom

Original issue reported on code.google.com by agrothberg on 14 Jan 2015 at 5:23

error: [Errno 54] Connection reset by peer

Exception in thread Thread-18:
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.7_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/local/Cellar/python/2.7.7_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pynetdicom-0.8.1-py2.7.egg/netdicom/DULprovider.py", line 252, in run
    if self.CheckNetwork():
  File "/usr/local/Cellar/python/2.7.7_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pynetdicom-0.8.1-py2.7.egg/netdicom/DULprovider.py", line 238, in CheckNetwork
    self.CheckIncomingPDU()
  File "/usr/local/Cellar/python/2.7.7_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pynetdicom-0.8.1-py2.7.egg/netdicom/DULprovider.py", line 176, in CheckIncomingPDU
    tmp = recvn(self.RemoteClientSocket, length[0])
  File "/usr/local/Cellar/python/2.7.7_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pynetdicom-0.8.1-py2.7.egg/netdicom/DULprovider.py", line 39, in recvn
    tmp = sock.recv(n - read_length)
error: [Errno 54] Connection reset by peer

Original issue reported on code.google.com by agrothberg on 29 Oct 2014 at 5:51

DicomStringIO removed from pydicom 0.9.8

I've come across an issue with the 'pydicom 0.9.7 and above' prerequisite. The 
dicom.__version_info__ check in pynetdicom/netdicom/dsutils.py needs to be 
changed to (0,9,8) from (1,0,0).

Reason being, the installation (pip) fails when importing dsutils:
    import dsutils
  File "netdicom/dsutils.py", line 13, in <module>
    from dicom.filebase import DicomStringIO as DicomBytesIO
ImportError: cannot import name DicomStringIO

My pydicom version:
>>> import dicom
>>> dicom.__version_info__
(0, 9, 8)

This version no longer has DicomStringIO:
>>> dicom.filebase.DicomStringIO()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'DicomStringIO'

But it does have DicomBytesIO, as currently expected for pydicom versions >= 
1.0.0:
>>> dicom.filebase.DicomBytesIO()
<dicom.filebase.DicomFileLike object at 0xbfba50>

It's a small enough issue, but I figured you'd like to know. Thanks for 
providing this library! :o)

Original issue reported on code.google.com by [email protected] on 3 Jan 2013 at 9:35

Print is not thread-safe, deadlock on print in frozen python exec (windows service)

What steps will reproduce the problem?
1. Create windows service providing Store SCP in py2exe
2. Send more than ~300 files in one association

What is the expected output? What do you see instead?
SCP hangs, cannot open new association, SCU waits for response. 
When you delete "print" expressions (in this particular issue from SOPclass.py 
StorageServiceClass SCP line 161 - print "Status: %s" % status) program works 
well. 

What version of the product are you using? On what operating system?
v. 0.8.0, Windows XP 32bit, Windows 7 64bit.

Please provide any additional information below.
The problem didn't occur in pure python version and in frozen exe file not 
being Windows service.

I advice to remove all print expressions from code. I've encountered deadlocks 
on print in threaded python applications.

Original issue reported on code.google.com by [email protected] on 23 Oct 2012 at 10:46

KeyError: ('Evt11', 'Sta1')

For some files I sometimes, but not always get the following error:

Exception in thread Thread-63:
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.7_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/local/Cellar/python/2.7.7_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pynetdicom-0.8.1-py2.7.egg/netdicom/DULprovider.py", line 264, in run
    self.SM.Action(evt, self)
  File "/usr/local/Cellar/python/2.7.7_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pynetdicom-0.8.1-py2.7.egg/netdicom/fsm.py", line 481, in Action
    action_name = TransitionTable[(event, self.CurrentState)]
KeyError: ('Evt11', 'Sta1')

This only happens when I create the association as:
 ts = [dicom_file.file_meta.TransferSyntaxUID]
MyAE = AE(aet_client, 0, SupportedTransferSyntax, [], ts)

If I set ts to:
   ts = [
        ExplicitVRLittleEndian,
        ImplicitVRLittleEndian,
        ExplicitVRBigEndian
        ]

then I do not get this error.

Original issue reported on code.google.com by agrothberg on 29 Oct 2014 at 4:45

some problems

1. Not working with python 3.2, had to use with 2.7
2. Can't use SSL for DICOM connection

Do you planning to develop pynetdicom?

Original issue reported on code.google.com by nixargh on 25 May 2012 at 10:59

TypeError raised in DIMSEmessages.Decode

I get the following error when attempting to perform a MOVE using the provided 
qrscu.py example. The SCP is a GE MRI Scanner.

Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/home/nims/netdicom/local/lib/python2.7/site-packages/pynetdicom-0.8.1-py2.7.egg/netdicom/applicationentity.py", line 154, in run
    dimsemsg, pcid = self.DIMSE.Receive(Wait=False, Timeout=None)
  File "/home/nims/netdicom/local/lib/python2.7/site-packages/pynetdicom-0.8.1-py2.7.egg/netdicom/DIMSEprovider.py", line 86, in Receive
    if self.message.Decode(self.DUL.Receive(Wait, Timeout)):
  File "/home/nims/netdicom/local/lib/python2.7/site-packages/pynetdicom-0.8.1-py2.7.egg/netdicom/DIMSEmessages.py", line 180, in Decode
    self.DataSet += vv[1][1:]
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'

What steps will reproduce the problem?
1.  Attempting to perform a MOVE using qrscu.py

What is the expected output? What do you see instead?
The expected output is that files would be copied to the requestor.  No files 
are copied. Instead, I see the error traceback provided above.

What version of the product are you using? On what operating system?
pynetdicom v0.8.1, python 2.7.3, Linux.

Original issue reported on code.google.com by [email protected] on 3 Apr 2014 at 7:30

raise exception AFTER return statement #2

There is another occurrence of this issue here as well: 
https://code.google.com/p/pynetdicom/source/browse/source/netdicom/applicationen
tity.py?spec=svnb0dbe895dce6eb1d627619e5fd97703471022673&r=b0dbe895dce6eb1d62761
9e5fd97703471022673#84

Original issue reported on code.google.com by agrothberg on 14 Jan 2015 at 6:34

Strange Behavior in `DIMSEprovider.Receive`

Currently DIMSEprovider.Receive takes Wait and Timeout. If Wait is set to True, regardless of what Timeout is set to (None or an int), there is the possibility to be stuck in an spin loop indefinitely.
As of now if the TCP connection is cut, it is possible to be stuck in this loop indefinitely which is not desirable.

If Wait is set to False then no waiting happens regardless of what Timeout is set to.

Support for SSL / TLS

* https://www.medicalconnections.co.uk/kb/Transport_Layer_Security
* 
https://www.leadtools.com/help/leadtools/v19/dh/to/leadtools.topics.dicom~di.top
ics.addingtlssecurity.html

Original issue reported on code.google.com by agrothberg on 9 May 2015 at 12:00

DICOM echo from DCM4CHE results in exception "NameError: global name 'SOPClassExtentedNegociationSubItem' is not defined"

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

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()

Query/Download Dicom for patient with ID example?

Hi, do you have any examples of querying and downloading Dicoms for a patient with a given ID? I'm guessing you have to query all of the studies for a patient first. I'm looking to write a DICOM to a user on a remote PACS. Thanks

long-running SCP methods should be generators

Currently long running SCP methods are long running, making progress updates impossible. SCU methods allow progress updates by yielding status+dicom messages.

I'll implement this when I get some time

DULServiceProvider thread should be a daemon

The DULServiceProvider thread should be configurable to be a daemon thread. It 
would then just die with the main thread.

How to:
Just add a "self.daemon = True" after the initialization of the thread.

Original issue reported on code.google.com by [email protected] on 9 Aug 2012 at 6:30

Threads aren't dying/closing

Hey,
I've implemented a simple "DICOM listener" that listens to incoming DICOM objects (code later) and I've an issue that threads are started to accumulate instead of dying/closing normally.

I saw you implemented an option to put the "MaxAssociationIdleSeconds" parameter in the AE class, but I can't see you already deployed it (did "pip install --upgrade netdicom" and didn't see the change).
When are you going to deploy it so it'll be available through "pip"?

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()

raise exception AFTER return statement

The exception raised here: 
https://code.google.com/p/pynetdicom/source/browse/source/netdicom/applicationen
tity.py?spec=svnb0dbe895dce6eb1d627619e5fd97703471022673&r=b0dbe895dce6eb1d62761
9e5fd97703471022673#69 does not do anything since it is raised AFTER the return 
statement.

Original issue reported on code.google.com by agrothberg on 29 Oct 2014 at 7:44

AE.RequestAssociation Does not Immediately Handle DULServiceProvider Thread Death

If the DULServiceProvider Thread dies, for example:

Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.7_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/local/Cellar/python/2.7.7_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pynetdicom-0.8.1-py2.7.egg/netdicom/DULprovider.py", line 264, in run
    self.SM.Action(evt, self)
  File "/usr/local/Cellar/python/2.7.7_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pynetdicom-0.8.1-py2.7.egg/netdicom/fsm.py", line 501, in Action
    action[1](c)
  File "/usr/local/Cellar/python/2.7.7_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pynetdicom-0.8.1-py2.7.egg/netdicom/fsm.py", line 25, in AE_1
    provider.primitive.CalledPresentationAddress)
  File "/usr/local/Cellar/python/2.7.7_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 51] Network is unreachable

This while look in RequestAssociation continues for decent time afterwards:

        while not assoc.AssociationEstablished \
                and not assoc.AssociationRefused:
            time.sleep(0.1)


Original issue reported on code.google.com by agrothberg on 23 Oct 2014 at 5:27

X-Ray Angiography SOP class not supported

FIX:
Please add
"""
class AXImageStorageSOPClass(StorageSOPClass):
    UID = '1.2.840.10008.5.1.4.1.1.12.1'
"""
to SOPclass.py and add import of this class in netdicom.py


Thanks for this great package,
Tom

Original issue reported on code.google.com by [email protected] on 6 Jul 2012 at 9:17

Add docs on how to run tests

There is no documentation right now.

Original issue reported on code.google.com by agrothberg on 5 Feb 2015 at 2:54

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.