Send a Dicom file to PACS

333 views
Skip to first unread message

Thanasis Iliopoulos

unread,
Apr 24, 2015, 9:20:04 AM4/24/15
to dcm...@googlegroups.com
Hello!

i am trying to send a dicom file (dicomized pdf report file) to several PACS systems. In some cases i can do it while in some other the dicom is not being sent without any errors in my log. 

Here is my java code:

public void sendDicomPdfToPacs(String dcmFilePath) throws Exception, IOException {
        
        Path tmpPdfDcm = Paths.get(dcmFilePath+".dcm");
        
        GlobalConfig cfg = new GlobalConfig();
        String localPacsAet = "";
        String localPacsIp="";
        int localPacsPort=0;
        localPacsAet = cfg.getLocalPacsAet1();
        localPacsPort = cfg.getLocalPacsPort1();
        localPacsIp = cfg.getLocalPacsIp();
        
        DcmEcho dcmEcho = new DcmEcho("device");
        dcmEcho.setRemoteHost(localPacsIp);
        dcmEcho.setRemotePort(localPacsPort);
        dcmEcho.setCalledAET(localPacsAet, true);
        dcmEcho.setCalling("DCMROUTER");
        
        Boolean dcmPacsStatus=false;
        
        try {
            dcmEcho.open();
            dcmPacsStatus=true;
            log.info("PACS is up and running");
            dcmEcho.close();
        } catch (IOException ex) {
            ...
        }
        
        
        if(dcmPacsStatus) {
            DcmSnd dcmsnd = new DcmSnd("device");

            //Set parameters AET
            dcmsnd.setCalledAET(localPacsAet);
            dcmsnd.setRemoteHost(localPacsIp);
            dcmsnd.setRemotePort(localPacsPort);
            dcmsnd.setCalling("DCMROUTER");
            
            //Set other default parameters
            dcmsnd.setOfferDefaultTransferSyntaxInSeparatePresentationContext(false);
            dcmsnd.setSendFileRef(false);
            dcmsnd.setStorageCommitment(false);
            dcmsnd.setPackPDV(true);
            dcmsnd.setTcpNoDelay(true);
            //Add DICOM file
            dcmsnd.addFile(tmpPdfDcm.toFile());
            // Configure transfer capability
            dcmsnd.configureTransferCapability();
            try {
                dcmsnd.start();
                log.info("Dicom Send initiated...");
            } catch (Exception e) {
                ...
            }
        
            try {
                long t1 = System.currentTimeMillis();
                dcmsnd.open();
                long t2 = System.currentTimeMillis();
                Logger.getLogger("Connected to " + localPacsAet + " in " + ((t2-t1)/1000F)+ "s");
                dcmsnd.send();
                dcmsnd.close();
                log.info("Released connection to " + localPacsAet);
            } catch (IOException e) {
               ...
            }  finally {
                dcmsnd.stop();
                
                /* delete dicom file! */
               ...
                
            }
        } else {
            log.info("Local PACS is down... Can not perform DICOM send request.");
        }
    }

If i try to send to an Osirix PACS then the dicom file is being send succesfully ...

If i try to send to other PACS systems (e.g. Agfa) then i am getting the following message to my log:

Encapsulated Document:  (0042,0011) OB #795856 [25\50\44\46\2D\31\2E\33\0A\25\E2\E3\CF\D3\0A\31\20\30\20\6F\62\...]
MIME Type of Encapsulated Document:     (0042,0012) LO #16 [application/pdf]
2015-04-24 15:57:02 INFO  ProcessPdfReportFiles:487 - Going to perfom DICOM send request for file: C:\XXXXXXXX\5912.pdf.dcm to local pacs: PA...@10.37.5.50:104
38920 [DefaultQuartzScheduler_Worker-2] INFO org.dcm4che2.net.Association - Association(1) initiated Socket[addr=/10.37.5.50,port=104,localport=53580]
38920 [DefaultQuartzScheduler_Worker-2] INFO org.dcm4che2.net.PDUEncoder - PACS(1): A-ASSOCIATE-RQ PACS << DCMROUTER
39040 [device-2] INFO org.dcm4che2.net.Association - PACS(1): A-ASSOCIATE-AC DCMROUTER >> PACS
2015-04-24 15:57:02 INFO  ProcessPdfReportFiles:500 - PACS is up and running
39041 [DefaultQuartzScheduler_Worker-2] INFO org.dcm4che2.net.PDUEncoder - PACS(1) << A-RELEASE-RQ
39045 [device-2] INFO org.dcm4che2.net.Association - PACS(1) >> A-RELEASE-RP
39045 [device-2] INFO org.dcm4che2.net.Association - PACS(1): close Socket[addr=/10.37.5.50,port=104,localport=53580]
.2015-04-24 15:57:02 INFO  ProcessPdfReportFiles:535 - Dicom Send initiated...
39058 [DefaultQuartzScheduler_Worker-2] INFO org.dcm4che2.net.Association - Association(2) initiated Socket[addr=/10.37.5.50,port=104,localport=53581]
39059 [DefaultQuartzScheduler_Worker-2] INFO org.dcm4che2.net.PDUEncoder - PACS(2): A-ASSOCIATE-RQ PACS << DCMROUTER
39191 [device-3] INFO org.dcm4che2.net.Association - PACS(2) >> org.dcm4che2.net.pdu.AAssociateRJ: A-ASSOCIATE-RJ[result=1, source=1, reason=2]: 
permanent application-context-name-not-supported
39192 [device-3] INFO org.dcm4che2.net.Association - PACS(2): close Socket[addr=/10.37.5.50,port=104,localport=53581]

So i guess that this particular PACS is denying my send request because of:

A-ASSOCIATE-RJ[result=1, source=1, reason=2]: permanent application-context-name-not-supported

So what does it mean? What am i missing here?

Thanasis Iliopoulos

unread,
Apr 24, 2015, 10:31:50 AM4/24/15
to dcm...@googlegroups.com
I have also tried to send the file by using the dcmsnd tool from command line:

dcmsnd PA...@10.37.5.50:104 5912.pdf.dcm 

and i am getting the same:

ERROR: Failed to establish association:A-ASSOCIATE-RJ[result=1, source=1, reason=2]: permanent application-context-name-not-supported

Do i have to set anything in order to succesfully send the file? An association parameter for example? 

Algie Rosario

unread,
Apr 26, 2015, 11:36:51 PM4/26/15
to dcm...@googlegroups.com
Hi Thanasis,

Can u post here the sample sample DICOM file pls.

And in your naming,

dcmsnd PA...@10.37.5.50:104 5912.pdf.dcm

it should be

dcmsnd PA...@10.37.5.50:104 5912.dcm



Algie,

jordan azoulay

unread,
Apr 28, 2015, 8:35:09 AM4/28/15
to dcm...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages