Loops using scripts

1,107 views
Skip to first unread message

Dan McKinney

unread,
Nov 23, 2011, 10:08:52 AM11/23/11
to pinnacle3-users
Hey all,

I am fairly new to scripting in pinnacle. I was wondering if there is
a way to use Do-while loops or something similar. any help would be
greatly appreciated.

Dan

derek schulze

unread,
Nov 23, 2011, 5:23:41 PM11/23/11
to pinnacle3-users
Dan,
There isn't a direct way to do loops, but you can write a script that
calls itself. Let's pretend I'm running "loop.Script".


<normal script stuff>

Store.FloatAt.keep_looping = 1;

IF.<stopping condition>.THEN.Store.FloatAt.keep_looping = 0;

IF.Store.FloatAt.keep_looping.EQUALTO.#"#1".Script.ExecuteNow =
"loop.Script";


Hope that helps.

Derek

Dan McKinney

unread,
Nov 28, 2011, 4:16:20 PM11/28/11
to pinnacle3-users
Thanks Derek that is perfect.

The only thing that I am really missing is a way to count the number
of loops, and use that number in a useful way. Let me explain. My
overall goal is to scroll through all the beams and delete out all
beams that dont have monitor units associated with them (I am working
on a completely automated dose plane extraction script, and I would be
able to cut down on computing time if I were able to delete out all
unused beams).

I guess I could put in yet another conditional at the end of "the
script that calls itself" that tells it to add 1 to .keep_looping

Store .At .keep_looping .ADD .#"#1" (something like that
anyway, not completely up on my math operators yet)

but then I would need a .NOTEQUALTO operator. Is there such a thing?

IF .Store .At .keep_looping .Value .NOTEQUALTO .#"#0" <call
script again> ?????????

Also is there a proper way to grab the number of beams in the trial
and store it as a variable? I was thinking it might be easy to use
something like:

Trials .Current .Beamlist .Last .MakeCurrent = 1; (but then
how do you get the beam number of the current beam?)

> > Dan- Hide quoted text -
>
> - Show quoted text -

derek schulze

unread,
Nov 28, 2011, 5:42:50 PM11/28/11
to pinnacle3-users
Last question first. You'll find Count and Index useful for any List
you're looking at in your script, e.g.:

TrialList.Current.BeamList.Count
TrialList.Current.BeamList.Current.Index

For more general help with the scripting language (like EQUALTO/
NOTEQUALTO issues), I find the Perth scripting guide to be quite
handy.

http://www.medphysfiles.com/index.php?name=Downloads&file=details&id=36

Dan McKinney

unread,
Nov 28, 2011, 5:45:41 PM11/28/11
to pinnacle3-users
Thanks Derek.

You're a Rock Star!! I was hoping that there was some kind of guide
out there somewhere.

> > > - Show quoted text -- Hide quoted text -

Bee Gary (TAUNTON AND SOMERSET NHS FOUNDATION TRUST)

unread,
Nov 29, 2011, 9:33:11 AM11/29/11
to pinnacl...@googlegroups.com
Dan,
You may also want to try:
Write the script that checks the current beam for zero MU, then deletes it.
Then all you have to do in another script is reference it using ChildrenEachCurrent (I think this is covered in the Perth doc) which will iterate over each beam, making it current and executing the delete script:

TrialList.Current.BeamList.ChildrenEachCurrent.#"@".Script.ExecuteNow = "/usr/local/adacnew/PinnacleSiteData/Scripts/PATHTOMUCHECKSCRIPT";


I hope that helps

Gary

-----Original Message-----
From: pinnacl...@googlegroups.com [mailto:pinnacl...@googlegroups.com] On Behalf Of Dan McKinney
Sent: 28 November 2011 22:46
To: pinnacle3-users
Subject: [p3rtp] Re: Loops using scripts

Thanks Derek.

You're a Rock Star!! I was hoping that there was some kind of guide out there somewhere.

> > > - Show quoted text -- Hide quoted text -


>
> - Show quoted text -

