Tag Archives: Own

How to install and setup a PACS (dcm4chee)

Introduction

Picture Archiving and Communication System (PACS) is a medical imaging technology which provides economical storage of and convenient access to images from multiple modalities (source machine types).

In our case we can use it to create pre-production environments to test PACS communications. For example, we can setup a PACS to send endoscopy images and retrieve radiology samples to an application.

We are going to use the dcm4chee open source solution from dcm4che.org. This is a JEE and JMX system which is deployed within the JBoss Application Server to provide a number of clinical services. It may be used for a variety of different purposes, the most popular being:

  1. a DICOM archive and image manager
  2. a PACS, when coupled with a viewer such as OsiriXK-PACSClearCanvasGinkgo CADx, etc.

As a host, trying to use always open source solutions, we are going to use a GNU/Linux operating system, specifically Kubuntu 14.04 LTS (Long Term Supported).

 As a database we are going to use PostgresSQL (9.3).

We can find installation instructions at dcm4chee page, but there are not always updated, so I will show all the steps for the current versions.

Installation of JDK

Although we can use the openjdk that comes with kubuntu, we are going to use the one from Oracle.

First we have to download the package from Oracle site:

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

And choose the one that fits our platform (x86 tar.gz in my case)

2014-11-27 17_19_48-Java SE Development Kit 8 - Downloads

Once decrompressed, just copy the folder to /usr/lib and add the following lines at the end of the ~/.bashrc file:

JAVA_HOME=/usr/lib/jvm/jdk1.8.0_25
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME
export PATH

We can check the version using the command “java -version”

$ java -version
java version “1.8.0_25”
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) Server VM (build 25.25-b02, mixed mode)

Installation procedure

1. Download and extract the binary distribution package of dcm4chee:

We have to download the latest version of dcm4chee that is relevant to the database we want from sourceforgeIn our case, the postgres one.

2014-11-27 17_39_40-dcm4che, a DICOM Implementation in JAVA - Browse _dcm4chee_2.18

2. Download the binary distribution package of JBoss Application Server 4.2.3.GA

Download the binary distribution of JBoss 4.2.3.GA from here and extract it into a different directory.

Use neither JBoss 5 nor JBoss 6, because it is completely re-architected and is significantly different than the 4.2 line of JBoss! 

If you want to use JDK 5, don’t download JBoss for JDK 6 (jboss-4.2.3.GA-jdk6.zip) – use jboss-4.2.3.GA.zip!

3. Copy files from JBoss to dcm4chee

Go to the dcm4chee-2.18.1-xxx/bin directory and execute the install_jboss.sh script, with the path of your JBoss as installation directory as a parameter.

For example, if we have JBoss downloaded in the same directory as dcm4chee:

dcm4chee-2.18.0-psql/bin$ sh install_jboss.sh ../../jboss-4.2.3.GA/

4. Install the Database Software and create the DCM4CHEE Database

Set permissions on Postgres database. The following setting will trust only connections from the localhost, which is reasonable for a development machine, but may need to be changed for production.

Edit the pg_hba.conf file in order to set the right permissions.

$ sudo vim /etc/postgresql/9.3/main/pg_hba.conf

Set a password for the postgres user

$export PGUSER=postgres
$createdb pacsdb
$psql pacsdb -f dcm4chee-psql-2.18.0/sql/create.psql

This will create all the database structure. Now we have to setup the database access from dcm4chee. In your dcm4chee installation, use a text editor to edit server/default/deploy/pacs-postgres-ds.xml and set the database password. This file controls the dcm4chee connections to the main archive application database.PostgressPWD

5. Deploy the Audit Record Repository (ARR)

The Audit Record Repository will help us track any movement in dcm4chee.

Starting with dcm4chee-2.12.0, the binary distribution package of the archive application does NOT include the dcm4chee Audit Record Repository (ARR) anymore. The ARR maintains an audit log of all transactions within the archive. This is necessary for HIPAA and IHE. Some dcm4chee deployment scenarios call for the deployment of the ARR in a standalone fashion because it acts as an ARR for more than one dcm4chee instance, or multiple applications which can take advantage of an external ARR. Commonly though it is deployed within the dcm4chee archive itself.

