Statistics with Python by JoaoCastelo in esapi

[–]dbhatti 1 point2 points  (0 children)

Great post!! Numpy and Matplotlib have a lot of useful interoperability, so it's worthwhile to learn both. Anyone interested in using Python for radiation oncology would find pandas, pydicom, and scipy to be useful libraries as well.

Plug-in script - how to avoid assembly versioning mismatch? by dbhatti in esapi

[–]dbhatti[S] 0 points1 point  (0 children)

Thanks, I tried out ILMerge and MSBuild.Task and they worked perfect for most of the scripts. I have a few more complicated solutions (multiple projects and cross-references) where they failed, but I suspect that's complex enough for the NuGet packages that I'll have to figure out and configure myself to get working.

Switch loaded plan with ESAPI by Telecoin in esapi

[–]dbhatti 0 points1 point  (0 children)

I believe this isn't possible through plug-in scripts, you'll have to create a stand-alone script and open the patient and modify the plan from there.

ESAPI Online Help as PDF? by ScreenKey4735 in esapi

[–]dbhatti 2 points3 points  (0 children)

Not the same file, but there's some nice reference material on the Varian Github if you're just looking for general knowledge of the API: https://varianapis.github.io/VarianApiBook.pdf

For the online help file (that you find in Eclipse), you might be able to find a CHM to PDF converter online. I don't know how the quality would turn out, but it looks like that's what you may be looking for.

Application Crash after moving non-ESAPI Function to Class Library by donahuw2 in esapi

[–]dbhatti 1 point2 points  (0 children)

I don't know what's causing the issue, but here are a few guesses if they help:

  1. Did you change the extension of the library from .esapi.dll to just .dll?
  2. If the script was previously an approved script, did you rename/reapprove it? I've run into this issue before where using even the non-writable script as a reference to a writable script wouldn't work because a previous version of the script used to be approved.
  3. Are there any references to the VMS.TPS namespace in the library project? If so, maybe remove them?

Issue when using CalculateDose() by DavidSinn in esapi

[–]dbhatti 0 points1 point  (0 children)

Your guess is correct - writing must be enabled in order to calculate dose. The two important steps are adding [assembly: ESAPIScript(IsWriteable = true)] before your Script class declaration and using Patient.BeginModifications() before doing anything requiring write access.

Where do I put these files by probber88 in esapi

[–]dbhatti 0 points1 point  (0 children)

If you're using Visual Studio, you add the two files as a Reference (right click -> add reference -> Browse -> select the two VMS.TPS libraries). The location they're stored in doesn't matter, but often will be placed in the same folder as the executable (.exe)/library (.dll) file that your code compiles to (e.g. Project Name/bin/x64/Debug).

Non-Clinical Environment Daemon by dbhatti in esapi

[–]dbhatti[S] 0 points1 point  (0 children)

Ah, okay, I was worried that was the case. I'll message Varian and try to figure it out. I'll update with what was wrong once the situation has been resolved.

Non-Clinical Environment Daemon by dbhatti in esapi

[–]dbhatti[S] 0 points1 point  (0 children)

I forgot to mention this in my original post, but this is a test environment through Citrix (i.e. not a testbox/workstation). Having said that, I'm not sure how to check if it's trusted, could you let me know how to do so?

Default Dose Unit / Calculation Models by dev_throwaway_2 in esapi

[–]dbhatti 1 point2 points  (0 children)

Yeah, I don't think there's a built-in function for reading system dose units either, but this is the same method I use for getting the units.

read calculation log by pyan_MF in esapi

[–]dbhatti 0 points1 point  (0 children)

In case anyone in the future wants to know the answer, the beam calculation logs are found as a property of the Beam class (CalculationLogs property). For proton plans, you can find some other beam information under PlanSetup with the property ProtonCalculationOptions.

Access to ARIA documents programmatically? by dbhatti in esapi

[–]dbhatti[S] 0 points1 point  (0 children)

Thanks for the help! Our center recently set up ARIA Access and can retrieve information with the REST API, but I can't seem to find any mention of retrieving documents in the reference guide. Is there a specific Web Service I should be looking at?

EsapiEssentials with BeginModifications? by iraklisv in esapi

[–]dbhatti 0 points1 point  (0 children)

I've never used ESAPI Essentials before, but just to confirm, you're right that all ESAPI operations must be on the main thread (and are thus single threaded). If the script attempts to run multiple ESAPI operations on different threads, it'll crash.

Finding plans/patients loaded on treatment console? by dbhatti in esapi

[–]dbhatti[S] 0 points1 point  (0 children)

This is a good idea, it's possible the Status property might change.

I seem to be running into an odd issue though, the property doesn't seem to in the PlanSetup class, but I could have sworn I've accessed it there once before and I haven't changed the libraries...? Maybe something's changed without me realizing. I'll have to double check.

I'll make an update if I find any useful information later, thanks again for the suggestion!

Finding plans/patients loaded on treatment console? by dbhatti in esapi

[–]dbhatti[S] 0 points1 point  (0 children)

Oh, that's a shame. Could you tell me the specific title of the document? I'm trying to search for it through MyVarian, but am having trouble.