--
You received this message because you are subscribed to the Google Groups "pinnacle3-users" group.
To post to this group, send email to pinnacl...@googlegroups.com To subscribe to this group, send email to
pinnacle3-us...@googlegroups.com
To unsubscribe from this group, send email to
pinnacle3-use...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/pinnacle3-users?hl=en

********************************************************************************************************************

This message may contain confidential information. If you are not the intended recipient please inform the
sender that you have received the message in error before deleting it.
Please do not disclose, copy or distribute information in this e-mail or take any action in reliance on its contents:
to do so is strictly prohibited and may be unlawful.

Thank you for your co-operation.

NHSmail is the secure email and directory service available for all NHS staff in England and Scotland
NHSmail is approved for exchanging patient data and other sensitive information with NHSmail and GSi recipients
NHSmail provides an email address for your career in the NHS and can be accessed anywhere
For more information and to find out how you can switch, visit www.connectingforhealth.nhs.uk/nhsmail

********************************************************************************************************************

Carsten Reiffenstuhl

unread,
Dec 2, 2011, 10:56:52 AM12/2/11
to pinnacle3-users
Hello Dan, Hello Gary,

the discribed way works, BUT be carefull, childreneachcurrent counts
the beam numbers:
e.g. current = #1, delete current -> next beam checked will be beam
#2, wich was beam #3 before you deleted #1, you failed to check #2!!!

Carsten

On 29 Nov., 15:33, "Bee Gary (TAUNTON AND SOMERSET NHS FOUNDATION

> For more options, visit this group athttp://groups.google.com/group/pinnacle3-users?hl=en

Lederer, Ernst

unread,
Dec 2, 2011, 12:05:04 PM12/2/11
to pinnacl...@googlegroups.com
What you can do to avoid this problem is this

1. Create a List in Store with

Store.At.Stack = ObjectList {ChildClassName = "SimpleString"; };

Then Check all the Beams

TrialList.Current.BeamList.ChildrenEachCurrent.#"@".Script.ExecuteNow = <TestScript>;

TestScript:

IF.TrialList.Current.BeamList.Current.<TestCondition>.THEN.Store.At.Stack.CreateChild = 1; IF.TrialList.Current.BeamList.Current.<TestCondition>.THEN.Store.At.Stack.Last.Name = TrialList.Current.BeamList.Current.Name;

LastStep:

Store.At.Stack.ChildrenEachCurrent.#"@".Script.ExecuteNow = <RemoveScript>;

RemoveScript:

TrialList.Current.BeamList.Current = Store.At.Stack.Current.Name; TrialList.Current.BeamList.Current.Destroy = 1;

Important:
BeamNames cannot not contain special characters "~!@#$%^&*(){}[]" and spaces should be replaced with underscore (courtesy of SOLARIS)

Ernst


____________________________________

Ernst Lederer RT. (Austria), C.M.D.
Dosimetrist, Department of Medical Physics

Regional Cancer Centre of the
Hopital Regional Sudbury Regional Hospital

41 Ramsey Lake Road
Sudbury, Ontario P3E 5J1
Tel: (705) 522-6237 Ext. 2158
Fax.: (705) 523-7329
e-mail: eled...@hrsrh.on.ca
The information contained in this e-mail and document(s) attached are for
the exclusive use of the addressee and may contain confidential, privileged
and non-disclosable information. If the recipient of this e-mail is not the
addressee, such recipient is strictly prohibited from reading, photocopying,
distributing or otherwise using this e-mail or its content in any way.

Dan McKinney

unread,
Dec 2, 2011, 4:36:42 PM12/2/11
to pinnacle3-users
Thanks a bunch Ernst,

That was a very helpful tip, not only in this situation, but the
ability to use a list like that is very powerful. I didn't know you
could do that cheers.

Dan McKinney

