VarianAPIs / Varian-Code-Samples

Code samples for ESAPI and other Varian APIs and web services.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Anyway to use existing Eclipse Treatment Report Templates (stored as .tml files) in an ESAPI script which generates a report for a patient's treatment plan?

zackmorelli opened this issue · comments

This is a copy of a post I made on the ESAPI subreddit, putting here as well just so people are aware:

ORIGINAL POST

r/esapi
•Posted byu/zackmorelli95
10 days ago

Hi Everyone,

I am currently trying to make an ESAPI reporting script which automates a lot of the work our dosimetrists do in making reports for patient plans. Currently my department uses the "Print -> Report" feature in Eclipse to print out a text report that contains all the plan's information, and then they manually add screenshots of the planning images and DVH plots to this.

I want to create a script that does all of this all at once, as well as a pass/fail comparison for our anatomy-specific ROI criteria.

My department has put a fair amount of work into making a lot of .tml files for plan report templates of different treatment sites/types for the "Print->Report" feature. There is nothing wrong with these templates, so i would like to continue using them in my ESAPI script if possible.

Does anyone know if there is any way to do this? or if there is some other format that I could convert these .tml files into that would work with ESAPI?

Any help or insight on this would be appreciated. I am using Eclipse Version 13.6 in a citrix environment.

COMMENTS

schmatt_schmitt
4 points
·
10 days ago

I don't know of anyone that has created something like this, but I'd be willing to put in a bit of effort if we wanted to work on this as a community project.

It would be some C# class wrappers to take a tml file and convert to scripting objects for reporting purposes. Some of the components will be quite easy, but others (like the linac cartoon that shows shift motions) will be more difficult. I think this is useful.

Reply
Give Award
Share
Report
Save

level 1
wkt84
5 points
·
7 days ago
IMO, a simple solution is below:

Create the Windows script (.vbs) which sends key stroke to Windows.

Call the script from your ESAPI scripts.

These are sample codes;

ESAPI code

System.Diagnostics.Process.Start("sendkey.vbs");
VBS code (sendkey.vbs)

Set objShell = WScript.CreateObject("WScript.Shell")
WScript.Sleep 200
'Close your Script window
objShell.AppActivate("Scripts")
objShell.SendKeys "{ESC}"

'Send key stroke to execute "Print->Report"
objShell.SendKeys "%F"
objShell.SendKeys "P"
objShell.SendKeys "R"
Reply
Give Award
Share
Report
Save

level 2
zackmorelli95
1 point
·
7 days ago
oh wow! This is a brilliant idea! Thank you very much wkt84.

I never would have come up with this myself.

This should work just fine for what I want to do. The one caveat is it also needs to select the correct print template/tml file that the user usually selects in the "Layout" drop down menu. I'll see if I can make some adjustments to it to get it to work right and report back.

Thanks again.

UPDATE: I could not find a way to select the "Layout" dropdown menu on the "Print treatment report" dialogue box using SendKeys commands. This will work for printing a default template, but the whole point of what I am trying to do is access all of the different templates we have.

It is really easy and quick to print the reports using the current method in Eclipse, so finding a way to incorporate this into my reporting script is not helpful or worth it.

Eventually I will make native Migradoc/PDFSharp versions of my templates so the script can print the entire report all at once, but right now that is not the priority.

What I was looking for was a method in ESAPI where I could just call a report template in a script and print it for the active plan. This should definitely be possible. If Varian could add this to ESAPI, that would be great, as it would save me a lot of work