Skip to main content
Unlisted page
This page is unlisted. Search engines will not index it, and only users having a direct link can access it.

Custom Scripting

  1. Click Settings > Server Settings > Station List. Station List screen is displayed.

  2. Click Send tab. The Send tab screen appears as shown below.

For PowerReader release PRU-8 or higher, the Station List consists of an additional Worklist Tab for inserting Custom Scripting. Custom Scripting in the Worklist tab allows for customizations of DICOM Modality Worklist and regular C-FIND request datasets.

  1. Click Custom Scripting to open up the Script Editor window. The Script Editor screen is displayed.

The Script Editor window allows the ability to create custom scripts to modify the DICOM object being received from the selected station. The Script Editor utilizes Pascal scripts. The following is a list of available functions to use when creating custom scripts.

Available Functions

ReadTagString

function ReadTagString(const TagGroup, TagAttribute: Word; var ReturnValue: string): Boolean;

Description: Call ReadTagString to read a specific attribute tag in a DICOM Object as string and returns a Boolean status.

Parameters:

  • TagGroup specifies the tag group in hexadecimal format.
  • TagAttribute specifies the tag element in hexadecimal format.
  • Returnvalue specifies the return value as a string.

ReadTagUint16

function ReadTagUint16(const TagGroup, TagAttribute: Word; var ReturnValue: Uint16): Boolean;

Description: Call ReadTagUint16 to read a specific attribute tag in a DICOM Object as an unsigned 16bit integer and returns a Boolean status.

Parameters:

  • TagGroup specifies the tag group in hexadecimal format.
  • TagAttribute specifies the tag element in hexadecimal format.
  • Returnvalue specifies the return value as an unsigned 16bit integer.

ReadTagUint32

function ReadTagUint32(const TagGroup, TagAttribute: Word; var ReturnValue: Uint32):Boolean;

Description: Call ReadTagUint32 to read a specific attribute tag in a DICOM Object as an unsigned 32bit integer and returns a Boolean status.

Parameters:

  • TagGroup specifies the tag group in hexadecimal format.
  • TagAttribute specifies the tag element in hexadecimal format.
  • Returnvalue specifies the return value as an unsigned 32bit integer.

ReadTagFloat64

function ReadTagFloat64(const TagGroup, TagAttribute: Word; var ReturnValue: Float64): Boolean;

Description: Call ReadTagFloat64 to read a specific attribute tag in a DICOM Object as a 64bit float and returns a Boolean status.

Parameters:

  • TagGroup specifies the tag group in hexadecimal format.
  • TagAttribute specifies the tag element in hexadecimal format.
  • Returnvalue specifies the return value as a 64bit float.

ReadTagSint16

function ReadTagSint16(const TagGroup, TagAttribute: Word; var ReturnValue: Sint16): Boolean;

Description: Call ReadTagSint16 to read a specific attribute tag in a DICOM Object as a signed 16bit integer and returns a Boolean status.

Parameters:

  • TagGroup specifies the tag group in hexadecimal format.
  • TagAttribute specifies the tag element in hexadecimal format.
  • Returnvalue specifies the return value as a signed 16bit integer.

ReadTagSint32

function ReadTagSint32(const TagGroup, TagAttribute: Word; var ReturnValue: Sint32): Boolean;

Description: Call ReadTagSint32 to read a specific attribute tag in a DICOM Object as a signed 32bit integer and returns a Boolean status.

Parameters:

  • TagGroup specifies the tag group in hexadecimal format.
  • TagAttribute specifies the tag element in hexadecimal format.
  • Returnvalue specifies the return value as a signed 32bit integer.

ReadTagStringArray

function ReadTagStringArray(const TagGroup, TagAttribute: Word; var ReturnValue: TStringArray): Boolean;

Description: Call ReadTagStringArray to read a specific attribute tag in a DICOM Object as an array of strings and returns a Boolean status.