On Dec 2, 11:05 am, "Lederer, Ernst" <ELede...@hsnsudbury.ca> wrote:
> What you can do to avoid this problem is this
>
> 1.  Create a List in Store with
>
> Store.At.Stack = ObjectList {ChildClassName = "SimpleString"; };
>
> Then Check all the Beams
>
> TrialList.Current.BeamList.ChildrenEachCurrent.#"@".Script.ExecuteNow = <TestScript>;
>
> TestScript:
>

> IF.TrialList.Current.BeamList.Current.<TestCondition>.THEN.Store.At.Stack.C­reateChild = 1; IF.TrialList.Current.BeamList.Current.<TestCondition>.THEN.Store.At.Stack.L­ast.Name = TrialList.Current.BeamList.Current.Name;


>
> LastStep:
>
> Store.At.Stack.ChildrenEachCurrent.#"@".Script.ExecuteNow = <RemoveScript>;
>
> RemoveScript:
>
> TrialList.Current.BeamList.Current = Store.At.Stack.Current.Name; TrialList.Current.BeamList.Current.Destroy = 1;
>
> Important:
> BeamNames cannot not contain special characters "~!@#$%^&*(){}[]"  and spaces should be replaced with underscore  (courtesy of SOLARIS)
>
> Ernst
>
> ____________________________________
>
> Ernst Lederer RT. (Austria), C.M.D.
> Dosimetrist, Department of Medical Physics
>
> Regional Cancer Centre of the
> Hopital Regional Sudbury Regional Hospital
>
> 41 Ramsey Lake Road
> Sudbury, Ontario P3E 5J1
> Tel: (705) 522-6237 Ext. 2158
> Fax.: (705) 523-7329

> e-mail:     elede...@hrsrh.on.ca

> > ***************************************************************************­*****************************************


>
> > This message may contain confidential information. If you are not the intended recipient please inform the
> > sender that you have received the message in error before deleting it.
> > Please do not disclose, copy or distribute information in this e-mail or take any action in reliance on its contents:
> > to do so is strictly prohibited and may be unlawful.
>
> > Thank you for your co-operation.
>
> > NHSmail is the secure email and directory service available for all NHS staff in England and Scotland
> > NHSmail is approved for exchanging patient data and other sensitive information with NHSmail and GSi recipients
> > NHSmail provides an email address for your career in the NHS and can be accessed anywhere
> > For more information and to find out how you can switch, visitwww.connectingforhealth.nhs.uk/nhsmail
>

> > ***************************************************************************­*****************************************


>
> --
> You received this message because you are subscribed to the Google
> Groups "pinnacle3-users" group.
> To post to this group, send email to pinnacl...@googlegroups.com
> To subscribe to this group, send email to
> pinnacle3-us...@googlegroups.com
> To unsubscribe from this group, send email to
> pinnacle3-use...@googlegroups.com
> For more options, visit this group athttp://groups.google.com/group/pinnacle3-users?hl=en
>

> ************************************************************************
> The information contained in this e-mail and document(s) attached are for
> the exclusive use of the addressee and may contain confidential, privileged
> and non-disclosable information. If the recipient of this e-mail is not the
> addressee, such recipient is strictly prohibited from reading, photocopying,

> distributing or otherwise using this e-mail or its content in any way.- Hide quoted text -

Patrick Delage

