Load Balanced DICOM Classic CStore Service deployed on Docker

This post covers the demonstration setup of DICOM CStore service with load balancer that supports scaling of DICOM request across multiple instance.

DICOM Classic CStore service is a DICOM image transfer service that allows DICOM Application Entities (Client’s) to send DICOM objects to a DICOM storage server (Server). The CStore service is based on the DICOM Imaging Network Communication Standard (DICOM Standard) and is defined in Part 7 of the DICOM Standard. DICOM is an application protocol built on top of TCP/IP stack/

The CStore service is a widely used in hospital Radiology where it is typically used to store DICOM images from medical imaging devices, such as MRI scanners and CT scanners.

The CStore service is a request/response service, which means that the sending AE ( client) sends a request to the receiving AE(server) to store a DICOM object. The receiving AE then sends a response to the sending AE indicating whether the DICOM object was successfully stored.

Following example demonstrate the setup where multiple instances of CStore service deployed in Docker load balanced using Nginx Proxy .

Complete source code & deployment script on my GitHub repo

Reference

DICOM Standard

Java DICOM Library Reference

How to current get executing method name & caller of the method in Java

Recently I was investigating issue in our internal software , where I needed to get the current executing method name ( similar to c++ __FUNCTION___ )  and caller name.

It is possible get this information using getting access to stack trace in java. see the example below.

public class DebugInfo {
  /**
   *
   * This function returns the method name of the calling functions parent
   * function
   *
   * @return
   */
  public static String getCallingMethodName() {

    StackTraceElement stack[] = Thread.currentThread().getStackTrace();

    StackTraceElement element = stack[3];

    return element.toString();
  }
  /**
   *
   * This function returns the method name of the calling function
   *
   * @return
   */
  public static String myMethodName() {

    StackTraceElement stack[] = Thread.currentThread().getStackTrace();

    StackTraceElement element = stack[2];

    return element.toString();
  }
}

Java2html
Usage:
public class Foo
{
public void bar()
{
   // print the current method name
   System.out.println( DebugInfo.myMethodName());
   // print the current calling method name
   System.out.println( DebugInfo.getCallingMethodName());
}
public static void main(String [] args )
{
    Foo f = new Foo();
            f.bar();
}
}