Parameters:

  • TagGroup specifies the tag group in hexadecimal format.
  • TagAttribute specifies the tag element in hexadecimal format.
  • Returnvalue specifies the return value as an array of strings.

ReadTagDecimalStringArray

function ReadTagDecimalStringArray(const TagGroup, TagAttribute: Word; var ReturnValue: Float64Array): Boolean;

Description: Call ReadTagDecimalStringArray to read a specific attribute tag in a DICOM Object as an array of strings and returns a Boolean status.

Parameters:

  • TagGroup specifies the tag group in hexadecimal format.
  • TagAttribute specifies the tag element in hexadecimal format.
  • Returnvalue specifies the return value as an array of 64bit float.

ReadTagDecimalString

function ReadTagDecimalString(const TagGroup, TagAttribute: Word; var ReturnValue: Float64): Boolean;

Description: Call ReadTagDecimalString to read a specific attribute tag in a DICOM Object as a string and returns a Boolean status.

Parameters:

  • TagGroup specifies the tag group in hexadecimal format.
  • TagAttribute specifies the tag element in hexadecimal format.
  • Returnvalue specifies the return value as a 64bit float.

ReadTagIntegerString

function ReadTagIntegerString(const TagGroup, TagAttribute: Word; var ReturnValue: Sint32): Boolean;

Description: Call ReadTagIntegerString to read a specific attribute tag in a DICOM Object as a string and returns a Boolean status.

Parameters:

  • TagGroup specifies the tag group in hexadecimal format.
  • TagAttribute specifies the tag element in hexadecimal format.
  • Returnvalue specifies the return value as a signed 32bit integer.

ReadTagIntegerStringArray

function ReadTagIntegerStringArray(const TagGroup, TagAttribute: Word; var ReturnValue: Sint32Array): Boolean;

Description: Call ReadTagIntegerStringArray to read a specific attribute tag in a DICOM Object as an array of strings and returns a Boolean status.

Parameters:

  • TagGroup specifies the tag group in hexadecimal format.
  • TagAttribute specifies the tag element in hexadecimal format.
  • Returnvalue specifies the return value as an array of signed 32bit integer.

WriteTagString

procedure WriteTagString(const TagGroup, TagAttribute: Word; const Value: string);

Description: Call WriteTagString to write a specific attribute tag in a DICOM Object as string.

Parameters:

  • TagGroup specifies the tag group in hexadecimal format.
  • TagAttribute specifies the tag element in hexadecimal format.
  • value specifies a string to write.

WriteTagUint16

procedure WriteTagUint16(const TagGroup, TagAttribute: Word; const Value: Uint16);

Description: Call WriteTagUint16 to write a specific attribute tag in a DICOM Object as an unsigned 16bit integer.

Parameters:

  • TagGroup specifies the tag group in hexadecimal format.
  • TagAttribute specifies the tag element in hexadecimal format.
  • value specifies an unsigned 16bit integer to write.

WriteTagUint32

procedure WriteTagUint32(const TagGroup, TagAttribute: Word; const Value: Uint32);

Description: Call WriteTagUint32 to write a specific attribute tag in a DICOM Object as an unsigned 32bit integer.

Parameters:

  • TagGroup specifies the tag group in hexadecimal format.
  • TagAttribute specifies the tag element in hexadecimal format.
  • value specifies an unsigned 32bit integer to write.

WriteTagFloat64

procedure WriteTagFloat64(const TagGroup, TagAttribute: Word; const Value: Float64);

Description: Call WriteTagFloat64 to write a specific attribute tag in a DICOM Object as a 64bit float.

Parameters:

  • TagGroup specifies the tag group in hexadecimal format.
  • TagAttribute specifies the tag element in hexadecimal format.
  • value specifies a 64bit float to write.

WriteTagSint16

procedure WriteTagSint16(const TagGroup, TagAttribute: Word; const Value: Sint16);

