Implementing a Query/Retrieve SCP
A Query/Retrieve SCP receives queries and sends answers after comparing the data elements in the queries with the data elements in the DICOM objects it can serve. The SCP also receives requests to move DICOM objects to another application entity (usually the one that sent the query and the move request).
Implementing such SCP with DeCaMino requires the instanciantiation of a QueryRetrieveSCP
:
QueryRetrieveSCP scp = new QueryRetrieveSCP(listener); scp.start();
listener
is an instance of a class representing the logic of your Q/R SCP. It must implement a method called when a query is received (how to match data elements) and a method called when a retrieve is received (which DICOM object to send). A third method is also mandatory to declare what information model it supports (what set of data elements we are able to match, following models defined in DICOM specification):
class Listener implements QueryRetrieveSCPListener { public void queryReceived(QueryRetrieveSCP.Operation op) { Identifier id = op.identifier; /* Search our local database for patients, studies, series or images matching the data elements contained in id. For each match, build a response identifier, and call: */ op.sendQueryResponsePending(responseId); /* Then, when the matching is complete: */ op.sendQueryResponseFinal(); } public void retrieveReceived(QueryRetrieveSCP.Operation op) { /* Read the objects the SCU is asking for in op.identifier, then write each matching objects using the operation as the writer output: */ writer.setOutput(op); writer.write(dmd); /* Then when the sending is complete: */ op.sendRetrieveResponseFinal(); } public boolean supportsSyntax(String syn) { return UID.PatientRootQueryRetrieveInformationModelFIND.equals(syn) || UID.PatientRootQueryRetrieveInformationModelMOVE.equals(syn); } }