Options
All
  • Public
  • Public/Protected
  • All
Menu

Dicoogle JavaScript Client

npm version

dicoogle-client is a client API to the web services provided by Dicoogle, the open-source PACS archive, for use in JavaScript applications.

Top-level API

Documentation was built from our TypeScript definitions, and should be automatically considered by the TypeScript compiler (version 2+).

  • dicoogleClient is a function for retrieving a Dicoogle access object.
  • DicoogleAccess is a singleton comprising all methods for interacting with the Dicoogle instance. Enter the DicoogleAccess documentation page for a list of all methods and namespaces within.

Installing

In Node.js or CommonJS

In Node.js, or when using a CommonJS compatible bundler (such as Browserify or webpack), install "dicoogle-client" with npm and require the "dicoogle-client" module.

const dicoogleClient = require('dicoogle-client');

When using TypeScript:

import dicoogleClient = require('dicoogle-client');

On the browser, no module system

When not using Node.js or any module system, include the "dist/dicoogle-client.min.js" file as a script, thus exposing DicoogleClient as a global.

<script src='path/to/my/libs/dicoogle-client.min.js'></script>

In ES2015

This is a CommonJS module, and not compatible with ES2015 modules. When using ES2015 modules or TypeScript with ES2015, you should import the default function using require, or include an interoperable require mechanism, such as using Babel.

Basic Usage

Once dicoogleClient is fetched, invoke it as a function with the Dicoogle server's endpoint to obtain an access object. The object is a singleton that can be used multiple times. Calling the module function again will change the Dicoogle base URL of that object, or retain the address if no argument is passed.

const dicoogle = dicoogleClient("localhost:8080");

// if required, login to the system before using
dicoogle.login('admin', 'mysecretpassword', function(error, outcome) {
  if (error) {
    console.error(error);
    return;
  }

  // Ok! Start using Dicoogle!
  dicoogle.search("PatientName:Pinho^Eduardo", {provider: 'lucene'}, (error, outcome) => {
    if (error) {
      console.error(error);
      return;
    }
    // use outcome
    const {elapsedTime, results} = outcome;
    // ...
  });
});

A Promise-based API is available since version 5.0.0. Therefore, you can write the following code inside an async function:

const dicoogle = dicoogleClient("localhost:8080");

// if required, login to the system before using
await dicoogle.login('admin', 'mysecretpassword');

// Ok! Start using Dicoogle!
let {elapsedTime, results} = await dicoogle.search("PatientName:Pinho^Eduardo", {provider: 'lucene'});

// use outcome ...

Examples

The repository includes two examples of dicoogle-client for simple querying:

  • "bin/dicoogle-query-cli.js" is a complete stand-alone Node.js application for querying Dicoogle. This is the source code of the dicoogle-query executable.
  • "example/app.html" is a web page demonstrating simple querying.

Generated using TypeDoc