Description: Call WriteTagSint16 to write a specific attribute tag in a DICOM Object as a signed 16bit integer.

Parameters:

  • TagGroup specifies the tag group in hexadecimal format.
  • TagAttribute specifies the tag element in hexadecimal format.
  • value specifies a signed 16bit integer to write.

WriteTagStringArray

procedure WriteTagStringArray(const TagGroup, TagAttribute: Word; const Value: TStringArray);

Description: Call WriteTagStringArray to write a specific attribute tag in a DICOM Object as an array of string.

Parameters:

  • TagGroup specifies the tag group in hexadecimal format.
  • TagAttribute specifies the tag element in hexadecimal format.
  • value specifies an array of strings to write.

WriteTagDecimalStringArray

procedure WriteTagDecimalStringArray(const TagGroup, TagAttribute: Word; const Value: Float64Array);

Description: Call WriteTagDecimalStringArray to write a specific attribute tag in a DICOM Object as an array of strings.

Parameters:

  • TagGroup specifies the tag group in hexadecimal format.
  • TagAttribute specifies the tag element in hexadecimal format.
  • value specifies an array of 64bit floats to write.

WriteTagDecimalString

procedure WriteTagDecimalString(const TagGroup, TagAttribute: Word; const Value: Float64);

Description: Call WriteTagDecimalString to write a specific attribute tag in a DICOM Object as a string.

Parameters:

  • TagGroup specifies the tag group in hexadecimal format.
  • TagAttribute specifies the tag element in hexadecimal format.
  • value specifies a 64bit float to write.

WriteTagIntegerString

procedure WriteTagIntegerString(const TagGroup, TagAttribute: Word; const Value: Sint32);

Description: Call WriteTagIntegerString to write a specific attribute tag in a DICOM Object as a string.

Parameters:

  • TagGroup specifies the tag group in hexadecimal format.
  • TagAttribute specifies the tag element in hexadecimal format.
  • value specifies a 32bit integer to write.

WriteTagIntegerStringArray

procedure WriteTagIntegerStringArray(const TagGroup, TagAttribute: Word; const Value: Sint32Array);

Description: Call WriteTagIntegerStringArray to write a specific attribute tag in a DICOM Object as an array of integers.

Parameters:

  • TagGroup specifies the tag group in hexadecimal format.
  • TagAttribute specifies the tag element in hexadecimal format.
  • value specifies an array of 32bit integers to write.

RemoveTag

procedure RemoveTag(const TagGroup, TagAttribute: Word);

Description: Call RemoveTag to remove a specific attribute tag in DICOM Object.

Parameters:

  • TagGroup specifies the tag group in hexadecimal format.
  • TagAttribute specifies the tag element in hexadecimal format.

SaveToFile

function SaveToFile(const FileName: string): Boolean;

Description: Call SaveToFile to save the current DICOM Object into a file.

Parameters:

  • Filename specifies the location to save the DICOM Object.

ReadTagSequence

function ReadTagSequence(const TagGroup, TagAttribute: Word; const SequenceNumber: Word; var ReturnValue: TRSDicomObjectScriptable): Boolean;

Description: Call ReadTagSequence to read a specific attribute tag in a DICOM Object as a sequence and returns a Boolean status.

Parameters:

  • TagGroup specifies the tag group in hexadecimal format.
  • TagAttribute specifies the tag element in hexadecimal format.
  • SequenceNumber specifies the sequence number of the tag in hexadecimal format.

NewTagSequence

function NewTagSequence(const TagGroup, TagAttribute: Word; var ReturnValue: TRSDicomObjectScriptable): Boolean;

Description: Call NewTagSequence to create a new sequence for a specific attribute tag in a DICOM Object.

Parameters:

  • TagGroup specifies the tag group in hexadecimal format.
  • TagAttribute specifies the tag element in hexadecimal format.

SetSkipObject

