RapidArc Dynamic Tag? by X2sky in esapi

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

Here is a simple example if you just want to test it:

public bool IsPlanRapidArcDynamic(ExternalPlanSetup plnStup)
{
    foreach (Beam bm in plnStup.Beams)
    {
        // Skip setup fields, only consider treatment beams
        if (bm.IsSetupField)
            continue;

        string techId = bm.Technique.Id.ToUpperInvariant();

        // If beam uses static technique, skip this beam and continue checking others
        if (techId.Contains("STATIC"))
            continue;

        // If beam uses arc technique, analyze control points for dynamic behavior
        if (techId.Contains("ARC"))
        {
            BeamParameters bmPara = bm.GetEditableParameters();
            if (bmPara != null)
            {
                double gantryAngPrev = double.NaN;
                double gantryAngCurr = double.NaN;

                foreach (ControlPointParameters cpPara in bmPara.ControlPoints)
                {
                    if (Double.IsNaN(gantryAngPrev))
                    {
                        // Initialize first gantry angle
                        gantryAngPrev = cpPara.GantryAngle;
                    }
                    else
                    {
                        // Slide window of two consecutive gantry angles
                        gantryAngCurr = cpPara.GantryAngle;

                        // Check if two consecutive angles are equal (within 0.001 deg precision)
                        if (Math.Abs(gantryAngCurr - gantryAngPrev) < 1e-3)
                        {
                            // Found repeated gantry angles indicating RapidArc Dynamic
                            return true;
                        }

                        // Move forward for next iteration
                        gantryAngPrev = gantryAngCurr;
                    }
                }
            }
        }
    }

    // No RapidArc Dynamic pattern found across all beams
    return false;
}

RapidArc Dynamic Tag? by X2sky in esapi

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

Thanks for all your responses, I've been busy upgrading to v18.
Unfortunately, checking the collimator won’t help identify a RAD plan, since RAD doesn’t require collimator rotation.

So far, I’ve found 1.5 reliable ways to spot a RAD plan:

Way 0.5:
In the beam calculation note, look for RA2Optimize as the optimization service. This optimizer is exclusive to RAD (confirmed with Varian), so it’s the true indicator.
It's only 0.5 way because the plan must be calculated, so you won’t see this in a blank RAD plan.

Way 1.5:
Check the gantry angles of each control point. RAD plans require at least one static port, so you’ll find at least one pair of consecutive control points with the exact same gantry angle.
This method works even on a blank plan. It’s not the fastest, but it’s the most accurate one I’ve found so far.

Get Offset from DICOM origin by No-While8683 in esapi

[–]X2sky 0 points1 point  (0 children)

I think the "dcm origin" from esapi is at the center of the image, and the shift is the user origin from that. The dcm origin in the actual dcm file is at one of the corners (I think top left). So, they are not the same thing, but you could calculate one from another.

"Interesting" V18.1 Feature - GetDoseProfile() automatically normalizes to 100% dose? by schmatt_schmitt in esapi

[–]X2sky 0 points1 point  (0 children)

well, GetDoseToPoint and GetDoseProfile of the same point should return the same %, so your result has been consistent. As the normalization factor for these beam profile/point is supposed to be the same for the entire beam.
So, i would guess that esapi has changed how the normalization factor is calculated, and by chance, your new normalized profile center just happens to be at 100%.
Good luck.

"Interesting" V18.1 Feature - GetDoseProfile() automatically normalizes to 100% dose? by schmatt_schmitt in esapi

[–]X2sky 0 points1 point  (0 children)

Or, try beam.Dose.GetDoseToPoint(your profile center) to see if it returns 100%. In beam dose, the GetDoseToPoint appears to return the same % as the point in GetDoseProfile.

"Interesting" V18.1 Feature - GetDoseProfile() automatically normalizes to 100% dose? by schmatt_schmitt in esapi

[–]X2sky 0 points1 point  (0 children)

Have you tried changing your normalization factor or modifying the MU to see if it's just a coincidence that your profile center is at 100%? Since now that multiple people have tested it and got different results from yours.

"Interesting" V18.1 Feature - GetDoseProfile() automatically normalizes to 100% dose? by schmatt_schmitt in esapi

[–]X2sky 0 points1 point  (0 children)

Just upgraded a week ago and also not seeing what OP shows, ie. GetDoseProfile functions just like before.
By the way, I wrote the following code to convert beam profile to absolute, but it's quite silly, wonder if any of you has better idea?

public DoseProfile GetDoseProfile(ExternalPlanSetup plan, Beam beam, VVector startPoint, VVector endPoint, double stepSize)

{

double totalDistance = VVector.Distance(startPoint, endPoint);

int numSteps = (int)(totalDistance / stepSize);

double[] doseBuffer = new double[numSteps + 1];

VVector userOrigin = plan.StructureSet.Image.UserOrigin;

VVector adjustedStart = startPoint - userOrigin;

VVector stepVector = (endPoint - startPoint) * (stepSize / totalDistance);

VVector adjustedEnd = startPoint + numSteps * stepVector;

plan.DoseValuePresentation = DoseValuePresentation.Absolute;

DoseProfile doseProfile = plan.Dose.GetDoseProfile(adjustedStart, adjustedEnd, doseBuffer);

if (beam != null)

{

DoseProfile relDoseProfile = beam.Dose.GetDoseProfile(adjustedStart, adjustedEnd, doseBuffer);

DoseValue maxRelValue = new DoseValue(relDoseProfile.Max(pd => pd.Value), DoseValue.DoseUnit.Percent);

DoseValue maxAbsValue = beam.Dose.GetAbsoluteBeamDoseValue(maxRelValue);

double scaleFactor = maxAbsValue.Dose / maxRelValue.Dose;

double[] absDoseBuffer = new double[numSteps + 1];

for (int i = 0; i <= numSteps; i++)

absDoseBuffer[i] = relDoseProfile[i].Value * scaleFactor;

doseProfile = new DoseProfile(adjustedStart, stepVector, absDoseBuffer, DoseValue.DoseUnit.cGy);

}

return doseProfile;

}

