Eclipse Scripting API Reference Guide
Eclipse Scripting API Reference Guide
Reference Guide
Eclipse
Abstract This document provides information about using Eclipse Scripting API, version 13.6 MR2. This
publication is the English-language original.
Manufacturer Varian Medical Systems, Inc. European Authorized Varian Medical Systems UK Ltd.
3100 Hansen Way Representative Oncology House
Palo Alto, CA 94304-1038 Gatwick Road, Crawley
United States of America West Sussex RH10 9RG
United Kingdom
Notice Information in this user guide is subject to change without notice and does not represent a
commitment on the part of Varian. Varian is not liable for errors contained in this user guide or for
incidental or consequential damages in connection with furnishing or use of this material.
This document contains proprietary information protected by copyright. No part of this document
may be reproduced, translated, or transmitted without the express written permission of Varian
Medical Systems, Inc.
FDA 21 CFR 820 Varian Medical Systems, Oncology Systems products are designed and manufactured in
Quality System accordance with the requirements specified within this federal regulation.
Regulations
(cGMPs)
ISO 13485 Varian Medical Systems, Oncology Systems products are designed and manufactured in
accordance with the requirements specified within the ISO 13485 quality standard.
CE Varian Medical Systems, Oncology Systems products meet the requirements of Council Directive
MDD 93/42/EEC.
EU REACH SVHC The link to the current EU REACH SVHC disclosure statement can be found at
Disclosure http://www.varian.com/us/corporate/legal/reach.html.
HIPAA Varian’s products and services are specifically designed to include features that help our customers
comply with the Health Insurance Portability and Accountability Act of 1996 (HIPAA). The software
application uses a secure login process, requiring a user name and password, that supports role-
based access. Users are assigned to groups, each with certain access rights, which may include
the ability to edit and add data or may limit access to data. When a user adds or modifies data
within the database, a record is made that includes which data were changed, the user ID, and the
date and time the changes were made. This establishes an audit trail that can be examined by
authorized system administrators.
Electronic labeling
This symbol on the label indicates that the Instructions for Use for the corresponding product are
available at www.MyVarian.com. Access the Instructions for Use in electronic form by logging in
with your assigned MyVarian user credentials.
In compliance with EU Commission Directive No 207 / 2012, Varian will send EU customers a free
printed copy of the Instructions for Use within 7 days. Use the “Paper Document Request” form
provided on the Varian webpage to order your copy.
CAUTION: US Federal law restricts this device to sale by or on the order of a physician.
® ® ®
Trademarks ARIA Oncology Information System for Radiation Oncology, Varian , and VMS are registered
trademarks, and Eclipse™ and BrachyVision™ are trademarks of Varian Medical Systems, Inc.
® ® ® ® ® ®
Microsoft , Windows , .NET , Visual Studio , Visual C# , and IntelliSense are registered
trademarks of Microsoft Corporation in the United States and other countries.
All other trademarks or registered trademarks are the property of their respective owners.
2
Contents
Chapter 1 Introduction .............................................................................................. 5
Who Should Read This Manual ............................................................................ 5
Visual Cues ............................................................................................................. 5
Related Publications.............................................................................................. 6
Contact Varian Customer Support ....................................................................... 6
Chapter 2 About the Eclipse Scripting API ............................................................. 8
Features .................................................................................................................. 8
System Requirements ........................................................................................... 9
Version Compatibility ............................................................................................ 9
Upgrade to ESAPI 13.6 ........................................................................................ 10
What Is New in Eclipse Scripting API 13.6 ........................................................ 10
Supported Script Types ...................................................................................... 12
Chapter 3 Eclipse Scripting API Object Model ..................................................... 13
Eclipse Scripting API Concepts ......................................................................... 13
Coordinate System and Units of Measurement .............................................. 13
User Rights and HIPAA................................................................................... 14
Working with Several Patients ........................................................................ 15
Overview of the Object Model ............................................................................ 15
Chapter 4 Getting Started with the Eclipse Scripting API ................................... 20
Chapter 5 Using Example Scripts .......................................................................... 21
Copying Example Scripts.................................................................................... 21
Compiling Example Scripts ................................................................................ 21
Chapter 6 Creating Scripts ..................................................................................... 22
Creating Plug-in Scripts ...................................................................................... 22
Creating Single-File Plug-ins with the Script Wizard ...................................... 22
Creating Binary Plug-ins with the Script Wizard ............................................. 22
Creating Single-File Plug-ins Manually ........................................................... 23
Creating Binary Plug-ins Manually .................................................................. 23
Storing Plug-in Scripts ........................................................................................ 24
Creating Stand-alone Executable Applications ................................................ 24
Creating Stand-alone Executables with the Script Wizard ............................. 24
Creating Stand-alone Executables Manually .................................................. 25
Chapter 7 Launching Scripts .................................................................................. 27
Launching Plug-in Scripts .................................................................................. 27
Note Before creating your own scripts, familiarize yourself with the Eclipse
user documentation, especially any safety-related information,
cautions, and warnings found throughout the documentation.
Visual Cues
This publication uses the following visual cues to help you find information:
Note A note describes information that may pertain to only some conditions,
readers, or sites.
Tip A tip describes useful but optional information such as a shortcut, reminder,
or suggestion, to help get optimal performance from the equipment or
software.
Related Publications
RT Administration Reference Guide P1008617-001-A
6 Introduction
2. Choose an option:
If you have an account, enter your User login information (email and
password).
If you do not have an account, click Create New Account and follow the
instructions. Establishing an account may take up to two working days.
3. Click Contact Us at the top of the window to display customer support and training
options, and international e-mail addresses and telephone numbers.
4. From the Contact Us page, choose an option:
Call Varian Medical Systems support using a phone support number for your
geographic area.
Complete the form corresponding to your request for use on a call with a live
Varian representative; then follow the instructions to complete the remote
connection.
You can order documents by phone, request product or applications support, and
report product-related issues. Links on the MyVarian website navigate to other
support resources for products, services, and education.
5. To find documents, click Product Documentation.
Online documents in PDF format include customer technical bulletins (CTBs),
manuals, and customer release notes (CRNs).
WARNING: The authors of custom scripts are responsible for verifying the
accuracy and correctness of the scripts after developing a new
script or after system upgrade for the existing scripts.
Features
By using the Eclipse Scripting API, you can:
Write custom scripts and integrate them into the Eclipse user interface.
Write stand-alone executable applications that leverage the Eclipse Scripting
API.
Note: Microsoft Visual Studio is not needed for creating scripts. However, some
features described in this document assume that Microsoft Visual Studio
2010 has been installed.
Version Compatibility
ESAPI 13.6
The Eclipse Scripting API 13.6 is compatible with Eclipse 13.6.
Varian Medical Systems provides no guarantee that scripts written with this version
of the Eclipse Scripting API will be compatible with future releases.
ESAPI 13.5
The Eclipse Scripting API 13.5 is compatible with Eclipse 13.5.
Varian Medical Systems provides no guarantee that scripts written with this version
of the Eclipse Scripting API will be compatible with future releases.
ESAPI 13.0
The Eclipse Scripting API 13.0 is compatible with Eclipse 13.0.
Varian Medical Systems provides no guarantee that scripts written with this version
of the Eclipse Scripting API will be compatible with future releases.
ESAPI 11.0
The Eclipse Scripting API 11.0 is compatible with Eclipse 11.0.
Plug-ins
Plug-ins are launched from the Eclipse user interface. After the launch, the plug-in
gains access to the data of the currently open patient.
Eclipse supports two types of plug-ins:
A single-file plug-in: A source code file that Eclipse reads, compiles on the fly,
and connects to the data model of the running Eclipse instance.
A binary plug-in: A compiled .NET assembly that Eclipse loads and connects
to the data model of the running Eclipse instance.
Eclipse creates a Windows Presentation Foundation child window that the script code
can then fill in with its own user interface components. The plug-in scripts receive the
current context of the running Eclipse instance as an input parameter. The context
contains the patient, plan, and image that are active in Eclipse when the script is
launched. The plug-in scripts work only for one patient at a time in Eclipse.
Executable Applications
A stand-alone executable is a .NET application that references the Eclipse Scripting
API class library. It can be launched just like any Windows application.
Stand-alone executables can be either command-line applications, or they can
leverage any .NET user interface technology available on the Windows platform.
While the plug-in scripts are restricted to work for one single patient opened in Eclipse,
the stand-alone executable can scan the database and open any patient.
The Eclipse Scripting API has methods that convert values from the DICOM coordinate
system to the same representation that is used in the Eclipse user interface.
For more information on the display of 3D coordinates in the Eclipse user interface,
refer to Eclipse Photon and Electron Reference Guide.
For more information on the DICOM coordinate system, refer to the DICOM standard.
Dose Values
In the Eclipse Scripting API, dose values are always represented with the separate
VMS.TPS.Common.Model.Types.DoseValue type. In addition to the actual floating
point value of the variable, this type also holds the measurement unit of the dose. The
measurement unit can be Gy or cGy, depending on the selected clinical configuration.
It can also be a percentage if relative dose is used.
namespace VMS.TPS
{
class Script
{
public Script()
{
}
public void Execute(ScriptContext context)
{
if (context.Patient != null)
{
MessageBox.Show("Patient id is " + context.Patient.Id);
}
else
{
MessageBox.Show("No patient selected");
}
}
}
}
22 Creating Scripts
6. The Script Wizard creates the following folders in the location that you selected:
Project folder: Contains a script-specific subfolder where the Microsoft
Visual Studio project file and source code file are stored.
Plugins folder: Contains the compiled plug-in dlls. From this folder, the dll
can be loaded into Eclipse.
The Script Wizard launches Visual Studio.
7. Edit the source code file according to your needs.
8. Compile the plug-in, for example, by using Visual Studio. The resulting plug-in dll
is saved into the Plugins folder. Note that you can also use the MSBuild tool to
compile the binary plug-in. For an example, see Compiling Example Scripts. For
more information about MSBuild, refer to Microsoft documentation.
24 Creating Scripts
Creating Stand-alone Executables Manually
If you want to create stand-alone executables without the Script Wizard, follow these
guidelines:
1. In Microsoft Visual Studio, create a new project file for the executable. Select x64
as the Solution Platform.
2. Add references to the following class libraries of the Eclipse Scripting API:
VMS.TPS.Common.Model.API.dll
VMS.TPS.Common.Model.Types.dll.
On the basis of this information, the dll can access the Eclipse Scripting API.
These files are located in the installation directory of Eclipse.
3. In the main method of the executable file, use the static CreateApplication
method to create an instance of the
VMS.TPS.Common.Model.API.Application class. This class represents the
root object of the data model. The CreateApplication method also initializes
the Eclipse Scripting API.
4. Dispose of the instance when the stand-alone executable exits to free the
unmanaged resources in the Eclipse Scripting API. For more information on
disposing of objects, refer to Microsoft documentation of the IDisposable interface.
5. To the CreateApplication method, add the following parameters:
A user name and password for logging into the ARIA RTM system. If you
do not define the user name or password (values remain null), the system
shows a log-in dialog requesting the user credentials.
6. Use a single-threaded apartment (STA) as the COM threading model of the
executable. The Eclipse Scripting API must only be accessed from a single thread
that runs in the default application domain. For more information about threading
and application domains, refer to Microsoft documentation.
namespace StandaloneExample
{
class Program
{
[STAThread]
static void Main(string[] args)
{
try
{
using (Application app = Application.CreateApplication(null, null))
{
Execute(app);
}
}
catch (Exception e)
{
Console.Error.WriteLine(e.ToString());
}
}
static void Execute(Application app)
{
string message =
"Current user is " + app.CurrentUser.Id + "\n\n" +
"The number of patients in the database is " +
app.PatientSummaries.Count() + "\n\n" +
"Press enter to quit...\n";
Console.WriteLine(message);
Console.ReadLine();
}
}
}
26 Creating Scripts
Chapter 7 Launching Scripts
You can launch plug-in scripts from Eclipse, and stand-alone executables as any
Windows application.