Difference between revisions of "Planning scripts"

From MIPAV
Jump to: navigation, search
(Actions that you can record in scripts include:)
(Methods for creating scripts)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
+
Although MIPAV allows you to easily create scripts, it is important to plan scripts before creating them, particularly if the scripts perform actions on VOIs. First, however, you need to understand:<br />
=== Planning scripts ===
+
*Methods for creating scripts <br />
 
+
*Actions that can be performed in scripts,<br />
<div style="font-style: normal; font-weight: normal; margin-bottom: 6pt; margin-left: 0pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000"> Although MIPAV allows you to easily create scripts, it is important to plan scripts before creating them, particularly if the scripts perform actions on VOIs. First, however, you need to understand:<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 24pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -24pt; text-transform: none; vertical-align: baseline"><font color="#000000">  Methods for creating scripts <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 24pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -24pt; text-transform: none; vertical-align: baseline"><font color="#000000">  Actions that can be performed in scripts,<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 24pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -24pt; text-transform: none; vertical-align: baseline"><font color="#000000">  Use of VOIs in scripts.<br /></font></div>
+
*Use of VOIs in scripts.<br />
  
 
==== Methods for creating scripts ====
 
==== Methods for creating scripts ====
Line 8: Line 8:
 
There are two methods for creating scripts:
 
There are two methods for creating scripts:
  
<div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 24pt; margin-right: 0pt; margin-top: 5pt; text-align: left; text-decoration: none; text-indent: -24pt; text-transform: none; vertical-align: baseline"><font color="#000000">  To create a script using the Scripting toolbar, open an image of interest and simply click the Start Recording Script icon on the Scripting toolbar. See Figure 6. <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000">
+
1 To create a script using the Scripting toolbar, open an image of interest and simply click the Start Recording Script icon on the Scripting toolbar. See Figure 6. <br />
  
 
{| border="1" cellpadding="5"
 
{| border="1" cellpadding="5"
|+ <div style="font-style: normal; margin-bottom: 3pt; margin-left: 0pt; margin-right: 0pt; margin-top: 9pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline">'''<font color="#000000"> Figure 5. The Start Recording Script button<br /></font>'''</div>
+
|+ '''Figure 5. The Start Recording Script button'''
 
|-
 
|-
 
|
 
|
Line 17: Line 17:
 
|}
 
|}
  
<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 24pt; margin-right: 0pt; margin-top: 5pt; text-align: left; text-decoration: none; text-indent: -24pt; text-transform: none; vertical-align: baseline"><font color="#000000">  To create a script using the main MIPAV menu, click Scripts &gt; Record Script in the MIPAV window and simply start recording. See Figure 6.<br /></font></div>
+
2 To create a script using the main MIPAV menu, click Scripts &gt; Record Script in the MIPAV window and simply start recording. See Figure 6.<br />
  
 
For more information, refer to Section "Recording scripts".  
 
For more information, refer to Section "Recording scripts".  
  
 
{| border="1" cellpadding="5"
 
{| border="1" cellpadding="5"
|+ <div style="font-style: normal; margin-bottom: 3pt; margin-left: 0pt; margin-right: 0pt; margin-top: 9pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline">'''<font color="#000000"> Figure 6. The Record Script command available via the Scripts menu <br /></font>'''</div>
+
|+ '''Figure 6. The Record Script command available via the Scripts menu '''
 
|-
 
|-
 
|
 
|
 
[[Image:Script_RecordScriptMenu.png]]
 
[[Image:Script_RecordScriptMenu.png]]
 
|}
 
|}
 
.  <div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000"> <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000"> <br /></font></div>
 
  
 
==== Actions permitted in scripts ====
 
==== Actions permitted in scripts ====
Line 35: Line 33:
  
 
===== Actions that you can record in scripts include: =====
 
===== Actions that you can record in scripts include: =====
 
