Introduction
High level PACS Interface
The PACS Framework is an extensible programming framework for creating DICOM messaging applications (server / client). The add-in architecture allows the developer to easily add additional support without having to change the core server implementation. In addition to DICOM message handling, the developer can add support for a service log, AE title management, message notification, etc.
The following tutorials are available:
In addition, the LEADTOOLS Medical Modality Worklist WCF service contains methods for manipulating entities in a modality worklist database. Use the provided PACS Framework Server Add-in (Leadtools.AddIn.Broker.Host) to host a LEADTOOLS Modality Worklist WCF service.
The following sections describe how to use the PACS Framework:
-
Components
-
Startup Process
-
Installing and Managing Servers
-
Server Administrative Interface
1. Components
The PACS Framework consists of the following components:
- Service Manager - The service manager is a sample application that uses the LEADTOOLS Dicom Service Admin SDK for DICOM service administration.
- Add-in - Manager - The DICOM Service acts as the manager of the addins. When the service starts it loads all the available addins. Once the add-ins are loaded the server extracts the interfaces that are important for its operation.
- Secure Communications - The PACS Framework provides an interface for developers to provide secure communications. If a server is marked as secure an implementation of this interface must be provided to provide the security parameters.
2. Startup Process
- Service start: This runs the Windows Service that is implementing the DICOM Server.
- License Check: Checks to see whether the user has provided the correct MedicalServer unlock code. If the correct code has not been provided the service will not run.
- Initialize addins: The service loads all DLLs in the Server working directory. The server checks for all the add-in interfaces. If a valid interface is found, the add-in is registered with the server service.
- Start Server: If for some reason the server cannot start (duplicate port, IP unavailable, etc.), the service will not run.
-
Register Base Services: Some services are required for the service to function correctly. This process provides default implementations for the following services:
- IDicomRequest: Provides a default implementation for add-ins to issue a DICOM request. This implementation should rarely be overridden
- IAETitle: Provides a default implementation for managing DICOM AETitles.
-
Start Administrative Interface: This interface allows an application to communicate with the running service. The interface is implemented via named pipes.
At this point the server is up and ready to begin receiving DICOM connections. The server takes the presentation context information from the registered add-ins and validates it with the Associate request sent from a client. When a valid DICOM message is sent to the server, it checks to see if the specific presentation context pair is registered by an addin. If the context pair is registered, the add-in is called to process the DICOM Message. Server processing for that client does not continue until the add-in has finished processing or the timeout has been reached for add-in processing.
3. Installing and Managing Servers The PACS Framework includes a sample Service Management application that allows you to install and manage DICOM Server Services. The Service Management applications uses the DICOM Service Admin SDK to manage the PACS Framework services. The following figure shows the LEADTOOLS DICOM Service Manager:
The icons listed under the Add-in Options display all the available options for installed addins. Double click on the icon option to display a settings dialog.
Click the Add DICOM Server Service button () to open the Add New Server dialog. The Add New Server dialog Settings tab is shown in the following figure:
The Add New Server dialog has the following fields:
Settings Tab
- AE Title - Server AE Title
- Implementation Class UID - Server implementation class
- Description - Server description
- Implementation Version Name - Server implementation version name
- IP Address - Server IP Address
- Temporary Directory - Location of the temporary files. DICOM uses temporary files during the course of creating a dataset. If this parameter is not specified DICOM temporary files are kept in the Windows temporary file location.
- Port - Server port to listen on.
- Max Clients - Maximum number of clients that are allowed to connect to server.
- Server Secure - Check to make this a secure server.
- Allow Anonymous - Check to allow anonymous user access. If you will be performing C-MOVE-RQ to clients there, the AE information will have to be specified.
- Enable Service Log - Enable service logging (a default implementation is provided that logs to the Windows event log).
- Multiple ConnectionsAllows same AE title to connect multiple times from the same IP address.
The Add New Server dialog Advanced tab is shown in the following figure:
The Add New Server dialog Advanced tab has the following fields:
Advanced Tab
- Service Display Name - Name to display in the Windows Service Manager application. If no name is specified the display name defaults to: Dicom Server [Ae Title].
- Max Pdu Length - Maximum length of data transfer. If no value is specified the max length defaults to 16384 bytes.
-
Timeouts
- Client - Amount of time before a disconnect if data is not received from a client.
- Reconnect - Amount of time for the server to reconnect to a client and perform some operation.
- AddIn - Amount of time for an add-in to process a DICOM request.
-
Socket Options
- No Delay - Disables the Nagle algorithm for combining packets. This socket option is included for backward compatibility with Windows Sockets 1.1.
- Receive Buffer - Specifies the total per-socket buffer space reserved for receives. If no buffer size is specified it defaults to 29696 bytes.
- Send Buffer - Specifies the total per-socket buffer space reserved for sends. If no buffer size is specified it defaults to 29696 bytes.Start Mode - Sets the start mode of the windows server.
-
Start Mode
- Automatic - Service to be started automatically by the Service Control Manager during system startup.
- Manual - Service to be manually started.
- Disabled - Service can no longer be started.
- Copy dataset image during message notification- Disabling this option will only copy image related tags of the dataset during a message notification. Enabling this option could adversely impact the performance of the server.
After a service is created a new directory will be created in the application folder based on the AE Title. For instance, if your application directory is c:\Dicom Servers\ and you created a service with the AE Title "STORE"; the new directory will be c:\Dicom Servers\STORE\. This directory contains all of the settings for the new server. The following directories are:
- Settings.xml - Holds all the settings for the service.
- AddIns Directory - All add-ins created for the server need to be placed in this directory. In order to have the add-in available for each server it will have to be placed in each server's addin directory.
- Edit DICOM Server Service.
- Delete DICOM Server Service. This action will delete the service from Windows. However, the service directory will remain.
- Start the currently selected service.
- Pause the currently selected service. Pause services will not be able to accept incoming connections. However, existing connections will continue to function normally.
- Stop the currently selected service.
- Start all available DICOM Server services.
- Stop all available DICOM Server services.
AE Titles Tab This tab allows you to add/edit AE title information. The server register IAeTitle implementation will be responsible for handling the Service Manager requests. The following actions are available with the AE Titles Tab.
Client Tab Use this tab to view connect client information. The following information is available for each connected client:
- IP Address - IP address of the connected client.
- AE Title - AE Title of the connected client.
- Connected Time - The time the client connected.
- Last Action - The last action performed by the client.
The following actions are available for the client:
- View client association.
- Disconnect client.
4. Server Administrative Interface Each server implements an administrative interface that allows an application to perform actions against it. Use the interface to add AE titles and retrieve client information.
The administrative interface is implemented using named pipes.
A named pipe is a named, one-way or duplex pipe for communication between the pipe server and one or more pipe clients. All instances of a named pipe share the same pipe name, but each instance has its own buffers and handles, and provides a separate conduit for client/server communication. The use of instances enables multiple pipe clients to use the same named pipe simultaneously.
The name of the created pipe is the AE Title of the server created in the DICOM Server Service. The created server service uses duplex pipes for messages and notifications. The PACS Framework provides a ServiceMessage class that encapsulates the details needed for sending messages to and receiving messages from the DICOM server service. The following message/notifications are support by the server services:
ServiceMessage Class
-
Properties
- Message - The message this applies to. See below for a description of messages.
- Service - The name of the service this message is for.
- Success - True to signify the message was a success, false otherwise. This is generally set by the service in response to the message.
- Error - Error message that occurred during the processing of the message.
- Data - The additional data to send with the messages. All items assigned to the Data property needs to be serializable.
Messages
-
GetAeTitles - Get a list of all AE titles on the server.
- Message Info Message = MessageNames.GetAeTitles
- Response Info Message = MessageNames.GetAeTitles Data[0] = List<__41_e49_nfo>
-
AddAeTitle - Add an AE title to the server.
- Message Info Message = MessageNames.AddAeTitle Data[0] = AeInfo
- Response Info Message = MessageNames.AddAeTitle Data[0] = AeInfo
-
UpdateAeTitle - Update an existing AE title.
- Message Info Message = MessageNames.UpdateAeTitle Data[0] = Old AE title Data[1] = AeInfo
- Response Info Messages.MessageNames.UpdateAeTitle Data[0] = Old AE title Data[1] = AeInfo
-
RemoveAeTitle - Remove an AE title.
- Message Info Message = MessageNames.RemoveAeTitle Data[0] = AE title
- Response Info Messages.MessageNames.UpdateAeTitle Data[0] = AE title
-
DisconnectClient - Disconnect client from server.
- Message Info Message = MessageNames.DisconnectClient Data[0] = ClientInfo
Notifications
-
ClientConnect - Received when a client connects to the server.
- Notification Info Message = MessageNames.ClientConnect Data[0] = ClientInfo
-
ClientAssociated - Received after a client has associated.
- Notification Info Message = MessageNames.ClientAssociated Data[0] = ClientInfo
-
ClientDisconnected - Received after a client has disconnected.
- Notification Info Message = MessageNames.ClientDisconnect Data[0] = ClientInfo
-
ClientAction - Received after a client has received a Dicom Message. Will display the name of the last action performed.
- Notification Info Message = MessageNames.ClientAction Data[0] = Action Data[1] = Ae Title
Programming With PACS Client Framework
Dicom AddIn
Dicom Scu
Dicom Server
Topics