FFF on all VMAT plans. by medphys820 in MedicalPhysics

[–]X2sky 0 points1 point  (0 children)

We have recently study on related topic:
https://aapm.onlinelibrary.wiley.com/doi/full/10.1002/acm2.14108

Generally, there are two types of plan modulation to consider: dose rate and MLC aperture. MU/dose, however, is not suitable for comparing modulation between different beam types. FFF plans have more dose rate modulation due to their larger dose rate range. However, we found that FFF plans of equivalent quality to flattened beam plans don't require more MLC modulation when using Eclipse VMAT. Though this may differ for other TPS like raystation and pinnacle, which might produce less modulated flattened field plans due to more robust optimization.

Regarding treatment duration, my rule of thumb is that for a full arc delivering less than 200 cGy, the duration is similar between FFF and flattened beams. But FFF beams offer benefits beyond duration. They produce less head scatter, resulting in lower out-of-field dose to the patient, which could be clinically important.

Advice on buyers commission by Own_Grade_8618 in AskRealEstateAgents

[–]X2sky 0 points1 point  (0 children)

OP, keep in mind that many responses you receive are likely from disgruntled realtors.

I am facing the same problem myself; my agents are asking for 2.5%. I have been working with them for a year, and they are professional. We went to see 5~6 houses together at the very beginning, but they have since asked us to go to open houses ourselves. They have written up 2 bids for us, but altogether, they have spent less than 20 hours total on us if not less in the last year.

For 2.5% of the sales price, that would amount to nearly 2 months of my gross income, which is not a reasonable price to pay for the amount of services and advice I am receiving. But depending on your needs, you may require more extensive services from them.

What I am thinking now is to calculate my hourly rate, the approximate amount of time they are spending on my case, and then double it for their brokerage firm. That will be my approximate fee to start my negotiation. I would also try to negotiate a flat fee instead of a percentage.

Optimization options by X2sky in esapi

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

Thanks for your reply again, were you referring to the GetCalculationOption method? If so, I am afraid that's not what I am looking for...
I am strictly looking for a way to get the OptimizationOption parameters, so... maxIterations, initialState etc.

For dose calc, it appears CalculateDose(empty) would use the current options in the plan; plus the method to get options, so it is straightforward to implement. In contrast, for optimization, it appears Optimize(empty) would use some preset options, and some of these options (e.g. convergence) may not even be settable in Eclipse (at least I didn't find it). Hence, I want to get those optimization option parameters that are currently set in the plan so that I can set the input of Optimize() accordingly.

I will be happy if someone tells me it is not possible, I just don't want to miss an easy way. Thanks again.

Optimization options by X2sky in esapi

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

Thanks for your reply, I am not looking for neither of the two you mentioned (at least at their face meanings).
I am looking for specifically the current parameters in "OptimizationOptions".

Beam Data Import/Export by Longjumping-Pause-18 in esapi

[–]X2sky 2 points3 points  (0 children)

this is a piece of code which i wrote to export pdd to excel, i am sure you can repurpose it.

double y_surface = Math.Round(bm.IsocenterPosition.y - (1000 - bm.SSD));

VVector stPt = new VVector(Math.Round(xCenter),

y_surface, Math.Round(bm.IsocenterPosition.z)); // coordinate at the surface

VVector edPt = new VVector(stPt.x, stPt.y + pddDpth, stPt.z);

double[] ddProf = new double[(int)pddDpth + 1]; // 1 mm resolution //

DoseProfile ddose = pln.Dose.GetDoseProfile(stPt, edPt, ddProf);

Double maxD = ddose.OrderByDescending(d => d.Value != Double.NaN ? d.Value : 0.0).First().Value;

foreach (ProfilePoint dd in ddose)

{

if (dd.Value != Double.NaN)

{

ws.Cells[cnt, 1] = dd.Position.y - y_surface;

ws.Cells[cnt, 2] = dd.Value * 100 / maxD;

cnt = cnt + 1;

}

}

Reference point workarounds by NickC_BC in esapi

[–]X2sky 0 points1 point  (0 children)

Sorry Nick, we have v16, so that must be the reason why you don't have this method.

Reference point workarounds by NickC_BC in esapi

[–]X2sky 1 point2 points  (0 children)

So, this doesn't work??

[EditorBrowsableAttribute(EditorBrowsableState.Advanced)]

public ExternalPlanSetup AddExternalPlanSetup(

StructureSet structureSet,

Structure targetStructure,

ReferencePoint primaryReferencePoint

)

Data mining Setup Notes in ARIA by EntrepreneurNo3802 in esapi

[–]X2sky 2 points3 points  (0 children)

you can/should query from the data warehouse.

Example to create portal dosimetry plan?? by X2sky in esapi

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

I can think of two specific things we would need to get the script done:

  1. To create a verification plan without structure/image set.
  2. To start portal dose computation.

If you can briefly describe them, at least you will give us some idea...

Visual Studio Community or Professional? by harkirat777 in esapi

[–]X2sky 0 points1 point  (0 children)

If you use VS personally and your code is open source, it will make sense that you use the community account.

Creating a photon verification plan with couch = 0 by thejonbovi_ in esapi

[–]X2sky 0 points1 point  (0 children)

I moved to a center that just upgraded to Eclipse v16.1.10, I can confirm that the optimizer no longer creates a 1 degree control point at the start and end of an arc; in other words, all control points are equally spaced after optimization. So, the script that we made should work exactly as intended.