Download the latest version from soruceforge related with the database we have chosen (postgres in our case)

2014-11-27 19_28_29-dcm4che, a DICOM Implementation in JAVA - Browse _dcm4chee-arr_3.0

Go to the dcm4chee-*-xxx/bin directory and execute the install_arr.sh script with the path of the dcm4chee-arr-* installation directory as parameter.

NOTE: Due to a bug, we have to modify two lines of the installer dcm4chee-2.18.psql/bin/install_arr.sh

VERS=3.0.11 should be VERS=3.0.12

Bug1

cp -v “$ARR_SERV” /lib/dcm4che-core-2.0.25.jar \ should be cp -v “$ARR_SERV” /lib/dcm4che-core-2.0.27.jar \

Bug2

Now we can run the installer without problem.

dcm4chee-2.18.0-psql/bin$ sh install_arr.sh ../../dcm4chee-arr-3.0.12-psql/

We have to create the arr database in Postgres and create the structure using the script from the dcm4chee-arr sql folder:

dcm4chee-arr-3.0.12-psql/sql$ psql arrdb -f dcm4chee-arr-psql.ddl

Now we have to set the ARR database acces. In your dcm4chee installation, use a text editor to edit server/default/deploy/arr-psql-ds.xml and set the database password. This file control the dcm4chee connections to the Audit Record Repository (ARR) database.

ARR-PostgresPwd

6. Set environment variable JAVA_HOME to JDK location

The dcm4chee startup/shutdown scripts depend on the JAVA_HOME environment variable in order to find the Java executables and libraries. For example, if your JDK is installed at “/usr/lib/jvm/jdk1.8.0_25” then that is the path to JAVA_HOME.

If you choose to add in the ~/.bashrc file, remember the PACS would not start unless you start the session.

7. Optional: Adjust maximum allocation of heap memory

Java programs run with a finite amount of memory allocated to them. If you anticipate high volumes of storage and retrievals, or very large datasets, you may want to increase the max (-Xmx) heap size of the Java process.

Linux/Unix/OSX: dcm4chee-2.xx-xxx/bin/run.conf

# Specify options to pass to the Java VM.
if [ "x$JAVA_OPTS" = "x" ]; then
JAVA_OPTS="-Xms128m -Xmx512m -XX:MaxPermSize=128m ..
fi

according to available RAM and memory requirements of other processes on this node.

E.g.: if only 512 MB RAM are available, you should decrease the default value -Xmx512m to (e.g.) -Xmx300.

8. Test the installation

To test your installation, go to the dcm4chee-2.xx-xxx/bin directory and execute the run.sh script. Your output should look like the following and contains no error or exception messages:

=========================================================================
 
 JBoss Bootstrap Environment
 
 JBOSS_HOME: /home/daniel/Downloads/dcm4chee-2.18.0-psql
 
 JAVA: /usr/lib/jvm/jdk1.8.0_25/bin/java
 
 JAVA_OPTS: -Dprogram.name=run.sh -server -Xms128m -Xmx512m -XX:MaxPermSize=128m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.messaging.ServerPeerID=0 -Djavax.xml.transform.TransformerFactory=com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl -Djava.awt.headless=true -Dapp.name=dcm4chee -Djava.net.preferIPv4Stack=true -Djava.library.path=/home/daniel/Downloads/dcm4chee-2.18.0-psql/bin/native
 
 CLASSPATH: /home/daniel/Downloads/dcm4chee-2.18.0-psql/bin/run.jar:/usr/lib/jvm/jdk1.8.0_25/lib/tools.jar
 
=========================================================================
 
