pydicom / pynetdicom

A Python implementation of the DICOM networking protocol
https://pydicom.github.io/pynetdicom
MIT License
511 stars 180 forks source link

Abort with "no value available" upon CFIND request #927

Closed blissdismissed closed 7 months ago

blissdismissed commented 7 months ago

I'm trying to do a series of queries to get from an accession number to a studyUID. But all of my attempts at querying result in an A-Abort with the reason of (no value available).

I don't understand why. I tried by patient name and patientID and made sure they exist in the PACS db. Am I missing something else in the query to get this to work?

from pydicom.dataset import Dataset

from pynetdicom import AE, debug_logger
from pynetdicom.sop_class import PatientRootQueryRetrieveInformationModelFind

debug_logger()

ae = AE()
ae.add_requested_context(PatientRootQueryRetrieveInformationModelFind)

# Create our Identifier (query) dataset
ds = Dataset()
ds.PatientName = 'Last^first'
ds.QueryRetrieveLevel = 'PATIENT'

# Associate with the peer AE at IP 127.0.0.1 and port 11112
assoc = ae.associate("172.11.165.11", 20500, ae_title="PACS-AETitle")
if assoc.is_established:
    # Send the C-FIND request
    responses = assoc.send_c_find(ds, PatientRootQueryRetrieveInformationModelFind)
    for (status, identifier) in responses:
        if status:
            print('C-FIND query status: 0x{0:04X}'.format(status.Status))
        else:
            print('Connection timed out, was aborted or received invalid response')

    # Release the association
    assoc.release()
else:
    print('Association rejected, aborted or never connected')

Appreciate any help folks can offer. If it helps I am trying to query a Visage 7 pacs instance. My CMOVE with the patientID, studyInstanceUID and seriesInstanceUID works well. Just trying to get those parameters as a first step in the process is not working.

scaramallion commented 7 months ago

What's the output from debug_logger() look like?

blissdismissed commented 7 months ago

It wasn't too helpful to my untrained eye. Hopefully you can glean something from it:

Captura de Pantalla 2024-04-09 a la(s) 8 12 27 p  m
blissdismissed commented 7 months ago

In case it helps anyone else, I found the problem.

I needed to add the requesting AE Title to my application entity instance: ae = AE() ==> ae = AE(ae_title="mySCU_AETitle)

The documentation and examples should be clearer about this, as I had to really dig into the assocation to find a hidden default aetitle of pynetdicom.

scaramallion commented 7 months ago

I mean, is this not enough....?