// Initialize and start the SCP private static void startSCP(ObjectProcessor op) { if (scp != null) { // There is already a storage SCP; stop it. // This throws an exception, but ignore it. try { scp.stop(); } catch (Exception ignore) { } scp = null; } // Now get a new SCP with the new params. scp = getDicomStore(); // Start listening. scp.addDicomEventListener(op); // And start the scp. try { scp.start(); Log.message( dicomImportServiceName + ": " + TrialConfig.getDicomStoreAETitle() + " Storage SCP started on port " + TrialConfig.getDicomStorePort()); } catch (Exception e) { Log.message(dicomImportServiceName + ": SCP failed to start<br>" + e.getMessage()); } }
// Get and initialize the DICOM Storage SCP private static DicomStorageScp getDicomStore() { String aetitle, port; Properties p = new Properties(); aetitle = TrialConfig.getDicomStoreAETitle(); port = TrialConfig.getDicomStorePort(); p.setProperty("storage-scp-aet", aetitle); p.setProperty("port", port); p.setProperty("dest", TrialConfig.basepath + TrialConfig.dicomStoreDir); Dicom.initialize(p); return Dicom.getStorageScp(); }