procedure SetSkipObject(const DoSkipObject): Boolean;

Description: Call SetSkipObject to control if the next object should be skipped

Parameters:

  • DoSkipObject decides if the system will skip the object from being received or sent.

GetSkipObject

function GetSkipObject: Boolean;

Description: Call GetSkipObject to return the skipped object

Parameters: None

EncodeDate

function EncodeDate(Year, Month, Day: Word): TDateTime;

Description: Call EncodeDate to return a TDateTime value from the values specified as the Year, Month, and Day parameters. If the specified values are not within range, EncodeDate raises an EConvertError exception.

Parameters:

  • Year must be between 1 and 9999.
  • Month values are 1 through 12.
  • Day values are 1 through 28, 29, 30, or 31, depending on the Month value.

EncodeTime

function EncodeTime(Hour, Min, Sec, MSec: Word): TDateTime;

Description: Call EncodeTime to encode the given hour, minute, second, and millisecond into a TDateTime value. If the specified values are not within range, EncodeDate raises an EConvertError exception.

Parameters:

  • Hour values are 0 through 24. If Hour is 24, Min, Sec, and MSec must all be 0, and the resulting TDateTime value represents midnight (12:00:00:000 AM) of the following day.
  • Min and Sec values are 0 through 59.
  • MSec values are 0 through 999.

TryEncodeDate

function TryEncodeDate(Year, Month, Day: Word; var Date: TDateTime): Boolean;

Description: Call EncodeDate to return a TDateTime value from the values specified as the Year, Month, and Day parameters. This function responds to out of range parameters by returning False instead of raising an exception.

TryEncodeTime

function TryEncodeTime(Hour, Min, Sec, MSec: Word; var Time: TDateTime): Boolean;

Description: Call EncodeTime to encode the given hour, minute, second, and millisecond into a TDateTime value. This function responds to out of range parameters by returning False instead of raising an exception.

DecodeDate

procedure DecodeDate(const DateTime: TDateTime; var Year, Month, Day: Word);

Description: Call DecodeDate to break the value specified as the Date parameter into Year, Month, and Day values. If the given TDateTime value has a negative (BC) year, the year, month, and day return parameters are all set to zero.

DecodeTime

procedure DecodeTime(const DateTime: TDateTime; var Hour, Min, Sec, MSec: Word);

Description: Call DecodeTime to break the object specified as the Time parameter into hours, minutes, seconds, and milliseconds.

DayOfWeek

function DayOfWeek(const DateTime: TDateTime): Word;

Description: DayOfWeek is a read-only Integer property that contains the Day of the Week for the Indy timestamp. Call will contain a value in the range 1 to 7.

Date

function Date: TDateTime;

Description: Call Date to obtain the current local date as a TDateTime value. The time portion of the value is 0 (midnight).

Time

function Time: TDateTime;

Description: Call Time to return the current time as a TDateTime value.

Now

function Now: TDateTime;

Description: Call Now to return the current date and time, corresponding to Date and Time. Although TDateTime values can represent milliseconds, Now is accurate only to the nearest second.

DateToStr

function DateToStr(D: TDateTime): string;

Description: Call DateToStr to obtain a string representation of a date value that can be used for display purposes. The conversion uses the format specified by the ShortDateFormat global variable.

StrToDate

function StrToDate(const s: string): TDateTime;

Description: Call StrToDate to parse a string that specifies a date. If S does not contain a valid date, StrToDate raises an EConvertError exception.

Parameters:

  • S must consist of two or three numbers, separated by the character defined by the DateSeparator global variable. The order for month, day, and year is determined by the ShortDateFormat global variable--possible combinations are m/d/y, d/m/y, and y/m/d. If S contains only two numbers, it is interpreted as a date (m/d or d/m) in the current year.
  • Year values between 0 and 99 are converted using the TwoDigitYearCenturyWindow global variable.
  • If TwoDigitYearCenturyWindow is 0, year values between 0 and 99 are assumed to be in the current century. If TwoDigitYearCenturyWindow is greater than 0, its value is subtracted from the current year to determine the "pivot"; years on or after the pivot are kept in the current century, while years prior to the pivot are moved to the next century.

