Usage of Patient.BeginModifications

Mar 22 at 3:36 PM
Edited Mar 23 at 12:49 AM
Hello, All:

I am new to Script, while I am interested in the broad availability of Script.

I would like to combine the two structures in PlanQuanlityMetircs to compute mean and maximum dose of the new structure.

But I am struggling in the process of binding the two structures.
In PQMReporter.cs, I tried to combine two lung structures as follows:

else if (pqm is EntireMeanDoseLimit)
    Structure oar2 = oar;
     var RTLung = (from s in ss.Structures
                           where s.Name == "RT LUNG"
                            select s).FirstOrDefault();

       oar2.SegmentVolume = oar.Or(RTLung);
       ((EntireMeanDoseLimit)pqm).addPQMInfoEntireMeanDose(plan, oar, writer);
where oar is the left lung structure, and EntireMeanDoseLimit is a new class created in PQMs.cs, which does the same thing as MeanDoseLimit for the combined structure.

But it gave me an error message, saying like 'the dicom was not allowed to be modified. Patient.BeginModifications()' should be appropriately called'.

Have you ever used this function before? Is anyone able to help me out?
I would appreciate if you get me any type of comments.