+
*Saving and closing images
<div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 24pt; margin-right: 0pt; margin-top: 5pt; text-align: left; text-decoration: none; text-indent: -24pt; text-transform: none; vertical-align: baseline"><font color="#000000">  Saving and closing images<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 24pt; margin-right: 0pt; margin-top: 5pt; text-align: left; text-decoration: none; text-indent: -24pt; text-transform: none; vertical-align: baseline"><font color="#000000">  Opening VOIs<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 24pt; margin-right: 0pt; margin-top: 5pt; text-align: left; text-decoration: none; text-indent: -24pt; text-transform: none; vertical-align: baseline"><font color="#000000">  Saving VOIs including the Save all VOIs and Save all VOIs to commands<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 24pt; margin-right: 0pt; margin-top: 5pt; text-align: left; text-decoration: none; text-indent: -24pt; text-transform: none; vertical-align: baseline"><font color="#000000">  Performing algorithms on images or on open VOIs on images[<sup>1</sup>]<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 24pt; margin-right: 0pt; margin-top: 5pt; text-align: left; text-decoration: none; text-indent: -24pt; text-transform: none; vertical-align: baseline"><font color="#000000">  Applying utilities to images or to open VOIs on images<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 24pt; margin-right: 0pt; margin-top: 5pt; text-align: left; text-decoration: none; text-indent: -24pt; text-transform: none; vertical-align: baseline"><font color="#000000">  Saving the global data page in the Output window<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 24pt; margin-right: 0pt; margin-top: 5pt; text-align: left; text-decoration: none; text-indent: -24pt; text-transform: none; vertical-align: baseline"><font color="#000000">  Exiting from the MIPAV program[<sup>2</sup>]<br /></font></div>
+
*Opening VOIs
 +
*Saving VOIs including the Save all VOIs and Save all VOIs to commands
 +
*Performing algorithms on images or on open VOIs on images[<sup>1</sup>]
 +
*Applying utilities to images or to open VOIs on images
 +
*Saving the global data page in the Output window
 +
*Exiting from the MIPAV program[<sup>2</sup>]
  
 
==== Use of VOIs in scripts ====
 
==== Use of VOIs in scripts ====
 
+
The ''only'' VOI commands that can be recorded in scripts are the open VOI commands:<br />
<div style="font-style: normal; font-weight: normal; margin-bottom: 6pt; margin-left: 0pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000"> The <span style="font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline">''<font color="#000000">only</font>''</span> VOI commands that can be recorded in scripts are the open VOI commands:<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 24pt; margin-right: 0pt; margin-top: 5pt; text-align: left; text-decoration: none; text-indent: -24pt; text-transform: none; vertical-align: baseline"><font color="#000000">  VOI &gt; Open VOI<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 24pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -24pt; text-transform: none; vertical-align: baseline"><font color="#000000">  VOI &gt; Open All VOIs<br /></font></div>
+
*VOI &gt; Open VOI<br />
 +
*VOI &gt; Open All VOIs<br />
  
 
MIPAV scripts do not record and save VOIs. Therefore, to apply VOIs to images in scripts, you need to:
 
MIPAV scripts do not record and save VOIs. Therefore, to apply VOIs to images in scripts, you need to:
  
<div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 24pt; margin-right: 0pt; margin-top: 5pt; text-align: left; text-decoration: none; text-indent: -24pt; text-transform: none; vertical-align: baseline"><font color="#000000">  Create and save all VOIs in <span style="font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline">''<font color="#000000">advance</font>''</span> of creating a script;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 24pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -24pt; text-transform: none; vertical-align: baseline"><font color="#000000">  Open and apply the VOIs when you are recording the script.<br /></font></div>
+
Create and save all VOIs in ''advance'' of creating a script;<br />
 +
Open and apply the VOIs when you are recording the script.<br />
  
 
After you've created all necessary VOIs, you can save them through the Save VOI commands available via the VOI menu in the main MIPAV window:
 
After you've created all necessary VOIs, you can save them through the Save VOI commands available via the VOI menu in the main MIPAV window:
  