Java HotSpot(TM) Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
19:43:15,087 INFO [Server] Starting JBoss (MX MicroKernel)...
19:43:15,088 INFO [Server] Release ID: JBoss [Trinity] 4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)
19:43:15,089 INFO [Server] Home Dir: /home/daniel/Downloads/dcm4chee-2.18.0-psql
19:43:15,089 INFO [Server] Home URL: file:/home/daniel/Downloads/dcm4chee-2.18.0-psql/
19:43:15,090 INFO [Server] Patch URL: null
19:43:15,090 INFO [Server] Server Name: default
19:43:15,090 INFO [Server] Server Home Dir: /home/daniel/Downloads/dcm4chee-2.18.0-psql/server/default
19:43:15,090 INFO [Server] Server Home URL: file:/home/daniel/Downloads/dcm4chee-2.18.0-psql/server/default/
19:43:15,090 INFO [Server] Server Log Dir: /home/daniel/Downloads/dcm4chee-2.18.0-psql/server/default/log
19:43:15,090 INFO [Server] Server Temp Dir: /home/daniel/Downloads/dcm4chee-2.18.0-psql/server/default/tmp
19:43:15,091 INFO [Server] Root Deployment Filename: jboss-service.xml
19:43:15,359 INFO [ServerInfo] Java version: 1.8.0_25,Oracle Corporation
19:43:15,359 INFO [ServerInfo] Java VM: Java HotSpot(TM) Server VM 25.25-b02,Oracle Corporation
19:43:15,359 INFO [ServerInfo] OS-System: Linux 3.13.0-40-generic,i386
19:43:15,654 INFO [Server] Core system initialized
19:43:17,680 INFO [WebService] Using RMI server codebase: http://daniel-VirtualBox:8083/
19:43:17,682 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resource:jboss-log4j.xml
19:43:18,095 INFO [TransactionManagerService] JBossTS Transaction Service (JTA version) - JBoss Inc.
....
19:43:49,281 INFO [RequestListenerInterface] registered listener interface [RequestListenerInterface name=IActivePageBehaviorListener, method=public abstract void org.apache.wicket.behavior.IBehaviorListener.onRequest()]
19:43:49,281 INFO [Application] [WicketApplication] init: Wicket extensions initializer
19:43:49,281 INFO [WebApplication] [WicketApplication] Started Wicket version 1.4.22 in deployment mode
19:43:49,347 INFO [EARDeployer] Started J2EE application: file:/home/daniel/Downloads/dcm4chee-2.18.0-psql/server/default/deploy/dcm4chee-web-ear-3.0.4-psql.ear
19:43:49,378 INFO [ServerImpl] Start Server listening on 0.0.0.0:2575
19:43:49,414 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-8080
19:43:49,440 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-8443
19:43:49,460 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-0.0.0.0-8009
19:43:49,472 INFO [ServerImpl] Start Server listening on 0.0.0.0:11112
19:43:49,473 INFO [Server] JBoss (MX MicroKernel) [4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)] Started in 34s:379ms

9. Login into web interface

Connect to the Web Interface at http://localhost:8080/dcm4chee-web3/ of the archive using any Web Browser. You should get the User Login Screen. Login in using default Administrator account ‘admin’, with password ‘admin’.

2014-11-28 08_09_43-dcm4chee Login

2014-11-28 08_10_49-dcm4chee after login

10. Login to JMX Console

Connect to JBoss’s JMX Console at http://localhost:8080/jmx-console/ and login using also the Administrator account ‘admin’, with password ‘admin’.
Follow the link “group=ONLINE_STORAGE,service=FileSystemMgt” to the configuration page for File System Management service under the “dcm4chee.archive” heading.
Invoke the operation addRWFileSystem(), with argument dirPath specifying the directory, where the archive shall store received objects/images.

If no Storage File System is configured, the archive will auto-configure dcm4chee-2.xx.1-xxx/server/default/archive as Storage File System, when receiving the first object/image.

2014-11-28 08_11_35-dcm4chee logs

11. Optional: Change the default AE Title

Connect to JBoss’s JMX Console at http://localhost:8080/jmx-console/ and login using also the Administrator account ‘admin’, with password ‘admin’.

2014-11-28 08_12_25-dcm4chee Catalina

