PlanSetup list from PlanSum

Mar 11, 2016 at 12:11 AM
Is it possible to create a List of plansetups from a plansum?
Then also create seperate plansums from this list?

This is the scenario, we have plans which can be 2-4 phases In the case of 4 phases there are seperate PTVs for all phases (i.e. PTV1, PTV2, PTV3 & PTV4). Our GI group would like to be able to look at (DVH) coverage for:
PTV1 on phase 1.
PTV2 on phase 1+2 & Phase 2 alone
PTV3 on Phases 1+2+3 & Phase 3 alone
PTV4 on Phase 1+2+3+4 & phase 4 alone

We could just create three seperate plan sums but I am wondering if the above can be done with one plan sum of all plans. This what I was atempting:

PlanSum plansum = context.PlanSumsInScope.FirstOrDefault();
var plansetuplist = new List<PlanSetup>();
foreach (PlanSetup testplan in plansum.PlanSetups)
plansetuplist.Add(new PlanSetup {testplan});

But this gives me an error like: "VMS.TPS...PlanSetup() is inaccessiblle due to its protection level"

I was hoping to be able to read all plansetups into a list and then, for example, for PTV3 create a new plansum which consisted something like (not sure how this would go exactly):

plansetuplist[0] +plansetuplist[1] + plansetuplist[2] (i.e. the first three plans)

Then I could get the DVH data for this new plansum and evaluate the coverage.

But I guess this is equivalent to creating a new plansum which cannot be performed in v11?

Mar 11, 2016 at 1:44 AM
The "inaccessible due to its protection level" error means that the constructor for PlanSetup is not public (it's probably internal). Therefore, you can't create a PlanSetup object with ESAPI (except in the research version). The same goes for a PlanSum, you can't create one because its constructor is not public.
Mar 17, 2016 at 12:22 AM
Edited Mar 17, 2016 at 12:24 AM
Hello TrapJaw,

I was able to get your code running with a very small change.
Patient mypatient = app.OpenPatientById("SmartAdapt 5");
PlanSum myps = mypatient.Courses.First().PlanSums.First();
//create a list of plans from the sum    
List<PlanSetup> myplans = new List<PlanSetup>();
    foreach(PlanSetup test in myps.PlanSetups)
This worked as intended and now I have a list of plans from my initial plansum. Was this where the error occurred? I'm guessing the reason why your getting the error message with your syntax (as I was getting an Ienumeration error), is that creating a new plansetup with your syntax would expect you to define all properties individually as the plansetup class doesn't contain a constructor allowing for a single plansetup input.
Apr 26, 2016 at 5:46 PM
Thanks mcschmidt,

this did allow me to get all plans into a list but I still can't "create" a new plan sum from this list of plans. i.e. if I had four plans in the list I can't make a new plansum from the first two plans (I have Ver.11). I was hoping something like:
PlanSum tempsum = myplans[0] + myplans[1];
Would work to create a new plan sum but it does not.

For now our GI group is happy with simply doing two phases and the code for this was quite simple.