unread,
Dec 9, 2011, 9:34:34 AM12/9/11
to pinnacle3-users
Very powerfull indeed. Thanks for that input. I have problem using it
however. I'm writing a script to delete empty ROIs. Had one before but
crashed Pinnacle big time and could not reopen patient (the .destroy
and index don't work well together). So here's the problem if somebody
is willing to help:

This works like a charm:

IF.RoiList.Current.#!HasCurves".
THEN.WarningMessage = "Empty";

Giving me a warning message when the ROI is empty.

However when using a custom list:

Store.At.EmptyROIList = ObjectList {ChildClassName =
"SimpleString"; };

IF.RoiList.Current.#"!HasCurves".
THEN.Store.At.EmptyROIList.CreateChild = 1;

IF.RoiList.Current.#"!HasCurves".
THEN.Store.At.EmptyROIList.Last.Name = RoiList.Current.Name;

It stores EVERY ROI in the list regardless of the condition...
However removing the negation (!) it only stores ROI having curves in
the list...

I'm kind of puzzled over this and hope sombody has an explanation.

Thanks all!

Patrick Delage
Medical Physicist
CHUS - Centre de Santé Universitaire de Sherbrooke
patrick...@gmail.com, pdelag...@ssss.gouv.qc.ca

On 2 déc, 12:05, "Lederer, Ernst" <ELede...@hsnsudbury.ca> wrote:
> What you can do to avoid this problem is this
>
> 1.  Create a List in Store with
>
> Store.At.Stack = ObjectList {ChildClassName = "SimpleString"; };
>
> Then Check all the Beams
>
> TrialList.Current.BeamList.ChildrenEachCurrent.#"@".Script.ExecuteNow = <TestScript>;
>
> TestScript:
>

> IF.TrialList.Current.BeamList.Current.<TestCondition>.THEN.Store.At.Stack.C­reateChild = 1; IF.TrialList.Current.BeamList.Current.<TestCondition>.THEN.Store.At.Stack.L­ast.Name = TrialList.Current.BeamList.Current.Name;


>
> LastStep:
>
> Store.At.Stack.ChildrenEachCurrent.#"@".Script.ExecuteNow = <RemoveScript>;
>
> RemoveScript:
>
> TrialList.Current.BeamList.Current = Store.At.Stack.Current.Name; TrialList.Current.BeamList.Current.Destroy = 1;
>
> Important:
> BeamNames cannot not contain special characters "~!@#$%^&*(){}[]"  and spaces should be replaced with underscore  (courtesy of SOLARIS)
>
> Ernst
>
> ____________________________________
>
> Ernst Lederer RT. (Austria), C.M.D.
> Dosimetrist, Department of Medical Physics
>
> Regional Cancer Centre of the
> Hopital Regional Sudbury Regional Hospital
>
> 41 Ramsey Lake Road
> Sudbury, Ontario P3E 5J1
> Tel: (705) 522-6237 Ext. 2158
> Fax.: (705) 523-7329

> e-mail:     elede...@hrsrh.on.ca

> > ***************************************************************************­*****************************************


>
> > This message may contain confidential information. If you are not the intended recipient please inform the
> > sender that you have received the message in error before deleting it.
> > Please do not disclose, copy or distribute information in this e-mail or take any action in reliance on its contents:
> > to do so is strictly prohibited and may be unlawful.
>
> > Thank you for your co-operation.
>
> > NHSmail is the secure email and directory service available for all NHS staff in England and Scotland
> > NHSmail is approved for exchanging patient data and other sensitive information with NHSmail and GSi recipients
> > NHSmail provides an email address for your career in the NHS and can be accessed anywhere
> > For more information and to find out how you can switch, visitwww.connectingforhealth.nhs.uk/nhsmail
>

> > ***************************************************************************­*****************************************


>
> --
> You received this message because you are subscribed to the Google
> Groups "pinnacle3-users" group.
> To post to this group, send email to pinnacl...@googlegroups.com
> To subscribe to this group, send email to
> pinnacle3-us...@googlegroups.com
> To unsubscribe from this group, send email to
> pinnacle3-use...@googlegroups.com
> For more options, visit this group athttp://groups.google.com/group/pinnacle3-users?hl=en
>

> ************************************************************************
> The information contained in this e-mail and document(s) attached are for
> the exclusive use of the addressee and may contain confidential, privileged
> and non-disclosable information. If the recipient of this e-mail is not the
> addressee, such recipient is strictly prohibited from reading, photocopying,

> distributing or otherwise using this e-mail or its content in any way.- Masquer le texte des messages précédents -
>
> - Afficher le texte des messages précédents -

Carsten Reiffenstuhl

unread,
Dec 10, 2011, 6:04:22 AM12/10/11
to pinnacle3-users
HelloPatrick,

I once had a similar Task, checking if a ROI has contend; My approach
was, to calculate the ROI Statistic, get the volume (as a STRING!!!)
and check, if the STRING is a '?'.

That worked fine...


Carsten Reiffenstuhl

> patrick.del...@gmail.com, pdelage.c...@ssss.gouv.qc.ca

Patrick Delage

unread,
Dec 14, 2011, 1:43:05 PM12/14/11
to pinnacle3-users
Thanks for the answers.

Solved my problem by modifying the IF form to the following:

IF.RoiList.Current.#"!HasCurves".
THEN.Store.At.EmptyROIList.CreateChild = 1;

Becomes:

IF.RoiList.Current.#"!HasCurves".
THEN = {
Store.At.EmptyROIList.CreateChild = 1;
Store.At.EmptyROIList.Last.Name = RoiList.Current.Name;
};

Logically it should have the same outcomes but apperently it doen't...

Patrick

On 10 déc, 06:04, Carsten Reiffenstuhl <cbomba...@googlemail.com>
wrote:

> ...
>
> plus de détails »- Masquer le texte des messages précédents -

Lederer, Ernst

unread,
Dec 16, 2011, 9:05:51 AM12/16/11
to pinnacl...@googlegroups.com
Correct, that works but the parser does not like the combination IF.....THEN = { };

It will do what you are asking it to do, however, it will complain about it. The best thing to do is to watch the CDE Error Log (found in the Tools menu)
That will tell you:
vRoot_ParseConditionlKey: illegal piece "THEN" found in key "THEN"
vRoot_ParseIfThenElse: illegal piece "THEN" found in key "THEN"

in future versions of Pinnacle that might work or not work (can go either way - depending on the developers)

Ernst

____________________________________

Ernst Lederer RT. (Austria), C.M.D.
Dosimetrist, Department of Medical Physics

Regional Cancer Centre of the
Hopital Regional Sudbury Regional Hospital

41 Ramsey Lake Road
Sudbury, Ontario P3E 5J1
Tel: (705) 522-6237 Ext. 2158
Fax.: (705) 523-7329
e-mail: eled...@hrsrh.on.ca

Patrick Delage

unread,
Dec 19, 2011, 9:58:07 AM12/19/11
to pinnacle3-users
Thanks. Just a question, where is the CDE Error log located? I can't
find a Tool menu (in version 8.0m)

Patrick

On 16 déc, 09:05, "Lederer, Ernst" <ELede...@hsnsudbury.ca> wrote:
> Correct, that works but the parser does not like the combination  IF.....THEN = {   };
>
> It will do what you are asking it to do, however, it will complain about it. The best thing to do is to watch the CDE Error Log (found in the Tools menu)
> That will tell you:
> vRoot_ParseConditionlKey: illegal piece "THEN" found in key "THEN"
> vRoot_ParseIfThenElse: illegal piece "THEN" found in key "THEN"
>
> in future versions of Pinnacle that might work or not work (can go either way - depending on the developers)
>
> Ernst
>
> ____________________________________
>
> Ernst Lederer RT. (Austria), C.M.D.
> Dosimetrist, Department of Medical Physics
>
> Regional Cancer Centre of the
> Hopital Regional Sudbury Regional Hospital
>
> 41 Ramsey Lake Road
> Sudbury, Ontario P3E 5J1
> Tel: (705) 522-6237 Ext. 2158
> Fax.: (705) 523-7329

Lederer, Ernst

unread,
Dec 19, 2011, 2:39:13 PM12/19/11
to pinnacl...@googlegroups.com
In the Front panel is an icon "Desktop Controls" (right to the printer). Click on the arrow above - that opens the Tools menu.

____________________________________

Ernst Lederer RT. (Austria), C.M.D.
Dosimetrist, Department of Medical Physics

Regional Cancer Centre of the
Hopital Regional Sudbury Regional Hospital

41 Ramsey Lake Road
Sudbury, Ontario P3E 5J1
Tel: (705) 522-6237 Ext. 2158
Fax.: (705) 523-7329
e-mail: eled...@hrsrh.on.ca
Reply all
Reply to author
Forward
0 new messages