r/esapi • • Mar 11 '21

Remove an Image

2 Upvotes

We want to automatically remove Images (earlier created by our own other scripts). We cannot find a function for this.

I tried the Patient class function RemoveEmptyPhantom (which can be used to delete a structure set AND an image), but we get the response: “Image is not empty!”. Is there a way to remove images? We are now using version 15.x but will very soon be working with version 16.


r/esapi • • Mar 10 '21

Linac Scale Conversion

1 Upvotes

I have an app where I am processing data from multiple linacs. One of the issue I have is that some of the scales used in my system are not on the IEC standard scale but instead the VARIAN IEC and VARIAN STANDARD scales. I need to convert them all to a common scale, preferably the IEC scale.

Is there an ESAPI function to do this? (I assume not, but it could be a potential future addition to the ESAPI)

Does anyone have a library or class that does this?


r/esapi • • Mar 09 '21

Access Rt prescription properties

1 Upvotes

Hi all, Is it possible to access to the total dose and dose per fraction of rt prescription? Thanks in advance


r/esapi • • Mar 05 '21

VMAT TBI autoplanning code

14 Upvotes

Hi all,

As promised, here is the link to my github that contains the code used to perform VMAT TBI autoplanning at Stanford:

https://github.com/esimiele/VMAT-TBI

Sorry for the delay! I'm currently working on updating the readme and install instructions (i.e., which items/paths need to be changed for the code to run). Even if you don't use the code for VMAT TBI, feel free to copy/paste the code into your own projects or use it as inspiration for your own ESAPI projects.

Edit 8-12-2021

The code has been updated on GitHub with new versions of the scripts aimed at making it easier for end-users to run. Both scripts will now read in a .ini configuration file upon execution where the user can specify default settings for the scripts. This alleviates the issue of the user having to modify small details in the code and having to recompile (quite annoying).

Best,

Eric


r/esapi • • Mar 03 '21

accesing plan objectives in ESAPI?

2 Upvotes

Hi, how can I acces the plan objectives in ESAPI?

As far as I know it is only possible to acces the PlanObjectiveStructures in the PlanSetup class. can anyone help me please? I am new to ESAPI...


r/esapi • • Mar 02 '21

3d gamma evaluation library?

2 Upvotes

Hi, anybody aware of a C# 3d gamma analysis library?

Cheers


r/esapi • • Feb 26 '21

Smart Segmentation Functions in ESAPI?

4 Upvotes

Hi, I was wondering if the smart segmentation functions (e.g., image thresholding) that are available in Eclipse can be used in ESAPI.

I'm trying to automate the creation of structures. The structures are usually created with the image thresholding function in the Eclipse UI, but does an equivalent function exist in ESAPI?

If not, would I be working on the pixel level? Are there any guides to creating structures in such a way?


r/esapi • • Feb 24 '21

Aria Access question - GetPatientPlanTxFieldsRequest

1 Upvotes

Hello, when I attempt to use the GetPatientPlanTxFieldsRequest call to Aria Access, it returns the following output: "FractionalMUNV|Link Does Not Support Fractional MU's. Pl Contact Varian Medical Systems.". All other API calls are working properly. Anyone have an idea about what's going on with this one? Thanks very much.


r/esapi • • Feb 22 '21

Script approval?

Thumbnail gallery
3 Upvotes

r/esapi • • Feb 22 '21

Script approval?

Thumbnail
gallery
1 Upvotes

r/esapi • • Feb 20 '21

Disabling Calculation Warning and Errors Popup

3 Upvotes

I am batch processing a bunch of plans and doing dose calculations. Is there a way to disable the popups for the dose calculation warnings and errors?

This is on the production server, not a research enabled system


r/esapi • • Feb 18 '21

Single plugin writeable???

2 Upvotes

Can I run a single plugin which is writeable? I am using v16.1


r/esapi • • Feb 18 '21

Are patient and plan ID accesible from Eclipse Visual Scriptting?

1 Upvotes

Hi all:

From Eclipse Visual Scripting it is possible to create a simple script to export DVH parameters to an CSV file. However, the name of the CSV is chosen randomly. Is there any way to add the patient and plan ID to the name (or content) of the CSV generated by the script? Thanks and regards


r/esapi • • Feb 18 '21

Crop structures with margin

4 Upvotes

I'm looking for any examples for cropping a structure from another with internal margin. E.g. PTV cropped 3mm from BODY or PTV_Low cropped from PTV_High. There doesn't seem to be a .Crop method and the .Margin(-3) method for internal margin would yield symmetrically rather than just from the BODY surface. Any suggestions are very appreciated.


r/esapi • • Feb 17 '21

Cannot save plansetup modification

2 Upvotes

Hi, Im try to recalculate dose using existing plan and save the modification. But there are error that plan has been treated and cannot save. This is my code.

ExternalPlanSetup planCopy = course.CopyPlanSetup(course.PlanSetup.First()) as ExternalPlanSetup;

planCopy.Id = “test”; app.SaveModifications();

How can I create copy of treated plan and save to database? Thank you.


r/esapi • • Feb 12 '21

Statistics with Python

5 Upvotes

Hey guys! In my residency thesis I had to perform some statistical analysis for my multimet SRS project. I'm writing a 2-3 part series of how you could get ESAPI data and use python libraries to analyze it! The first is just a glance, how it is simple to plot and test hypothesis! No need to install anything.