FormatDateTime

function FormatDateTime(const fmt: string; D: TDateTime): string;

Description: Call FormatDateTime to format the TDateTime value given by DateTime using the format given by Format. If the string specified by the Format parameter is empty, the TDateTime value is formatted as if a 'c' format specifier had been given.

SetTranscodeToVideo

procedure SetTranscodeToVideo(const ATranscodeToVideo: Boolean);

Description: Sets whether to transcode CINE clips to MP4 video. If set to true, CINE clips will be transcoded to MP4 video.

SetRelativeFileName

procedure SetRelativeFileName(const RelativeFileName: string);

Description: Sets the relative file name

Parameters:

  • RelativeFileName

GetRelativeFileName

function GetRelativeFileName: string;

Description: Returns the relative file name

SetVolumeID

procedure SetVolumeID(const VolumeID: string);

Description: Sets the Volume ID

Parameters:

  • VolumeID

GetVolumeID

function GetVolumeID: string;

Description: Returns the Volume ID

SetRenderReportAsPDF

procedure SetRenderReportAsPDF(const DoRenderReportAsPDF: boolean);

Description: When sending SR reports, if parameter DoRenderReportAsPDF is true, render the report as PDF; otherwise, do not render report as PDF

Parameters:

  • DoRenderReportAsPDF

GetRenderReportAsPDF

function GetRenderReportAsPDF: boolean;

Description: Gets the value of SetRenderReportAsPDF procedure that determines whether report is to be rendered as PDF

SetStoreTransferSyntax

procedure SetStoreTransferSyntax(const StoreTransferSyntax: string);

Description: Specifies the DICOM transfer syntax for storing. Default value: JPEG2000Lossless

Parameters:

  • StoreTransferSyntax

GetStoreTransferSyntax

function GetStoreTransferSyntax: string;

Description: Gets the value of SetStoreTransferSyntax procedure that determines the type of transfer syntax

GetTranscodeToVideo

function GetTranscodeToVideo: boolean;

Description: Gets the value of the function SetTranscodeToVideo above

IsCineLoop

function IsCineLoop: Boolean;

Description: Gets the value of whether the object is a cine loop

IsCFindResponse

function IsCFindResponse: Boolean;

Description: Sets the current receive script to run in the context of a C-Find Response

IsCFindRequest

function IsCFindRequest: Boolean;

Description: Sets the current receive script to run in the context of a C-Find Request

UseCFindRequestKeys

function UseCFindRequestKeys: Boolean;

Description: Used only if function "IsCFindRequest" returns true: in receive script to determine whether C-Find Response should be responding with the same field as the request. (Default value: True)

Sample Script

The following script reads the Manufacturer Tag and depending on the two cases listed; the window level will change accordingly.

var
Manufacturer: string;
ManufacturerPrefix: string;
begin
if DicomObject.ReadTagString($0008, $0070, Manufacturer) then
begin
ManufacturerPrefix := Copy(Manufacturer, 1, 2); //copy first two characters of Manufacture
if ManufacturerPrefix = 'R2' then
begin
//R2 Technology digital mammogram
DicomObject.WriteTagDecimalString($0028, $1050, 100); //window Center
DicomObject.WriteTagDecimalString($0028, $1051, 200); //window width
end
else if ManufacturerPrefix = 'HO' then
begin
//HOLOGIC digital mammogram
DicomObject.WriteTagDecimalString($0028, $1050, 400); //window Center
DicomObject.WriteTagDecimalString($0028, $1051, 700); //window width
end;
end;
end;
begin
ProcessDicomObject(MyDicomObject);
end.