-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path05_Main.fs
More file actions
51 lines (41 loc) · 1.87 KB
/
05_Main.fs
File metadata and controls
51 lines (41 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Entry point for the ESAPI script. Retrieves context objects, creates modified
// plans from daily images, and shows a summary of successes or errors.
namespace VMS.TPS
open VMS.TPS.Common.Model.API
open Workflow
open FsToolkit.ErrorHandling
open System.Reflection
[<assembly : ESAPIScript(IsWriteable = true)>]
do ()
[<System.Runtime.CompilerServices.CompilerGeneratedAttribute>]
type Script() =
member __.Execute(context : ScriptContext) =
let result = result {
// Gets the currently loaded patient and begins modifications
let! patient = Utilities.tryGetCurrentPatient context
do patient.BeginModifications()
// Gets the current course
let! course = Utilities.tryGetCurrentCourse context
// Gets the original plan containing 'HH' in its ID
let! referencePlan = Utilities.tryFindPlanByIdPattern course "HH"
// Gets all daily image plans containing 'aCT' in their IDs
let! allImagePlans = Utilities.tryFindMatchingPlans course "aCT"
// --- MULTI PLAN VERSION ---
let successMsgs, errorMsgs =
createModifiedPlansFromDailyImages
course
referencePlan
allImagePlans
"Def_CTScanner" // imagingDeviceId
"C" // suffix to add to modified plan ids
2.0 // prescriptionDose
"AcurosXB_18.0.1" // calculationModel
return successMsgs @ errorMsgs
}
match result with
| Ok messages ->
// Show all success and error messages after workflow completes
Utilities.showMessageBox (String.concat "\n" messages)
| Error msg ->
// Show fatal setup error (context, course, or plan loading)
Utilities.showMessageBox $"[Setup Error] {msg}"