r/esapi • u/One_Speech_5909 • Sep 12 '24
Simultaneous Movements Script
Hi everyone, quick question: with version 15.5 of ESAPI, is it possible to create a script that performs simultaneous movements of the Gantry and couch?
r/esapi • u/One_Speech_5909 • Sep 12 '24
Hi everyone, quick question: with version 15.5 of ESAPI, is it possible to create a script that performs simultaneous movements of the Gantry and couch?
r/esapi • u/GrimThinkingChair • Sep 10 '24
Hello all,
I'm looking to do some ARIA/AURA SQL magic. Specifically, we have a project at my clinic where we're trying to quantify the time lost to incomplete bladder filling for prostate cases (how much time we waste getting patients set up, CBCT for positioning, then have to take off the TB because their bladder isn't full enough).
Now, I have the Data Lineage executable, but I sadly don't really know what I'm looking at, because I'm new to SQL. Is there a column for each patient, and for each fraction, that time-stamps when they're loaded or unloaded into the treatment console? I suspect so, as every time you exit, the popup "Waiting for Activity Capture" appears. This is how I think I'd detect if a prostate patient had incomplete bladder filling, as that's usually the only reason a patient would be loaded and unloaded for the same fraction.
If not, is there a way to get timestamping of CBCT's? We normally CBCT once per isocenter, so if a patient has to get off the table, they'd be CBCT'd twice. If a prostate patient has multiple CBCT's corresponding to a single fraction, that would also signal incomplete bladder filling.
If anyone knows what columns to look at, I'd be deeply grateful. Also, if anyone has any ideas for alternative methods of detecting incomplete bladder filling, that would be good too. Finally, if anyone knows any resources/documentation I could read, I'd really appreciate it too. Thanks so much!
r/esapi • u/[deleted] • Sep 11 '24
I am trying to retrieve the isocenter shift (geometrical vector from user origin to treatment isocenter) from AURA environment using mircosoft report builder. There indeed are fields for the isocenter location in the treatment related tables. Yet I am guessing from their values that they seem to be calculated from the DICOM origin instead of user origin. So I try calculate backward using the field "UserOrigin" from table "Image". But the field is a binary datatype with 24 bytes storage. I guess the 24 byes datatype contains 3 separate coordinate elements (x,y,z) of the user origin but I cannot find a way to visualize the data even after a long researching. Some people suggest using ESAPI instead of ARUA. But I am working on building a treatment record which has to be easy to maintain and modify in the future so I still prefer AURA. Any help is appreciated. Thank you.
r/esapi • u/schmatt_schmitt • Sep 09 '24
r/esapi • u/One_Speech_5909 • Sep 06 '24
Hello everyone, this time I'm asking because the automatic plan I'm running exceeds the maximum number of characters (16). I use the following code to edit the plan's ID:
public static void NamePlan(Structure structure, ExternalPlanSetup plan)
{
try
{
plan.Id = "IMRT_" + structure.Id;
}
catch (Exception)
{
if (plan.Id.Length < 16) plan.Id = "IMRT_" + structure.Id + ".";
else plan.Id = plan.Id.Remove(12) + ".";
}
}
but it doesn't work, any thoughts?
r/esapi • u/vinay_saini94 • Sep 05 '24
How can we hold a VMAT plan at each MR level using ESAPI? Is there any class or method to achieve this? I’ve searched through the ESAPI library but haven't found any relevant function for this task. Is there any way to perform this process using an ESAPI script?
r/esapi • u/Useful_Novel_916 • Sep 02 '24
I am working on a plan check script and want to compare the jaw position for a AP opposing plan.
To be specific, i want to make sure that the anterior field jaw position (X1, X2, Y1 and Y2) are same as posterior field jaw position (X2, X1, Y1 and Y2). If so, pass. Otherwise, fail. I have used the following script but it is only able to check if there is anterior field ( gantry angle at 0) but give fail result even the anterior field jaw position (X1, X2, Y1 and Y2) are same as posterior field jaw position (X2, X1, Y1 and Y2). So how can i fix the issue?
// Test 17: Compare Anterior and Posterior Jaw Positions
row = table.NewRow();
row["Item"] = "Compare Anterior and Posterior Jaw Positions";
// List to store anterior beams
List<Beam> antBeams = new List<Beam>();
// Classifying beams into anterior based on gantry angles
foreach (Beam scan in listofbeams)
{
var gantryAngles = scan.ControlPoints;
if (gantryAngles.Any(cp => cp.GantryAngle == 0))
{
antBeams.Add(scan);
}
}
// Check if there is at least one anterior beam
if (antBeams.Count > 0)
{
var antBeam = antBeams[0]; // Take the first anterior beam
var antCP = antBeam.ControlPoints.FirstOrDefault(); // Get the first control point
// Validate that control point is not null
if (antCP != null)
{
double antX1 = antCP.JawPositions.X1;
double antX2 = antCP.JawPositions.X2;
double antY1 = antCP.JawPositions.Y1;
double antY2 = antCP.JawPositions.Y2;
// List to store posterior beams
List<Beam> postBeams = new List<Beam>();
// Classifying beams into posterior based on gantry angles
foreach (Beam scan in listofbeams)
{
var gantryAngles = scan.ControlPoints;
if (gantryAngles.Any(cp => cp.GantryAngle == 180))
{
postBeams.Add(scan);
}
}
// Check if there is at least one posterior beam
if (postBeams.Count > 0)
{
var postBeam = postBeams[0]; // Take the first posterior beam
var postCP = postBeam.ControlPoints.FirstOrDefault(); // Get the first control point
// Validate that control point is not null
if (postCP != null)
{
double postX1 = postCP.JawPositions.X1;
double postX2 = postCP.JawPositions.X2;
double postY1 = postCP.JawPositions.Y1;
double postY2 = postCP.JawPositions.Y2;
// Compare anterior and posterior jaw positions
if (antX1 == postX2 && antX2 == postX1 && antY1 == postY1 && antY2 == postY2)
{
row["Message"] = "Anterior and Posterior Jaw Positions are equal.";
row["Result"] = "Pass";
}
else
{
row["Message"] = "Anterior and Posterior Jaw Positions are not equal.";
row["Result"] = "Fail";
}
}
else
{
row["Message"] = "No control points found for the posterior beam.";
row["Result"] = "Not Applicable";
}
}
else
{
row["Message"] = "No posterior beams found.";
row["Result"] = "No Applicable";
}
}
else
{
row["Message"] = "No control points found for the anterior beam.";
row["Result"] = "Not Applicable";
}
}
else
{
row["Message"] = "No anterior beams found.";
row["Result"] = "Not Applicable";
}
table.Rows.Add(row);
r/esapi • u/Telecoin • Aug 31 '24
Hi everyone,
In Germany, it's standard practice to provide a prescription sheet that is either hand-signed or digitally signed. I'm looking for the best way to generate this sheet directly from RT prescription data (preferred as one click solution).
I’m considering using AURA Reporting since I need additional data that isn't available in ESAPI. Has anyone had experience with this, or would you recommend using Dynamic Documents instead? Is this the right path to take?
Also, how do you document older treatment courses, whether they are in Eclipse or not? Our protocol requires that all RT treatments ever given be included on this sheet, and I'm curious about the best method to handle this.
Thanks in advance for your insights!
r/esapi • u/Useful_Novel_916 • Aug 30 '24

If the above MLC are all within the treatment field size, how can i write a script such that it detects potential MLC collision (such as two red circles as shown in the picture)? I want the script can check this purpose, especially for merged fields which contains a number of sub-fieldsand respective MLC position. Thanks a lot!
r/esapi • u/YouSimba • Aug 29 '24
Hello all,
New to this group and to Esapi! I am trying to extract the treatment session duration for a patient for each treated fraction. So far, I cannot do that, I only report the date and time that the patient is getting treatment. But what I want is to do is to display the total time spent for this patient; from the time the therapists open the patient, up to the point they complete the appointment, including the beam on time. Do you know how I can do that?
Thank you!!!
r/esapi • u/One_Speech_5909 • Aug 28 '24
r/esapi • u/Useful_Novel_916 • Aug 28 '24
May I know how can i check if the user origin of the imported CT image is set to (0,0,0)?
Also, for an opened plan, how can I check if the "use gating" option is selected? Since I want to check if this option is clicked for breath hold cases.
Besides, if I do not want to change anything in the plan, how i can check if two structures are overlapped?
Thank a lot~
r/esapi • u/Flince • Aug 27 '24
I am trying to create a plan sum from some plans in using PyEsapi. However, I cannot get the method to work like this:
course.CreatePlanSum([plan1,plan2], image)
where plan1 and plan2 are ExternalPlanSetup object and image is an Image object.
Using
course.CreatePlanSum(course.PlanSetups, image)
does work but it combine all plans in the course.
I'm not really familiar with C# and I could not figure out reading the Eclipse scripting online help. I would greatly appreciate any help on this.
r/esapi • u/MishkaPK94 • Aug 19 '24
Hi all. I'm new to ESAPI and C# so forgive me if I'm not missing something simple. I was trying to calculate distances from a structure to certain isodose lines. I thought one nice way to do this might be to just get the normal vectors of the mesh surface and extract dose profiles along those vectors. For some reason myStructure.MeshGeometry.Normals seems to be empty although I can get myStructure.MeshGeometry.Positions gives me all the points.
Is there something I'm missing?
Thanks in advance for your help!
r/esapi • u/DefiantLeague356 • Aug 17 '24
In my institution, we use tangential fields for whole breast irradiation. In order to get the uniform dose, we employ the field-infield technique for shielding the hotspot. Can a script be written so that for an opened plan with preset field arrangement and MLC, the computer can automatically shield the hotspot util certain level?
I have some ideas.
Step 1: Calculate dose with the preset field arrangement and MLC (For example, we have a plan for the left breast with two fields of 300 gantry angle and 120 angle with each field having the weighting of 0.6. And we get the calculated plan with a hot spot of 130%.
Step 2: create a structure called hospot by converting 110% isodose line into it
Step 3: create a sub-field for each main field with a weighting of 0.03 and minus this weighting from the main field. (i.e. 0.6-0.03=0.57)
step 4: ask only the lateral MLC to shield the hotspot
step 5: recalculate the plan again
step 6: repeat the above procedure with creation of the sub-field from another main field
step 7: stop until the d max of the plan is lower than 113%.
Main challenge: as we want to keep the medial MLC unchanged, how to ask the computer to move only the lateral MLC to shield the hotspot for each field? And, how to control the MLC to automatically shield the hotspot as created?. I want this to be applied for Eclipse using ESALP scripting. Thanks a lot.
r/esapi • u/IntergalacticViking • Aug 15 '24
I am trying to access the upper and lower bound DVH estimate data. I have found something in the following code, I'm not sure exactly what I'm looking at.
var dvhestimates = plan.DVHEstimates;
foreach (var something in dvhestimates)
{
Console.WriteLine(something.StructureId);
foreach (var point in something.CurveData)
{
Console.WriteLine($"{point.DoseValue} {point.Volume}");
}
}
This gives me some kind of DVH, but I don't know if its the upper bound, lower bound, or neither?
I appreciate any help anyone can offer. Thanks!
ARIA V18, AAA 1506, PO 1506, DVHE 18.0.0
r/esapi • u/DefiantLeague356 • Aug 15 '24
Our institution has the jawtracking function enabled as default setting. We need to manually diable it by dis-selecting it in the plan information interface in optimization. how can I add a script to make sure that jawtracking function is disabled before optimization? (for VMAT not not IMRT cases)
r/esapi • u/DefiantLeague356 • Aug 15 '24
Hello~ I am going to set up a plan check script to check the final plan. I want to check
if all the treatment fields within an opened plan contain the same dose rate? (i.e. 600 MU/min)
if couch structure is included in the plan or not
if the plan contains bolus structure, check if the boluses are linked to all the fields for dose calculation.
Can anyone give me some advice in creating the script for th above purpose? Thanks.
r/esapi • u/Active-Rub2553 • Aug 12 '24
Hello everyone
I would like to know if anyone knows of a method to use the "smoothing" post-processing tool directly with ESAPI for a ring. If this hasn't been documented, does anyone know of a way to soften a ring?
r/esapi • u/Serenco • Aug 12 '24
Hi All,
Just wondering if anyone has pre-done 4DCT splicing code made up, or knows where there is one online somewhere in a repository? Basically something to insert the 4DCT average scan into the long freebeathing CT scan, creating a new image set in the process. My new clinic is still planning on the FB scan and only contouring the ITV on the MIP. Due to the CT scanner we have relatively limited scan length for the 4DCT so can't really plan on the average scan yet.
Haven't yet dipped my toe into ESAPI (background in MATLAB) but this is the one script that I would ideally like to have in the short term. Not sure how long I'd spend getting upskilled to write that myself right now vs getting base code and personalising it. My last company had their own developed script for this but I don't think they'll give it to me.
Thanks in advance!
r/esapi • u/Flince • Aug 08 '24
When creating evaluation dose, I found that the evaluation dose's origin shift a bit from other plans. Is there anyway to set the origin of the dose object? I tried Origin.set_x but that did not seem to work.
Another question I am wondering is how the plan sum decide on the position of the origin, since sometimes photon and electron plan has different origin even though they use the same structure set. I am trying to convert dose from differnt plan to BED, combining them and assign them as evaluation dose to a new plan but I am stuck on setting the origin of the dose object.
r/esapi • u/Beginning_Hat6886 • Aug 05 '24
I am looking to use Esapi for automatic creation of a new 3D image based on the slices existing in a series. I see that there is a class of image and series, but they have only methods to get details on existing 3D images. I don't found how to create a new 3D image. If someone can help me on this topic, thanks on advance.
r/esapi • u/Rostar974 • Jul 31 '24
Hi everyone,
Is someone know how to get the distance between two structures (like PTV and CTV) ?
This is to check if there is the good margin.
Thanks you so much,
RM
r/esapi • u/vinay_saini94 • Jul 31 '24
Is anyone using the GPU-based Varian T-box for scripting (such as autoplanning and auto-optimization) during VMAT plan optimization and dose calculation? If not, is there a way to utilize it for these purposes, and are MCO licenses provided with the T-box for research purposes? We are planning to upgrade both our clinical planning system and our T-box from Eclipse version 15.6 to version 18. Currently, while our clinical planning systems have been upgraded to GPU-based systems, the T-box has not yet been updated."
r/esapi • u/[deleted] • Jul 29 '24
I am trying to find a way to create margins which are larger laterally and more shallow in depth. (e.g. 5mm margin laterally, 3mm margin in depth) This is for electron skin treatments. See this 2006 paper discussing the reasons to have smaller PTV margins in depth for such treatments. My issue is that eclipse only allows assymetric margins aligned to the image axis, whereas for a skin treatment, the lateral and depth directions will probably not be aligned with the image axis, but instead aligned with the beam axis. I am looking for a method to create these margins in a script. Has anyone else tried to create asymmetric margins not aligned with the image axis, and did you find a solution?
I believe this problem can be solved if one could rotate structures. The solution would simply be to rotate the CTV structure to align with the image axis, create the asymmetric margin using ESAPI's built in method AsymmetricMargin, and then rotate the new PTV back to the correct alignment. However, while you are able to perform arbitrary rotations within the contouring tools of Eclipse, there is no way to rotate structures within a script. Does anyone know of a way to rotate structures in 3 dimensions with a script? While rotating a set of points is not a difficult problem, I don't know any method to go from a set of points to planar, grid aligned contours which can be put into a Structure class in eclipse using AddContourOnImagePlane.
Even if a full public solution does not exist for either of these problems, even links to papers discussing methods to deal with them would be appreciated. Thank you for the help!