3

I'm trying to connect to a PACS server using Python (specifically pynetdicom3), however I'm unable to do so using the method specified in the documentation. I am able to access this server using dcm4che. E.g. running findscu -c AETitle@serverIP:port on the command line works (when run from the dcm4che folder).

However, when I try to connect to the server with pynetdicom3 using the code from the docs (slightly modified of course), I get an error regarding the "called AE title". This is the code:

from pynetdicom3 import AE, VerificationSOPClass

ae = AE(ae_title='AETitle',
        port=port,
        scu_sop_class=[VerificationSOPClass])

assoc = ae.associate(serverIP, port)

if assoc.is_established:
    print('Connection established')

Where AETitle, port, and serverIP are the same as the ones I use to access the server in dcm4che, provided by the administrator.

This is the error:

E: Association Rejected:
E: Result: Rejected Permanent, Source: Service User
E: Reason: Called AE title not recognised

The output from running the dcm4che command specifies that the "called AE title" is the same as the one I've used in the command and code. Is this the correct way to specify AE title in pynetdicom3, and if not, what is?

1 Answers1

5

You are currently defining the local Application Entity, i.e. your own python code with the AE title "AETitle".

In basic terms your application at the moment is saying "I am AETitle", not "I want to talk to AETitle" as it should, because the server is not recognising the called AE title.

You have to add the called AE title as a third argument on your association method call.

assoc = ae.associate(serverIP, port, "AEtitle")

Otherwise pynetdicom3 will use some kind of internal default or empty value for the called AE title.

Tarmo R
  • 1,123
  • 7
  • 15
  • Yeah that worked. I couldn't make out from the documentation that AE title is an argument in the associate function, this makes a lot more sense. Thanks! – Rahul Mukherji Jun 13 '18 at 05:13
  • 1
    But the other AE title is also important, that you define with `ae = AE(ae_title='AETitle', port=port, scu_sop_class=[VerificationSOPClass])`. There you define your local "calling AE title" and local listening port for incoming DICOM connections. So in a complete application you need to use both appropriately. – Tarmo R Jun 13 '18 at 06:58
  • What would be the convention for the calling AE title? When I ran the dcm4che command it specified that the calling AE title was just "FindSCU", which is what I used in my code – Rahul Mukherji Jun 14 '18 at 08:52
  • 2
    Basically whatever You want it to be. Best to choose it so it represents the application properly and must be configurable not hard-coded. Something like FindSCU is very generic and no reasonable PACS admin wants to see something like this on their network, because there might be several different systems, that do C-FIND queries to the PACS and the need to be identified. Therefore use location, department or whatever needed in every specific case and listen to Your PACS admin on this. If I had a dollar every time I have to deal with yet another vendor-default generic AE title on my network.... – Tarmo R Jun 14 '18 at 09:05