The Rules Add-in provides script functions to make writing scripts easier. The following functions are defined for use in the scripts. These functions use DICOM communications to associate with the specified AE Titles. As a result, the functions operate asynchronously and make copies of the datasets before initiating actions.
- Sub route(dataset As DicomDS, ParamArray aetitles As String())
Route the specified dataset to the list of aetitles
. The aetitles
information will be retrieved from the current server.
- Sub route(dataset As DicomDS, aetitle As String, ip As String, port As Integer)
Routes the specified dataset to the provided AE title. This AE title isn't required to be a client of the server. However, the server AE title should be present on the destination AE.
- Function route_at(dataset As DicomDS, time As DateTimeOffSet, ParamArray aetitles As String()) As Job
Routes the specified dataset at a specific time. The script provides extension methods that provide simplified, more readable definitions of time. For instance, you can use 1.Minute().FromNow() as the time parameter.
- Function route_at(dataset As DicomDS, time As DateTimeOffSet, aetitle As String, ip As String, port As Integer) As Job
Routes the specified dataset at a specific time to the specified aetitle. The script provides extension methods that provide simplified, more readable definitions of time. For instance, you can use 1.Minute().FromNow() as the time parameter.
-
Sub route_with_retry(dataset As DicomDS, numRetries As Integer timeout As Integer, ParamArray aetitles As String())
Routes the specified dataset to the provided AE titles. This function allows the operation to be retried it the store operation fails.
- numRetries - the number of times to retry the operation.
- timeout - the amount of time, in milliseconds, to wait before retrying.
-
Sub route_with_retry(dataset As DicomDS, aetitle As String, ip As String, port As Integer, numRetries As Integer timeout As Integer)
Routes the specified dataset to the specified AE title. This function allows the operation to be retried if the store operation fails.
- numRetries - the number of times to retry the operation.
- timeout - the amount of time, in milliseconds, to wait before retrying.
- Function route_at_with_retry(dataset As DicomDS, time As DateTimeOffSet, numRetries As Integer, timeout As Integer, retryTimeout As Integer, ParamArray aetitles As String()) As Job
Routes the specified dataset at a specific time. This allows the operation to be retried if the store operation fails. The script provides extension methods that provide simplified, more readable definitions of time. For instance, you can use 1.Minute().FromNow() as the time parameter.
- Function route_at_with_retry(dataset As DicomDS, aetitle As String, ip As String, port As Integer, time As DateTimeOffSet, numRetries As Integer, retryTimeout As Integer) As Job
Routes the specified dataset at a specific time. This allows the operation to be retried if the store operation fails. The script provides extension methods that provide simplified, more readable definitions of time. For instance, you can use 1.Minute().FromNow() as the time parameter.
-
Sub move(type As MoveType, id As String, ParamArray aetitles As String())
Moves the specified patient id or instance of the specified aetitles. The following type of move requests are allowed:
- Patient
- Study
- Series
- Instance
- Function move_at(type As MoveType, id As String, time As DateTimeOffSet, ParamArray aetitles As String()) As Job
Moves the specified patient id or instance at the specified time.
- Sub move_with_retry(type As MoveType, id As String, numRetries As Integer, timeout As Integer, ParamArray aetitles As String())
Moves the specified patient id or instance to the specified AE titles. This operation will be retried if it fails.
- Function move_with_at_retry(type As MoveType, id As String, time As DateTimeOffSet, numRetries As Integer, retryTimeout As Integer, ParamArray aetitles As String()) As Job
Move the specified patient id or instance to the specified aetitles. The operation will be retried it it fails.
Utility functions available in the scripts.
- Function find_job(jobid As String) As Job
Gets the Job with the specified job id.
-
Sub get_dataset(SOPInstanceUID As String, getCallback As Action(of DicomDS, String, String, String))
Sends a request to the server to get the specified SOPInstanceUID asynchrounously. Any Add-in can provide a response to this message if the add-in implements the Leadtools.Dicom.AddIn.Interfaces.IProcessServiceMessage and supports the GetInstanceFilename message. The following parameters are required:
- SOPInstanceUID - the instance to retrieve
- getCallback - the method that will be called when the
-
Function make_tag(Group As Integer, Element As Integer) As Long
Creates a valid DICOM tag from the compinent parts specified in the parameters.
- Group - specifies the DICOM group number.
- Element - specifies the DICOM element number.
IProcessServiceMessage interface and supports GetInstanceFilename messages. The following parameters are required:
- SOPInstanceUID - The instance to retrieve
- getCallback - The method that will be called when
- Sub warning_log(message As String)
Write warning message to log.
- Sub info_log(As String)
Write info message to log.
- Sub audit_log(As String)
Write audit message to log.
- Sub debug_log(As String)
Write debug message to log.
- Sub error_log(As String)
Write error message to log.
Property variables available to the scripts
Special types used in the scripts
-
DicomDS - A wrapper for the LEADTOOLS DicomDataset class. It adds index properties that simplifies setting and getting values from a DICOM dataset. For instance, the following syntax sets an element:
DicomDS - A wrapper for the LEADTOOLS DicomDataset class.
It adds index properties that simplifies setting and getting values from a DICOM dataset. For instance, the following syntax sets an element:
request(DicomTag.RetrieceAETitle) = client.Server.AETitle
DicomDS also provides the following methods:
- Shared Function Load(file As String) As DicomDS
Loads the specified dataset from the disk.
- Function Copy() As DicomDS
Copies the loaded dataset to a new DicomDS object.
- Sub Save(file As String)
Saves the loaded DicomDS to the specified file name.
DicomDS also provides the following methods:
- Shared Function Load(file As String) As DicomDS
Loads the specified dataset from the disk.
- Function Copy() As DicomDS
Copies the loaded dataset to a new DicomDS object.
- Sub Save(file As String)
Saves the loaded DicomDS to the specified file name.
-
Job - Holds information about a request move or route action that will execute at a later time.
-
Methods
- Sub Cancel()
Cancels the job.
- Sub Pause()
Pauses the job.
- Sub Resume()
Resumes the job.
-
Properties
- JobId As String
Represents the unique id for this job
- State As JobState
Represents the current job state. The following values are possible: Active, Paused, Finished, Canceled