Follow the link “service=AE” to the configuration page for AE (Application Entity – a DICOM term for a DICOM node on the network) service under the “dcm4chee.archive” heading.
Invoke the operation update AETitle with the old AE Title (DCM4CHEE if unchanged from the default), and new AE Title as parameters.
This will update the following configurations:

  • update  the “retrieve AET” of file systems, associated to the current retrieve AET of this node
  • update “retrieve AETs” of all instances, series and studies that have files on these filesystems
  • update the entry for the “retrieve AE” in the AE Configuration
  • update the AE Title of all services listed by attribute OtherServiceAETitleAttributesToUpdate

12. Install as a service

If running as a service or daemon on any operating system, you should disable CONSOLE logging as noted here:http://forums.dcm4che.org/jiveforums/thread.jspa?messageID=4787ኳ

After verifying that the archive works, you may want to run it as a service so that it stays running even when you log out. If still running in the console window, you may stop the archive by Ctrl+C, and copy the init script dcm4chee_init_redhat.sh to /etc/init.d/ and adjust it according your installation location of the archive and the JDK and under which user the archive application shall run.

HL7 tools

What is HL7

Health Level-7 (also knows as HL7) refers to a set of international standards for transfer of clinical and administrative data between Hospital information systems. These standards focus on the application layer, which is “layer 7” in the OSI model. The HL7 standards are produced by the Health Level Seven International, an international standards organization, and are adopted by other standards issuing bodies such as American National Standards Institute and International Organization for Standardization.

We use this standard in Olympus to provide communications between our systems and the Hospital information systems, PACS and other providers.

Tools

In order to deal with all the interfaces, configurations and integration projects, I will propose some utilities to make easier our engineering job. All the tools explained are free and there is no installation needed. That is perfect for computers where we do not have administrative privileges or where we do not want to install anything else to maintain clean the installation.

SmartHL7 Viewer

This tool let us inspect any HL7 v2 message. It does not have all the HL7 Standard database, but for the great majority of all the messages we deal, it is perfect. We can load a message or paste it directly.

2014-10-07 16_21_51-

Features:

  1. It has a small single executable, no install required.
  2. It handles very large file easily.
  3. It has build-in simple HL7 references.
  4. It has a straight-forward layout, colored element highlighting.
  5. It can easily navigate through messages.
  6. It has versatile import methods, including file drag-n-drop and paste from memory (Clipboard).
  7. It is free.

Website link: http://smarthl7.com/tools.html

SmartHL7 sender

With SmartHL7 sender we will have an HL7 network client. We can use it for testing for to upload HL7 data to another system with a HL7 inbound interface.

2014-10-07 16_59_54-

Features

  1. It has a small single executable, no install required.
  2. It handles very large file easily, and it is very fast.
  3. It implements MLLP which is compliant with the HL7 Standard.
  4. It displays every message’s send-status, including the received ACK (acknowledgement) and response time.
  5. It provides stats and has the option of logging sent and received messages to file.
  6. It is designed to provide the most convenience.
  7. It is free.
  8. *Note* the sending destination’s port is limited to range 1024-65535. This is to discourge those “well-known ports” (range 0-1023) being used for HL7 communication.

Website link: http://smarthl7.com/tools.html

HL7 Language for Notepad++

Notepad++ it is a free and open source (under GPL license) powerful editor. Notepad++ can handle efficiently large files quickly and can colorize the text in order to improve reading.

From the Notepad++ website: Based on the powerful editing component Scintilla, Notepad++ is written in C++ and uses pure Win32 API and STL which ensures a higher execution speed and smaller program size. By optimizing as many routines as possible without losing user friendliness, Notepad++ is trying to reduce the world carbon dioxide emissions. When using less CPU power, the PC can throttle down and reduce power consumption, resulting in a greener environment.

This application is allowed to be used on Olympus computers, so if you  feel you need this application, ask the IT guys to install on your computer.

Notepad++ can handle a large types of languages but HL7 is not between them. We can create our language, so we can add a new entry and define it. To avoid to create it from scratch, you can save as XML the following code and import.

