DeCaMino
ABOUT DOCUMENTATION DOWNLOAD LICENSING SUPPORT
DOCUMENTATION
As a plugin As a library
Get/Set attributes Storage SCP Direct write Storage SCU Storage commitment Query/Retrieve SCU Query/Retrieve SCP Worklist management File-sets (DICOMDIR) Direct encapsulation
DICOM conformance Image I/O conformance Changelog

Implementing a Storage SCP

A Storage SCP receives DICOM objects from peer applications across the network. You can listen to incoming objects either synchronously or asynchronously.

For synchronous listening, the code can be as simple as:

DicomReader reader = new DicomReader();

StorageSCP scp = new StorageSCP();

reader.setInput(scp);
BufferedImage image = reader.read(0);

new StorageSCP() creates a new Storage SCP listening to the default DICOM port (104, administration right may be necessary) without encryption. It is used as the input of the reader instead of a usual input stream. Calling read (or any method getting information about the object read, like getDicomMetadata()), is blocking until an object is received.

Asynchronous listening is similar but doesn't block the calling thread. It requires the definition of a callback function that will be called each time an object is received:

final DicomReader reader = new DicomReader();

class Listener implements StorageSCPListener {
  public void objectReceived(ReceivedObject o) {
    reader.setInput(o);
    BufferedImage image = reader.read(0);
    /* ... */
  }
}

new StorageSCP(new Listener()).start();

This time the input of the reader is set to the ReceivedObject instance passed to the callback when an object is received.

Using a lambda expression, the code is still more concise:

final DicomReader reader = new DicomReader();

new StorageSCP(o -> { 
  reader.setInput(o);
  BufferedImage image = reader.read(0);
  /* ... */
 }).start();

DICOM is the registered trademark of the National Electrical Manufacturers Association for its standards publications relating to digital communications of medical information.

Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

apteryx is a registered trademark of apteryx, sarl.

DeCaMinoTM is a trademark of apteryx, sarl.

© apteryx 2024