MRIdb: Image management, in a virtual machine

MRIdb is an interesting new application for storing and managing images, from Imperial College London. Building upon the stalwart dcm4chee image store, it combines the functionality of a PACS with study-level management and access control, administered through a web interface. Also bundled is the PostgreSQL database for storing images and open source applications for viewing and converting images. MRIdb itself is the Java-based management application, and is the primary means of interaction with the system. Through this interface you log in (authentication with LDAP is supported), view or download images, and manage related images by grouping them into projects.

One unique aspect of this project is its optional deployment as a preconfigured virtual machine. This is a single downloaded file which is run within the VirtualBox application, a free application from Oracle that runs on any platform.
Oracle_VM_VirtualBox_Manager The virtual machine contains an entire CentOS Linux operating system, and all the MRIdb components, all configured and already running. Once started, the virtual machine (which in this case has the IP address is accessible in a number of ways.

Firstly, the MRIdb application is accessed by browser through the default HTTP port of the VM. Here’s where you can create projects and associate them with individual scans, a convenient means of managing large numbers of studies, and a useful research-oriented feature not provided by traditional clinical PACS systems.
Features found in most PACS clients, such as search by various fields, are also available. Image viewing is provided in two ways, by launching an instance of the ImageJ viewer, or through the in-browser Weasis viewer.

Then, to communicate with MRIdb using DICOM standard protocols, the dcm4chee instance provides full PACS functionality. This is accessed using standard DICOM tools, such as a network-capable image viewer, another PACS, or any DICOM-compliant tools. For security, the default dcm4chee instance requires that remote AE titles be configured in order to send or receive studies. The server uses the standard port 11112 and AE Title ‘DCM4CHEE’, as shown in this example of sending an image to the store:

Alternatively, the dcm4chee instance has its own web interface, running on its standard port of 8080. Through this you can search the PACS directly, and configure your remote AE entities. It’s a pretty dense interface, but this is a commercial grade application.

Finally, you can SSH into the virtual machine itself. Always a kick to find another machine running within your computer. Log in to it, and you have a full Linux environment to explore the MRIdb components, which start running when the VM is initialized.

In this test, the virtual machine launched quickly and with no intervention required, consuming less than 1 GB of memory including the VirtualBox overhead. Routine tasks can be accomplished through the MRIdb browser interface, though steps specific to dcm4chee require a visit to its separate interface. Deploying from source code was less successful: as is common with complex Linux installations, there are many platform-dependent details that can trip up the installation and configuration scripts. Perhaps due to the deviation from CentOS as the test platform (Debian and Open SUSE were available), the packages did not install automatically. This is par for the course with complex multi-package installations and most people familiar enough with Linux to attempt the source-based path would be able to resolve the incompatibilities. The final stumbles were encountered when launching the in-browser viewers, and were caused not by the application, but by the delightful Java version/security/update maze we all love to navigate.
MRIdb is built on a good number of solid free and open-source projects. The imaging tasks are performed by some old friends: from come the dcm4chee image server, dcm4che2 toolkit and Weasis web viewer, there is the DCMTK DICOM toolkit from OFFIS, and Erik Nolf’s XMedCon for image format conversion. Other projectss provide the non image-related infrastructure: (VirtualBox virtualization, PostgreSQL database, JBoss application server, Play web framework).

MRIdb is a useful program for those managing imaging studies. As supplied, it runs with just a few clicks, and has full control for those wishing to get more involved in the technical details. The implementation as a fully-configured virtual machine makes this of particular interest for those who’ve never run their own image store. Give it a try: in five minutes you can be sending images to and from your very own PACS!

Orthanc: A different approach to a PACS

Orthanc is an interesting new program from Sébastien Jodogne, at the CHU de Liège, in Belgium.  Described as ‘An open-source, lightweight, RESTful DICOM server’, it’s a fully self-contained mini PACS that you can download and run immediately.  It’s provided in source code form, and as pre-compiled Windows and Linux (Debian and Fedora) binaries. The database for storing images (SQLite) is built in to the application and is easily configured.

There are several ways you can talk to Orthanc: as a DICOM server, as a web server, and through its API. Download it and fire it up, and you have a DICOM server capable of sending and receiving images using the standard DICOM protocol. Command line tools like those supplied by DCMTK are ideal for this, as are any of the PACS-capable graphical programs. Additionally, it has Orthanc Explorer, a built-in web server (or you can run it behind an Apache server) for administration and showing image previews. This gives a nice responsive web interface to the program, including drag-and-drop DICOM image upload. By default its HTTP server is on port 8042, while port 4242 is the DICOM server using the AE Title ‘ORTHANC’, all of which are configurable.

What really sets this program apart is its ‘RESTful API’, a means of connecting with the image server by using standard web protocols and tools.  This allows Orthanc to be accessed through Web connections from anywhere, and without regard to the platform or language used in the originating program. REST APIs are characterised in part by the use of URIs to locate and access resources, which in this case include patients, studies, and images.  Orthanc returns textual data in the form of JSON files, a widely-used lightweight file format, while images are returned in the web-standard PNG format.  These technologies are familiar to many developers, and are more approachable than tackling the full DICOM networking protocol.

Here’s an example (many more are given in the Orthanc Cookbook) of accessing studies through their URL.  I have a couple of studies for one patient stored in my Orthanc instance, and I want to locate images by running through the DICOM levels of Patient – Study – Series – Instance. Orthanc is listening on port 8042 and a full list of the patients in the database is obtained from appending ‘/patients’ to the URL:

Appending the patient identifier returns the details for this patient:

In a similar way, the studies and series details can be obtained. Each series returns a list of its instances (images), and the details of each of these can be retrieved as a JSON file:

At the instance level, the image itself can be retrieved as a PNG file by appending ‘/file’ to the instance’s URL. Instance details are available as a list of tag-value pairs (‘/tags’), or just as the value of an individual tag (‘/content/0008-0060′ returns the modality).

Functions such as anonymizing or altering the instance headers can also be accessed through standard REST calls. Here are a couple of the supplied examples (the URI has been shortened for clarity). In the second example, an entire series is edited, resulting in the creation of a new series within the Orthanc store. A JSON message is returned with the location of the new series containing the edited information.

Issuing commands at the command line is useful for design, debugging and experimental work, but the real power of this approach comes from driving the commands from a scripting language. Python examples are supplied for some sample applications such as uploading and downloading images, which can be done in a few lines of code. Here’s the basics of the Python sample script to download an copy of all anonymized studies, where the ‘RestToolbox’ methods are short functions that do what they say.

Short and readable, and all the DICOM stuff is done by the Orthanc server, allowing you to concentrate on the functionality. There are other example programs in C++ showing how to use the library by itself or with the VTK toolkit for image display.

Orthanc lives in two worlds.  On the one hand, it supports the traditional DICOM transport protocol, and can communicate with standard networked DICOM programs. But while the DICOM standard has been around for decades, Orthanc comes from the modern and rapidly-changing era of web services, and its developers have adopted a number of web technologies to medical image transport. Maybe if DICOM transport is like email, Orthanc’s REST API is like Twitter: it’s fast and light, and gets the essentials of the message across.  It can’t do everything its heavyweight predecessor can do, but it does it more simply.

Orthanc is an interesting and novel imaging application, and is well worth the time taken to download and explore its capabilities.

Neuro Debian: An Impression

I’ve seen a lot of imaging software packaged for the Debian Linux distribution, so I decided to set up a machine to try it out.  Debian is a popular choice for scientific software, known for its stability and the massive library of pre-built packages available for easy installation through its package management system.

Neuro Debian is a six year old project to make high quality software readily available to researchers everywhere (a full description is found in this recent publication by the principal authors).  It places strong emphasis on the correctness and interoperability of the software packages, resulting in applications that install automatically and produce reproducible results.  In practice, it’s employed as a supplementary repository for specialist software packages, that integrates completely into Debian’s existing package manager. There’s the promise of entire compatible software systems to be installed in a few clicks.  Let’s see how it fares.

Downloading Debian was straightforward.  There are a variety of installation techniques – live network installation, DVD and CD images to download and burn, torrents, and live test images to try the OS from a disc or stick.  I made up a Parallels partition on my Mac for the new virtual machine, giving it 2 GB RAM and 2 cores, and installed directly from the minimal 440 MB image I’d downloaded.  Been a while since I saw an installation that small, but I’m sure the packages will be much larger.  I enjoyed the old-timey non GUI installation screen, once upon a time we called this a ‘user interface’, now it’s coming back into fashion like an 8-bit video game.

It’s also been a while since I saw an OS start and stop as quickly as a stripped-down Debian installation.  We get so used to Mac OS and Windows loading…and loading…all sorts of essential something.  Debian gets to the point, and does it in a few seconds.

I started the Software Centre to see what imaging software is available right out of the box. Cool!  Searching for ‘DICOM’ shows several alternatives.

I installed both and had to hunt through the menus to find them filed under ‘Graphics’, which is fair enough, I suppose.  Some of the other programs I later installed made it on to the ‘Science’ menu.

Configuring Debian to use the Neuro Debian repository is a simple case of copying two commands into a terminal window, adding ‘NeuroDebian’ as a source in the package manager.  The installations proceeded very quickly, and although not every package is available for each OS variant on every software repository, there’s a very wide range of software available.
For the OS I’m running (Debian 6), there were over 110 applications and libraries available in the ‘Imaging’ category alone.

The other category I was particularly interested in was Imaging Development, and as you may expect it’s pretty technical.  Lots here for the software developer.  Exploring the other categories is left as an exercise for the reader (it’s not called “I Do Psychophysics”).

Installed software has a short summary in the package manager.  Running the programs again reminded me of just how quick computers can be when you strip away the extraneous extras.  The applications jumped onto the screen and were ready within a second.  This particularly reinforced the advantage of having a dedicated system – even one running as a virtual machine, as here – over running imaging software on your regular desktop computer.  Fewer distractions, too.

Overall, I was highly impressed.  A new user could download and install an entire operating system, plus imaging applications, and be up and working within half an hour.  Some experience with Linux software is of course useful, and some of these applications would also benefit from some command line experience.  But since the software is downloaded and installed as binary executables, with all dependencies handled, there’s no chance of it not compiling correctly.  Neuro Debian bills itself as the “Ultimate platform for neuroscience” and I think they have a case.  Great packages that install themselves and work out of the box: this is free software done right.