@@ -33,8 +33,10 @@ module ImagerPositionCalculation =
33
33
/// - `x1`: The X1 jaw position.
34
34
/// - `x2`: The X2 jaw position.
35
35
let calculateImagerLat x1 x2 =
36
+
36
37
// Calculate the absolute shift needed
37
- let shiftLat = ( abs ( x1 - x2) / 2.0 ) * 1.6 // Because the imager is at 60.0cm
38
+ let shiftLat =
39
+ ( abs ( x1 - x2) / 2.0 ) * 1.6 // Because the imager is at 60.0cm
38
40
39
41
// Apply constraints to the shift
40
42
let constrainedShiftLat =
@@ -45,7 +47,8 @@ module ImagerPositionCalculation =
45
47
46
48
// Calculate the imager lateral position based on direction
47
49
let imagerLat =
48
- if ( constrainedShiftLat > 0.0 ) && ( x1 > x2 ) then
50
+ if ( constrainedShiftLat > 0.0 ) && ( x1 > x2 )
51
+ then
49
52
1000.0 - constrainedShiftLat
50
53
else
51
54
constrainedShiftLat
@@ -113,7 +116,15 @@ module ImagerPositionCalculation =
113
116
let imagerLat = calculateImagerLat x1 x2
114
117
115
118
// Create a setup beam record with the input values and calculated imager positions
116
- { Id = id; X1 = x1; X2 = x2; Y1 = y1; Y2 = y2; ImagerVrt = 60.0 ; ImagerLng = imagerLng; ImagerLat = imagerLat })
119
+ { Id = id
120
+ ; X1 = x1
121
+ ; X2 = x2
122
+ ; Y1 = y1
123
+ ; Y2 = y2
124
+ ; ImagerVrt = 60.0
125
+ ; ImagerLng = imagerLng
126
+ ; ImagerLat = imagerLat
127
+ })
117
128
|> List.ofSeq // Convert seq<setupBeam> to setupBeam list
118
129
119
130
/// Helper function to check if a string contains all specified substrings.
@@ -178,7 +189,15 @@ module ImagerPositionCalculation =
178
189
[
179
190
yield ! List.map ( fun prop ->
180
191
sprintf " <tr><td style=\" width: 100px;\" >%s </td>%s </tr>" prop ( String.concat " " [ for beam in sortedBeams -> sprintf " <td>%.1f </td>" ( getValue prop beam)])
181
- ) [ " X1" ; " X2" ; " Y1" ; " Y2" ; " ImagerVrt" ; " ImagerLng" ; " ImagerLat" ]
192
+ )
193
+ [ " X1"
194
+ ; " X2"
195
+ ; " Y1"
196
+ ; " Y2"
197
+ ; " ImagerVrt"
198
+ ; " ImagerLng"
199
+ ; " ImagerLat"
200
+ ]
182
201
]
183
202
|> List.fold (+) " "
184
203
sprintf " <!DOCTYPE html>\n <html>\n <head>\n <style>\n body {\n margin-left: 5%%;\n margin-right: 5%%;\n font-family: sans-serif;\n }\n\n h1 {\n display: block;\n font-size: 2em;\n margin-block-start: 0.67em;\n margin-block-end: 0.67em;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n font-weight: bold;\n margin-left: -3%%;\n }\n\n table {\n font-family: 'Trebuchet MS', Arial, Helvetica, sans-serif;\n border: 2px solid blue;\n border-collapse: collapse;\n text-indent: initial;\n white-space: normal;\n line-height: normal;\n font-weight: normal;\n font-style: normal;\n text-align: start;\n border-spacing: 2px;\n font-variant: normal;\n }\n\n td, th {\n font-size: 1.17em;\n border: 1px solid blue;\n padding: 3px 7px 2px 7px;\n text-align: left;\n padding: 8px;\n width: 120px;\n }\n th {background-color: lightgray;}\n </style>\n </head>\n <body>\n <h1>\n Imager Positions\n </h1>\n <table>%s%s </table>\n </body>\n </html>" headerRow bodyRows
0 commit comments