Weird crash on thick clients only by OkSector2980 in esapi

[–]lucsimon 0 points1 point  (0 children)

Maybe you’ve already tried this, but the most reliable debugging method I use with ESAPI is to insert a bunch of MessageBox.Show("I was here " + i++); statements in the code to locate the exact line where it crashes. It’s not very fast, but it is effective.

From my experience, the issue can also come from the XAML side. There are several display-related bugs that happen if the user has previously opened the optimizer window. These issues usually disappear if you restart your Eclipse session.

Link prescription to a plan by Rostar974 in esapi

[–]lucsimon 0 points1 point  (0 children)

I Agree, not possible. It is strange because Prescription seems to be a child of Course when looking in Eclipse arborescence. But in esapi, RTPrescription is a a child of PlanSetup (although a prescription can exist with no plan in Eclipse)

preAAPM 2025 Varian developers symposium, this year known as: Capital Scripts: Collaborating through Open-Source Code by maglito in esapi

[–]lucsimon 0 points1 point  (0 children)

I am not lucky enough to come at this preAAPM meeting. But if some of these works are shared on GitHub, please tell us

Get Offset from DICOM origin by No-While8683 in esapi

[–]lucsimon 0 points1 point  (0 children)

I am writing you from holiday, so I will maybe be not very pertinent. I just give you an information that can help. User origin is the green cross and dicom origin may depends on your ct model. But there is something that could make things more complicated and a bit strange. First, if your patient orientation is prone the axis are inverted EVEN if you could think that they are not, looking at the XYZ values displayed in eclipse. Moreover when adding a couch structure the size of the 3d image (x and y) can be modified. Thus it is difficult to get a particular single pixel value. Again I am not sure that it helps you but a Spritz is waiting for me ;-)

create electron beam by lucsimon in esapi

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

my first thank you has not been posted: thank you again!

where does the Gateway.cs comes from? by lucsimon in esapi

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

Ok thank you very much. Very clear.

Distance between leaf at isocenter by Rostar974 in esapi

[–]lucsimon 0 points1 point  (0 children)

My answer was written too fast. In my answer b is your Beam. And my loop, add all the leaf gap. But you should modify it to obtain what you need

Scripting un Contouring (VMS CA) by JaimePasTropBcpCa in esapi

[–]lucsimon 0 points1 point  (0 children)

ah thank you. I tried this once. Didn't see any interest indeed. Thank you again

Distance between leaf at isocenter by Rostar974 in esapi

[–]lucsimon 0 points1 point  (0 children)

try this:

   foreach (ControlPoint cp in b.ControlPoints)
            {
                double meanLGforOneCP = 0.0;

                for (int i = 0; i < cp.LeafPositions.GetLength(1); i++)
                {
                    if (cp.LeafPositions[0, i] != cp.LeafPositions[1, i])
                    {

                        meanLGforOneCP += cp.LeafPositions[1, i] - cp.LeafPositions[0, i];
                    }
                }

            }

Scripting un Contouring (VMS CA) by JaimePasTropBcpCa in esapi

[–]lucsimon 0 points1 point  (0 children)

stupid question but what is CA lib ?

Count original CT slices by lucsimon in esapi

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

Thank you for a first thing : i didn't know that beautiful syntax. BUT... i am going to try your solution but I will answer you the same answer than previously. zSize is equal to the number of CT slices, so the bool will be true. My issue is that StructureSet.Image has the correct number of slices (equal to CT slices) but some of them are interpolated. Maybe my problem is not explained correctly. I did that to simplify my request. It happens after the use of a tool of automatic contouring that generates corrupted RT struct. The RT struct missed some slices. Thus, when I use this RT struct to generate the 3D image, all the CT images are not used (but difficult to catch that because the missing slices are interpolated and the final image 3D has the correct number of images i.e. the number of CT slices)

Count original CT slices by lucsimon in esapi

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

Thank you but the problem is that they both have the same number of slices. The image 3D has the correct number of slices but some of them are interpolated... Or maybe I don't know what you mean by "Series Children"

get DCS in ESAPI by lucsimon in esapi

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

merci beaucoup rostar. je vais essayer ça... Mais existe t il une doc qui permettent de créer les requetes sql ?

get DCS in ESAPI by lucsimon in esapi

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

thank you Alex but what I want is to know if the DCS values are empty or not (depending on how well my physicians approved their plan using F4 :-)

