query/retrieve - newbie help

533 views
Skip to first unread message

Matthew Kavalauskas

unread,
Jan 2, 2014, 5:26:12 PM1/2/14
to pynet...@googlegroups.com
I am a newbie with Python and DICOM.

I am trying to get the query/retrieve example to work.
http://pythonhosted.org/pynetdicom/usecases.html#query-retrieve-from-python

For my PACS, I am using the following virtual machine.

In the example, I hard-coded remote_host and remote_port.  (remote_port is set to 11112.)
I also modified the following line for the correct AET:
RemoteAE = dict(Address=remote_host, Port=remote_port, AET='DCM4CHEE')

The association happens and I get an echo, but then I get problems from st = assoc.PatientRootFindSOPClass.SCU(d, 1).
On the PACS side, there is an EOF exception, which happens in a doParse function.  I would guess it has something to do with the format of the query.
On the pynetdicom side, I see "Results" in the Python console, but it appears to be hung at the "for ss in st" as I see no subsequent messages.

Can someone point me to where to look next?  Two thoughts I had:
1. This link states: "99% of the difficulties in DICOM networking are related the first part – the association negotiation.  Even if this stage passed and we start exchanging commands, the chances are that problems are because of faults in the first part."  So maybe the link isn't quite set up right.
2. Is the Dataset object sufficiently set up?  How do I know what fields I can/should set up?

Thanks,
Matt

Patrice Munger

unread,
Jan 4, 2014, 3:56:57 PM1/4/14
to pynet...@googlegroups.com
Hi Matthew

I just installed the VM, sent some datasets to it and ran the example script with the correct remote AET (DCM4CHEE), and I do get a response from the FindSCU call, with no apparent error on the VM side. Can you send me your script? Also, does your script run on linux or windows?

Thanks and happy new year!

Patrice


Matthew Kavalauskas

unread,
Jan 6, 2014, 8:37:22 AM1/6/14
to pynet...@googlegroups.com
Patrice
Thanks for the quick response.  Your assistance is greatly appreciated.
My script is running on Windows.  I have attached it, but all I have done relative to the example is hard-coded the IP and port, and changed 'AET1' to 'DCM4CHEE'.
The VM was originally on a separate Linux box, but I just tried it on this same Windows computer with the same results.
I have not sent any datasets to the VM on my Windows PC; however, the VM on Linux did have some, which were sent there by someone else.

Here is the python output.  It just sits there after I 
>>> runfile('C:/GE/FPC/Phantom/QR_example.py', wdir=r'C:/GE/FPC/Phantom')
Request association
Association response received
DICOM Echo ...  done with status "Success "
DICOM FindSCU ...  done with status "<generator object SCU at 0x0564C0F8>"
Results
SCU

As you can see, I never get the "Release association" print.  Also, I don't know what the "SCU" output means.  Where does it come from?  If I comment out the "print ss" line, then it is still there, but it goes away if I comment out the entire for loop.  That implies that the iteration over st generates it.  Also, commenting out the for loop eliminates the exceptions on the VM side, which implies that the iteration process also includes communication to the VM.
Perhaps the solution is that I need to add some handling for an empty-set return.  The one argument I have against that is that there are datasets on my Linux box.  (See attached PNG, which was generated as follows.  After logging into the VM's web interface, I pressed the Search button on the Folder tab without modifying any of the search fields.)  In python, I changed the line to d.PatientsName = 'CH*' and saw the same errors.  Maybe I am still doing something wrong?

I will try to figure out how to use the Storage SCU example to send some data.  I think I will be in good shape if I can send a file to the VM, query the VM, and then retrieve it back to a new file.

Is there an easy way to see the lower-level communication details (maybe DICOM data) between python and VM?  Maybe that can shed some light on my issue.

Regards,
Matt
QR_example.py
DCM4CHEE_Capture.PNG

Matthew Kavalauskas

unread,
Jan 6, 2014, 5:41:05 PM1/6/14
to pynet...@googlegroups.com
I tried the Storage SCU example and got a similar exception on the VM.  Furthermore, Python hangs at
print "DICOM StoreSCU ... ",
If I do a ctrl-c at this point, then I see 
problem Secondary Capture Image Storage
Release association
And then the interpreter totally hangs that a ctrl-c won't recover.  I am using a fairly recent version of Python(x,y).

I have attached the .py file and the DICOM file.

Thanks,
Matt
Send_example.py
TG18QC.dcm

Patrice Munger

unread,
Jan 7, 2014, 12:09:05 PM1/7/14
to pynet...@googlegroups.com

Thanks for the files, I will give a try shortly. In the meanwhile, can you check that the firewall on your windows machine does not block anything relevant?

Matthew Kavalauskas

unread,
Jan 7, 2014, 2:48:51 PM1/7/14
to pynet...@googlegroups.com
I don't think my firewall is blocking this traffic, but I don't have much control of what the corporate IT people block/allow.  One indication that it isn't blocking is that the DICOM Echo happens just fine.

I just tried QR_example.py on the VM Linux box with similar results/problems as before.  One difference is that it complained that 'PatientsName' has been deprecated and suggesting using the official DICOM keyword 'PatientName'.  I made the change but got the same error.  I checked the Linux box and none of the ports are blocked.

Regards,
Matt

Patrice Munger

unread,
Jan 8, 2014, 8:45:32 PM1/8/14
to pynet...@googlegroups.com
Hi Matt, 

Which revision of pynetdicom are you using? Your Send_example.py script works perfectly for me on linux. I'm going to give it a try on windows ...

Patrice

Patrice Munger

unread,
Jan 8, 2014, 9:33:29 PM1/8/14
to pynet...@googlegroups.com
Hi again Matt

Just tried your script on windows and it works fine. I also found an issue in the applicationentity module that I have just fixed and pushed https://code.google.com/p/pynetdicom/source/detail?r=5316d9bb954df2cf8bd0c6357b614bde198118ad. Please, try again with this revision and tell me what happens.

Patrice

Matthew Kavalauskas

unread,
Jan 9, 2014, 11:53:56 AM1/9/14
to pynet...@googlegroups.com
In response to your previous question, the version is 0.8.0 on both systems.  Both were installed using the links on this page within the last 2 weeks:
The Windows one was installed using the Windows installer.  The linux one was installed using pip.

I downloaded the code from the link and it now works!
I looked at the diff in the download link and compared to the original version installed on my system.  It appears that what I have installed wasn't even the previous version in the repository.

Regards,
Matt
Reply all
Reply to author
Forward
0 new messages