<div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 24pt; margin-right: 0pt; margin-top: 5pt; text-align: left; text-decoration: none; text-indent: -24pt; text-transform: none; vertical-align: baseline"><font color="#000000">  VOI &gt; Save VOI<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 24pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -24pt; text-transform: none; vertical-align: baseline"><font color="#000000">  VOI &gt; Save VOI as<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 24pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -24pt; text-transform: none; vertical-align: baseline"><font color="#000000">  VOI &gt; Save All VOIs<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 24pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -24pt; text-transform: none; vertical-align: baseline"><font color="#000000">  VOI &gt; Save All VOIs to<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 5pt; margin-left: 0pt; margin-right: 36pt; margin-top: 5pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000"> <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">Caution:</font>'''</span> Do <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">not</font>'''</span> use the Exit command in MIPAV scripts unless you are calling the script from another program or scripts (Perl, C , Windows batch).<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 7pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000"> <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">Tip:</font>'''</span> You might consider to organize your workplace, for example, designate a specific folder(s) for VOIs using in scripts.<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000">
+
VOI &gt; Save VOI<br />
 +
VOI &gt; Save VOI as<br />
 +
VOI &gt; Save All VOIs<br />
 +
VOI &gt; Save All VOIs to<br />
 +
'''Caution:''' Do '''not''' use the Exit command in MIPAV scripts unless you are calling the script from another program or scripts (Perl, C , Windows batch).<br />
 +
'''Tip:''' You might consider to organize your workplace, for example, designate a specific folder(s) for VOIs using in scripts.<br />
  
 
{| border="1" cellpadding="5"
 
{| border="1" cellpadding="5"
Line 57: Line 67:
 
|}
 
|}
  
<br /></font></div>
+
<br />
  
  
 
[[Recording scripts]]
 
[[Recording scripts]]

Latest revision as of 22:09, 21 February 2012

Although MIPAV allows you to easily create scripts, it is important to plan scripts before creating them, particularly if the scripts perform actions on VOIs. First, however, you need to understand:

  • Methods for creating scripts
  • Actions that can be performed in scripts,
  • Use of VOIs in scripts.

Methods for creating scripts

There are two methods for creating scripts:

1 To create a script using the Scripting toolbar, open an image of interest and simply click the Start Recording Script icon on the Scripting toolbar. See Figure 6.

Figure 5. The Start Recording Script button

Script ToolbarRecordScript.png

2 To create a script using the main MIPAV menu, click Scripts > Record Script in the MIPAV window and simply start recording. See Figure 6.

For more information, refer to Section "Recording scripts".

Figure 6. The Record Script command available via the Scripts menu

Script RecordScriptMenu.png

Actions permitted in scripts

It's also important to understand what actions or events you can record in scripts. For example, scripts neither record views, such as lightbox, triplanar, and volume renderer; nor do they record other visualization commands, such as those that adjust the lookup table.

Actions that you can record in scripts include:
  • Saving and closing images
  • Opening VOIs
  • Saving VOIs including the Save all VOIs and Save all VOIs to commands
  • Performing algorithms on images or on open VOIs on images[1]
  • Applying utilities to images or to open VOIs on images
  • Saving the global data page in the Output window
  • Exiting from the MIPAV program[2]

Use of VOIs in scripts

The only VOI commands that can be recorded in scripts are the open VOI commands:

  • VOI > Open VOI
  • VOI > Open All VOIs

MIPAV scripts do not record and save VOIs. Therefore, to apply VOIs to images in scripts, you need to:

Create and save all VOIs in advance of creating a script;
Open and apply the VOIs when you are recording the script.

After you've created all necessary VOIs, you can save them through the Save VOI commands available via the VOI menu in the main MIPAV window:

VOI > Save VOI
VOI > Save VOI as
VOI > Save All VOIs
VOI > Save All VOIs to
Caution: Do not use the Exit command in MIPAV scripts unless you are calling the script from another program or scripts (Perl, C , Windows batch).
Tip: You might consider to organize your workplace, for example, designate a specific folder(s) for VOIs using in scripts.

Saving VOIs: Some Reminders
You can save VOIs under names that MIPAV assigns or under names that you assign. If the VOIs have never been saved before, MIPAV assigns names to VOIs when you use the Save VOI or Save All VOIs commands. The name of the first VOI or set of VOIs that you save is Area1.voi; the second is Area2.voi; and so on.
If you want to specify a different name for the VOI or set of VOIs: select VOI > Save VOI as or VOI > Save All VOIs to. The Save VOI as dialog box opens. Type a name for the VOI in File name and the extension .voi or .xml, and click Save. The program saves the file under the specified name.



Recording scripts