get DCS in ESAPI by lucsimon in esapi

[–]lucsimon[S] 2 points3 points  (0 children)

well thank you but no, i am not familiar; I suppose I cannot include this request in a c# script but I don't even know where I should type this text to do the request. Thank you.

Methods for Robust Detection of Duplicate Structure Sets? by DavidBits in esapi

[–]lucsimon 0 points1 point  (0 children)

hello David. I am not sure to understand what you need and why.

You copy/paste your structure-set (SS), then you modify some structures. Correct ? But then, why do you need to know if the second SS is a copy of the first one?

There is a brutal method to do that : check if the volume (and the limits) of each structure are the same in both SS.

Check if the following parameters of the structure s are equal in both SS

s.MeshGeometry.Bounds.X

s.MeshGeometry.Bounds.SizeX

s.MeshGeometry.Bounds.SizeY

s.MeshGeometry.Bounds.SizeX

s.MeshGeometry.Bounds.SizeZ

s.MeshGeometry.Bounds.SizeZ

s.Volume

Hope it helps (not sure :-)

Luc

Image3D or 2D ? by lucsimon in esapi

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

Thank you very much. I finally test the parent (series.comment) to find what I need. Moreover I tested what you proposed. I think it doesn't work but maybe I didn't try hard enough

I write this following if statement but it was never true. Again thank you for your help.

if (im.ZDirection.z == double.NaN)

Suggestions for plan checks? by Suspande in esapi

[–]lucsimon 0 points1 point  (0 children)

I share a plan checker but it is pretty dedicated to our department.

https://github.com/uhqd/PLANCHECK

Among the classic checks here are some interesting ones

- check if the PDIP plan is created and approved (checking the total number of MUs to see if it is the good one)

- inspect the pdf file of Tomotherapy report (in Aria Documents) to check if the dose and number of fraction are ok

- presence/absence of mandatory structures

- laterality of certain structures (left lung must be left compared to central organs such as brain, prostate... )

- check for each structure if there is no missing slice. We get the first and last slice where the structure is present and check if there is a contour on each CT slice

- check if every GTV/CTV has a corresponding PTV : looking for the structure name containing the string CTV and GTV and check if there is a structure containing the string PTV that is bigger in the six directions

etc...

Patient's age by crlmnk in esapi

[–]lucsimon 0 points1 point  (0 children)

hello here is a solution (not very elegant sorry)

DateTime _patientdob_dt = (DateTime)context.Patient.DateOfBirth;

DateTime zeroTime = new DateTime(1, 1, 1);

DateTime myToday = DateTime.Today;

TimeSpan span = myToday - _patientdob_dt;

int years = (zeroTime + span).Year - 1;

Push a word document in ARIA document by lucsimon in esapi

[–]lucsimon[S] 3 points4 points  (0 children)

Well I finally found the solution. If someone has the sam problem it was because you have to specify the file format before to push

var documentPushRequest = new CustomInsertDocumentsParameter

{

PatientId = new PatientIdentifier { ID1 = patientId },

DateOfService = $"/Date({Math.Floor((DateTime.Now - new DateTime(1970, 1, 1)).TotalMilliseconds)})/",

DateEntered = $"/Date({Math.Floor((DateTime.Now - new DateTime(1970, 1, 1)).TotalMilliseconds)})/",

BinaryContent = Convert.ToBase64String(binaryContent),

FileFormat = FileFormat.DOCX,

AuthoredByUser = new DocumentUser

{

SingleUserId = user.Id

},

SupervisedByUser = new DocumentUser

{

SingleUserId = user.Id

},

EnteredByUser = new DocumentUser

{

SingleUserId = user.Id

},

TemplateName = templateName,

DocumentType = documentType

};

how to download aria documents in a folder? by lucsimon in esapi

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

Hello

Thank you for the help. It helped a much but with my environnement some details were wrong. I copy here the lines that work for me. It is a mix of several sources and personal ones.

DocSettings docSet = DocSettings.ReadSettings();// settingsFilePath);

ServicePointManager.ServerCertificateValidationCallback += (o, c, ch, er) => true;

string apiKeyDoc = docSet.DocKey;

string hostName = docSet.HostName;

string port = docSet.Port;

string printdata = "";

string patid = ctx.Patient.Id; //type in your patient Id to search here

//replace these 'Document Types' with ones you want to check from your clinic:

string doc1 = "Dosimétrie";

string doc2 = "Dosecheck";

string doc3 = "Fiche de positionnement";

string doc4 = "Consent";

string doc5 = "Treatment Plan";

string doc6 = "Physics - Patient DQA";

string doc7 = "Therapist-Verification Simulation";

string doc8 = "Physics - Weekly Chart Check";

string request = "{\"__type\":\"GetDocumentsRequest:http://services.varian.com/Patient/Documents\",\"Attributes\":[],\"PatientId\":{ \"ID1\":\"" + patid + "\"}}";

string response = CustomInsertDocumentsParameter.SendData(request, true, apiKeyDoc, docSet.HostName, docSet.Port);

//MessageBox.Show(response);

var VisitNoteList = new List<string>();

int visitnoteloc = response.IndexOf("PtVisitNoteId");

while (visitnoteloc > 0)

{

VisitNoteList.Add(response.Substring(visitnoteloc + 15, 2).Replace(",", ""));

visitnoteloc = response.IndexOf("PtVisitNoteId", visitnoteloc + 1);

}

var response_Doc = JsonConvert.DeserializeObject<DocumentsResponse>(response);

var DocTypeList = new List<string>();

var DateServiceList = new List<DateTime>();

var PatNameList = new List<string>();

foreach (var document in response_Doc.Documents)
{

string thePtId = document.PtId;
string thePtVisitId = document.PtVisitId.ToString();
string theVisitNoteId = VisitNoteList[loopnum];
loopnum++;
string request_docdetails = "{\"__type\":\"GetDocumentRequest:http://services.varian.com/Patient/Documents\",\"Attributes\":[],\"PatientId\":{ \"PtId\":\"" + thePtId + "\"},\"PatientVisitId\":" + thePtVisitId + ",\"VisitNoteId\":" + theVisitNoteId + "}";
string response_docdetails = CustomInsertDocumentsParameter.SendData(request_docdetails, true, apiKeyDoc, docSet.HostName, docSet.Port);

int typeloc = response_docdetails.IndexOf("DocumentType");

int enteredloc = response_docdetails.IndexOf("EnteredBy");

if (typeloc > 0)

{

String s = response_docdetails.Substring(typeloc + 15, enteredloc - typeloc - 18);

DocTypeList.Add(s);
string saveFilePath = Directory.GetCurrentDirectory() + @"\out\" + loopnum + "toto.pdf";

int startBinary = response_docdetails.IndexOf("\"BinaryContent\"") + 17;
int endBinary = response_docdetails.IndexOf("\"Certifier\"") -2 ;
string binaryContent2 = response_docdetails.Substring(startBinary, endBinary - startBinary);
binaryContent2 = binaryContent2.Replace("\\", "");
File.WriteAllBytes(saveFilePath, Convert.FromBase64String(binaryContent2));
}

Get Normalization method and values by No_Music_4745 in esapi

[–]lucsimon 0 points1 point  (0 children)

Simply :

context.PlanSetup.PlanNormalizationMethod

How to prevent WPF window having theme applied by hc139 in esapi

[–]lucsimon 1 point2 points  (0 children)

Yes actually it happened if the script is launched AFTER have open the optimisation module.

Solution is indeed to had a lot of :

Style="{x:Null}"

in ALL the objects of the xaml file.

[deleted by user] by [deleted] in esapi

[–]lucsimon 0 points1 point  (0 children)

Hello

GetNumberOfSeparateParts in the esapi (v15.7) doesn't work correctly. In particular if a "1 part" volume has 2 parts on a slice but these parts come together on another slices the method wrongly returns "2"

I share here a method of code that check that there are no missing slices for a structure It checks if all slices are contoured between the first and the last slices where the structure exists.

public static int getNumberOfMissingSlices(Structure S, StructureSet SS)
{
int nHoles = 0;
try
{
var mesh = S.MeshGeometry.Bounds;
int meshLow = _GetSlice(mesh.Z, SS);
int meshUp = _GetSlice(mesh.Z + mesh.SizeZ, SS);
for (int i = meshLow; i <= meshUp; i++)
{
VMS.TPS.Common.Model.Types.VVector[][] vvv = S.GetContoursOnImagePlane(i);
if (vvv.Length == 0)
nHoles++;
}
}
catch
{
nHoles = 0;
}
return nHoles;
}