<NotepadPlus>
 <UserLang name="HL7" ext="hl7" udlVersion="2.1">
 <Settings>
 <Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
 <Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
 </Settings>
 <KeywordLists>
 <Keywords name="Comments"></Keywords>
 <Keywords name="Numbers, prefix1"></Keywords>
 <Keywords name="Numbers, prefix2"></Keywords>
 <Keywords name="Numbers, extras1"></Keywords>
 <Keywords name="Numbers, extras2"></Keywords>
 <Keywords name="Numbers, suffix1"></Keywords>
 <Keywords name="Numbers, suffix2"></Keywords>
 <Keywords name="Numbers, range"></Keywords>
 <Keywords name="Operators1">(x0D) | ^ &amp; ~ \</Keywords>
 <Keywords name="Operators2"></Keywords>
 <Keywords name="Folders in code1, open"></Keywords>
 <Keywords name="Folders in code1, middle"></Keywords>
 <Keywords name="Folders in code1, close"></Keywords>
 <Keywords name="Folders in code2, open"></Keywords>
 <Keywords name="Folders in code2, middle"></Keywords>
 <Keywords name="Folders in code2, close"></Keywords>
 <Keywords name="Folders in comment, open"></Keywords>
 <Keywords name="Folders in comment, middle"></Keywords>
 <Keywords name="Folders in comment, close"></Keywords>
 <Keywords name="Keywords1">ACC ADD AIG AIL AIP AIS AL1 BHS BLG BTS DG1 DSC DSP ERR EVN FHS FT1 FTS GT1 IN1 IN2 IN3 MFA MFE MFI MRG MSA MSH NCK NK1 NPU NSC NST NTE OBR OBX ODS ODT OM1 OM2 OM3 OM4 OM5 OM6 ORC PD1 PID PR1 PRA PV1 PV2 QRD QRF RGS RQ1 RQD RXA RXC RXD RXE RXG RXO RXR SCH STF TQ1 UB1 UB2 URD URS ZAL ZBN ZEI ZLR ZNI ZPI ZQA ZV1</Keywords>
 <Keywords name="Keywords2">ACK ADR ADT ARD BAR DFT DSR MCF MFD MFK MFN MFR NMD NMQ NMR ORF ORM ORR ORU OSQ PGR QRY RAR RAS RDE RDR RDS RER RGV ROR RRA RRD RRE RRG UDM OML SIU</Keywords>
 <Keywords name="Keywords3">A01 A02 A03 A04 A05 A06 A07 A08 A09 A10 A11 A12 A13 A14 A15 A16 A17 A18 A19 A20 A21 A22 A23 A24 A25 A26 A27 A28 A29 A30 A31 A32 A33 A34 A35 A36 A37 M01 M02 M03 O01 O02 P01 P02 P03 P04 Q01 Q02 Q03 Q05 R01 R02 R03 R04 SIU</Keywords>
 <Keywords name="Keywords4"></Keywords>
 <Keywords name="Keywords5"></Keywords>
 <Keywords name="Keywords6"></Keywords>
 <Keywords name="Keywords7"></Keywords>
 <Keywords name="Keywords8"></Keywords>
 <Keywords name="Delimiters">00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords>
 </KeywordLists>
 <Styles>
 <WordsStyle name="DEFAULT" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
 <WordsStyle name="COMMENTS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
 <WordsStyle name="LINE COMMENTS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
 <WordsStyle name="NUMBERS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
 <WordsStyle name="KEYWORDS1" fgColor="0080FF" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
 <WordsStyle name="KEYWORDS2" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
 <WordsStyle name="KEYWORDS3" fgColor="00FF00" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
 <WordsStyle name="KEYWORDS4" fgColor="8000FF" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
 <WordsStyle name="KEYWORDS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
 <WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
 <WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
 <WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
 <WordsStyle name="OPERATORS" fgColor="FF00FF" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
 <WordsStyle name="FOLDER IN CODE1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
 <WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
 <WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
 <WordsStyle name="DELIMITERS1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
 <WordsStyle name="DELIMITERS2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
 <WordsStyle name="DELIMITERS3" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
 <WordsStyle name="DELIMITERS4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
 <WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
 <WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
 <WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
 <WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
 </Styles>
 </UserLang>
</NotepadPlus>