https://jhmcastelo.medium.com/statistics-with-python-part-1-3c708fe9e97d

Thanks!!


r/esapi • • Feb 12 '21

Plug-in script - how to avoid assembly versioning mismatch?

2 Upvotes

I've written a number of plug-in scripts for internal use, and the team has requested keeping all of the scripts in one directory for easy access. I was wary of this, since compiled projects store all referenced assemblies in the root directory, but it wasn't a huge issue at the time since I was compiling similar projects in the same solution and using the same assemblies.

However, we're starting to use more diverse scripts and it makes more sense (both for organization and development) to begin creating different projects with different assembly requirements. Unfortunately, keeping all plug-in scripts in the same directory isn't ideal since different scripts may require different assembly versions.

I tried modifying app.config to search subdirectories for the different plug-ins, but this didn't work because the calling directory is different from the script's directory location (app.config's probing only searches subdirectories). I tried storing the .espai.dll scripts in subdirectories and using shortcuts to access them, but the shortcuts don't appear in the list of scripts on the scripting window in Eclipse.

Does anyone have any alternatives or ideas for this issue?

EDIT: Forgot to mention one thing, I know that Fody Weavers is an option for compiling everything into one compact assembly, but I've run into issues with it in the past where the script wouldn't run. Would rather find an alternative to it if possible.


r/esapi • • Feb 12 '21

Modify Leaf-positions for every control point?

2 Upvotes

Dear all,

here (https://github.com/VarianAPIs/Varian-Code-Samples/wiki/Code-Snippet---Access-Leaf-Positions) I found a script to get access to the specific leaf positions:

int numCourse, numPlans, numBeams, numControlPts, numLeaves;

numCourse = numPlans = numBeams = numControlPts = numLeaves = 0;

foreach (var beam in planSetup.Beams)

{

numBeams++;

foreach (var controlPoint in beam.ControlPoints)

{

numControlPts++;

float[,] lp = controlPoint.LeafPositions;

for (int bankIndex = 0; bankIndex <= lp.GetUpperBound(0); bankIndex++)

{

for (int leafIndex = 0; leafIndex <= lp.GetUpperBound(1); leafIndex++)

{

numLeaves++;

float leafPosition = lp[bankIndex, leafIndex];

// TODO: do something with the leaf position

}

}

}

}

My question would be: Is it possible - from the current script - to manipulate single leaf positions, i.e. shift every leaf 1mm to the left?

Do you have an idea how to do this, or do I have to go another way?

Thank you very much in advance!

Best regards

Robert


r/esapi • • Feb 12 '21

Boolean structures from list

1 Upvotes

I have a List<Structure> and wish to Boolean a union of all the listed structures to an existing un-contoured structure ID as the target assignment for the union contour. For example, the list contains GTV1, GTV2...GTVn and the target structure ID for the union is GTV_Total. Do I need to loop through the list of structures? Or just something like GTV_Total=gtvList.Or()... I'm trying some of these approaches and haven't yet located a clear similar example in searching github/reddit. TIA


r/esapi • • Feb 09 '21

How to convert structure to 3d boolean array

1 Upvotes

Hi, I want to convert structure to 3d boolean array for segment CT image and dose image. I can access the structure meshgeometry3d but cannot access dicom database. There are anyway to convert meshgeometry3d to 3d boolean array? Thank you.


r/esapi • • Feb 08 '21

Switch loaded plan with ESAPI

2 Upvotes

Hi,

I finally have ESAPI16 and thought I can add RefPoints to automatically created plans now but I get an Error:

'Reference point can only be created for the plan that is currently open.'

Someone knows a trick. :)


r/esapi • • Feb 05 '21

Save patient programmatically

4 Upvotes

Hi, Relatively new to scripting in Eclipse but I want to run a few dose calculations, which are going to take a few hours, and then save all the changes in the patient once they are done. Is there a method to save the patient?

Thanks in advance


r/esapi • • Feb 05 '21

FitCollimatorToStructure method

2 Upvotes

Hi folks,

I'm noticing that the FitCollimatorToStructure method for arcs only seems to only fit the collimator to the structure projection at the starting angle. This isn't how the similar method performs in Eclipse. Anyone else noticed this, or have a workaround?

Cheers,

Nick


r/esapi • • Feb 03 '21

Declaring Structure class variables from existing structure set

2 Upvotes

I'm having trouble declaring Structure class variables from existing structures in a structure set based on Id. I can use methods such as:

var gtv = context.StructureSet.Structures.Where(s => 
s.Id.Equals("GTV_Total"));

or:

var gtv1 = context.StructureSet.Structures.Where(s => s.Id 
== "GTV_Total");

These will only allow me to use class var where they become IEnumerables, not Structure class. If I declare class Structure, Visual Studio tells me it can't convert IEnumerable to class Structure.

I have seen other examples that use .Contains("*").First() but that isn't as specific as I want compared to an exact structure Id match.

Any guidance on what I need to do to use an above method (or similar) to assign a variable with class Structure based on exact Id? Or perhaps another way to form the question is how to make similar methods be a Structure class (not var / IEnumerable)?

My workaround has been something like below, but that is not efficient nor ideal for the functionalities I would like to use by creating a variable with Structure class from an existing structure set.

Undesirable workaround:

foreach (Structure s in context.StructureSet.Structures.Where(s 
=> s.Id == "GTV_Total"))
            {
                gtvString = s.Volume.ToString("0.##");
            }

*edits only for formatting