pdfutgYzAV SF
pdfutgYzAV SF
pdfutgYzAV SF
Reference Guide
Eclipse
Abstract This document provides information about using Eclipse Scripting API, version 13.6. This
publication is the English-language original.
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.
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
Contacting Varian Customer Support ................................................................. 6
Get Online Customer Support ........................................................................... 7
E-Mailing Varian ................................................................................................ 7
Ordering Documents by Phone ......................................................................... 8
Chapter 2 About the Eclipse Scripting API ............................................................. 9
Features .................................................................................................................. 9
System Requirements ......................................................................................... 10
Version Compatibility .......................................................................................... 10
Upgrade to ESAPI 13.6 ........................................................................................ 11
What Is New in Eclipse Scripting API 13.6 ........................................................ 11
Supported Script Types ...................................................................................... 12
Chapter 3 Eclipse Scripting API Object Model ..................................................... 14
Eclipse Scripting API Concepts ......................................................................... 14
Coordinate System and Units of Measurement .............................................. 14
User Rights and HIPAA................................................................................... 15
Working with Several Patients ........................................................................ 16
Overview of the Object Model ............................................................................ 16
Chapter 4 Installing the Eclipse Scripting API in a Developer Environment..... 21
Install the Eclipse Scripting API ......................................................................... 21
Chapter 5 Getting Started with the Eclipse Scripting API ................................... 24
Chapter 6 Using Example Scripts .......................................................................... 25
Copying Example Scripts.................................................................................... 25
Compiling Example Scripts ................................................................................ 25
Chapter 7 Creating Scripts ..................................................................................... 26
Creating Plug-in Scripts ...................................................................................... 26
Creating Single-File Plug-ins with the Script Wizard ...................................... 26
Creating Binary Plug-ins with the Script Wizard ............................................. 26
Creating Single-File Plug-ins Manually ........................................................... 27
Creating Binary Plug-ins Manually .................................................................. 27
Storing Plug-in Scripts ........................................................................................ 28
Creating Stand-alone Executable Applications ................................................ 28
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
Get Online Customer Support
You can browse the my.varian.com site without having a Varian account or logging in.
However, you must have a Varian account to get online customer support and to
access product information for products at your institution or clinic.
1. Go to http://my.varian.com.
2. Click Contact Us at the top of the window to display customer support and training
options, and international e-mail addresses and telephone numbers.
3. Choose an option:
If you do not already have an account, click Create New Account and follow
the instructions. Establishing an account may take a few days.
If you have an account, go to the next step.
4. Enter your user name and password.
5. Browse the information and then click the link that corresponds to what you want
to do:
Fill out and submit a support request.
Find documents. Online documents in PDF format include customer
technical bulletins (CTBs,) manuals, and customer release notes (CRNs).
Send an e-mail to Varian support. You can browse for international e-mail
addresses and telephone numbers by geographic area, and for oncology-
specific contacts such as for brachytherapy.
Find parts and services by geographical area.
E-Mailing Varian
Send e-mail inquiries through the my.varian.com website.
Alternatively, you can use a support e-mail address that corresponds to your location
or interest:
8 Introduction
Chapter 2 About the Eclipse Scripting API
The Eclipse Scripting API is a Microsoft .NET class library that gives you read access
to the treatment planning data of Eclipse. It allows you to create scripts that leverage
the functionality of Eclipse, and lets you retrieve plan, image, dose, structure, and DVH
information from the Varian System database. The data is retrieved from the Varian
System database also in stand-alone Eclipse installations. You can integrate the
scripts into Eclipse, or you can run them as stand-alone executables.
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.
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.
Note Do not use this installer for updating the installed Eclipse Scripting API on
any clinical system. Varian prohibits the use of the installer for this purpose.
Only authorized Varian service personnel is allowed to change the
installation on clinical systems.
Installing the Eclipse Scripting API in a developer environment has the following
benefits:
• Provides easier access to the Eclipse Script Wizard and the Eclipse Scripting API
Online Help.
• Allows you to preview new ESAPI releases.
• Allows you to create and compile scripts on workstations that do not have Eclipse
installed (as is the case with local workstations in Citrix environments).
A folder called Varian is added to the desktop and to the Windows Start menu.
This folder contains the subfolder Eclipse Scripting API, which includes a shortcut to
the Eclipse Script Wizard and to the Eclipse Scripting API Online Help:
The installer also adds libraries needed for running the Eclipse Script Wizard and for
compiling ESAPI plug-in and stand-alone executable scripts in folder C:\Program Files
(x86)\Varian\Vision\13.6\Bin64\esapi.
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");
}
}
}
}
26 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.
28 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();
}
}
}
30 Creating Scripts
Chapter 8 Launching Scripts
You can launch plug-in scripts from Eclipse, and stand-alone executables as any
Windows application.