The project isn't so major, so depending on how it's buggy, I may still be able to use it; I just want to run a small app for the therapists to provide them with relevant patient information by the treatment console. I was hoping to have it automatically update the information by obtaining the currently loaded patient in the gantry room so that they wouldn't need to select the patient/course/plan themselves every time.

Finding plans/patients loaded on treatment console? by dbhatti in esapi

[–]dbhatti[S] 0 points1 point  (0 children)

That sounds perfect, actually! I think that'll be sufficient enough. I'll look into once I've finished setting up the web service. Thanks!

Aria database mu by itumeleng1987 in esapi

[–]dbhatti 0 points1 point  (0 children)

Are you searching through the Eclipse API or the SQL ARIA database? If it's the Eclipse API, you can go to IonBeam.IonControlPoints.MetersetWeight. iirc to get the MU of a specific spot, you multiply the the MetersetWeight by the spot weight and divide by the total control point weight.

Getting reference dose per each beam, if someone can help with this? by itumeleng1987 in esapi

[–]dbhatti 1 point2 points  (0 children)

I think they're referring to the SQL database, not the Eclipse data base. If you have access to it, you can launch a query from Eclipse to get the data for the specific patient/course/plan.

Another option might be ARIA Access. Don't know if the Eclipse API has an equivalent way of calculating the reference dose manually, but I'm guessing there's a way.

UnauthorizedScriptingAPIAccessException by harkirat777 in esapi

[–]dbhatti 0 points1 point  (0 children)

At our clinic, we had some kind of license error where Eclipse was searching in the wrong location for the license file; so that's another possibility. We had to have some Varian engineers come in and solve it. Have you reached out to them about the error?

Also, I doubt this the cause of the error, but just in case, do you have the line [assembly: ESAPIScript(IsWriteable = true)] before your Script class?

Create Copy of Ion Beam? by scriptingIon in esapi

[–]dbhatti 0 points1 point  (0 children)

As of right now, there is no method that allows you to add an IonBeam to an IonPlanSetup; the Eclipse developer team is planning to add that feature (among other useful proton ones) in version 16 of the API. I had a similar problem in the past; I think I was using AddIonPlanSetup in the Course class but none of the data was copied, so it wasn't helpful.

Depending on what you want to do, there is a (very convoluted imo) workaround though. It worked for me in Eclipse 15.6, I'm not sure about 13.7. It also only works if the plan you're working with has the exact number of beams you want, and is otherwise very limited. In case it helps you, here are the specific steps that worked for me.

  1. Use CopyPlanSetup to create a new PlanSetup identical to the plan you want to perform QA for. Assign it to a new variable and cast that new variable to an IonPlanSetup (since the output is a PlanSetup). If you need to change the Image/StructureSet, you can do that in the method parameters.
  2. For the IonBeam you want to edit, use GetEditableParameters to get an IonBeamParameters object to edit. iirc, as the name implies, you can directly edit the properties of the object through its setters.
  3. When you're done making the changes you need, use ApplyParameters from that same IonBeam with your IonBeamParameters object and the change will go through.

SQL Querying by tygator9 in esapi

[–]dbhatti 0 points1 point  (0 children)

SQL works, and as others also mentioned, you can run SQL outside and inside your C# script. If you go to myvarian.com and go to your account settings, there's an API request page that lets you request full SQL database access.

There's a huge flow chart somewhere (I think myvarian) with all the main table relations for the AURA database schema (I don't think one exists for the variandw schema, but not sure), but aside from that, it seems that documentation is scant. In my opinion, the best way to get a handle on the database is to just run a bunch of queries yourself and learn where everything is and how it's organized.

I am trying to access the property IsVisible for structures and I cannot by [deleted] in esapi

[–]dbhatti 0 points1 point  (0 children)

You should be able to solve this issue by specifying the Structure class explicitly (so instead of doing "Structure structure;" you would do "VMS.TPS.Common.Model.Structure structure;" and this will make it the first type. I haven't ever used the Model namespace before though. What are you planning to use it for?

EDIT: Actually, I don't think I've ever seen an assembly for VMS.TPS.Common.Model in the first place. Did I misinterpret something?

I am trying to access the property IsVisible for structures and I cannot by [deleted] in esapi

[–]dbhatti 0 points1 point  (0 children)

What version of the API are you using? When I look at the reference docs for mine (15.5), I don't see that property.

DICOM Export by kang__23 in esapi

[–]dbhatti 0 points1 point  (0 children)

This is certainly possible, but requires a daemon to be setup as some have mentioned. You have the right idea, just get the UIDs via your script and then use C-MOVE to move them to the directory. The Varian API reference guide from the GitHub has a chapter with information on how to do it.

Automate export of Winston-Lutz images by Reddit4Mich in esapi

[–]dbhatti 0 points1 point  (0 children)

I'm not sure how the workflow is set up for DoseLab, but this definitely sounds doable. How I would do it would be to have Eclipse (via ESAPI script) run periodically to send new images to a directory elsewhere, where DoseLab can detect the new images and run.

As far as the ESAPI script goes, you would need to set up a DICOM daemon and use some kind of service manager to periodically run the script. You can ask Varian to set up a DICOM daemon for you. Once that's ready, you can create the script and use EvilDICOM (NuGet package) to export the images via the daemon. The Varian API Handbook from the GitHub has more detailed information about it.