Difference between revisions of "Examples"

From MIPAV
Jump to: navigation, search
(Cloning images, adding margins, and applying gaussian blur)
(Cloning images, adding margins, and applying gaussian blur)
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
=== Examples: ===
 
 
 
==== Applying Face De-Identification, BSE, and Fuzzy C-Means ====
 
==== Applying Face De-Identification, BSE, and Fuzzy C-Means ====
  
 
In this example, we will to show you how to record a script, and then run it in via the Scripting menu. The script includes:
 
In this example, we will to show you how to record a script, and then run it in via the Scripting menu. The script includes:
  
<div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  1 Applying the Face De-Identification algorithm; <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  2 Applying the Extract Brain Surface (BET) algorithm;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  3 And finally, performing brain segmentation using the Fuzzy C-Means &gt; Single Channel algorithm.<br /></font></div><div style="font-style: normal; margin-bottom: 6pt; margin-left: 0pt; margin-right: 0pt; margin-top: 14pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline">'''<font color="#000000"> To start recording the script:<br /></font>'''</div>
+
1 Applying the Face De-Identification algorithm; <br />
 +
2 Applying the Extract Brain Surface (BET) algorithm;<br />
 +
3 And finally, performing brain segmentation using the Fuzzy C-Means &gt; Single Channel algorithm.<br />
  
 
Open an image of interest and then, press Start Recording Script button on the Scripts toolbar. The Record New Script dialog box appears indicating that recording a script is started.
 
Open an image of interest and then, press Start Recording Script button on the Scripts toolbar. The Record New Script dialog box appears indicating that recording a script is started.
  
Recording the Face De-Identification algorithm execution:
+
Recording the Face De-Identification algorithm execution:<br />
 
+
1 Call Algorithms &gt; Brain Tools &gt; Face De-Identification;<br />
<div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  1 Call Algorithms &gt; Brain Tools &gt; Face De-Identification;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  2 The Anonymize Face dialog box opens;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  3 Fill out the dialog box as shown in Figure 19. The right column displays the script text corresponding to the dialog box options;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  4 Press OK to run the algorithm.
+
2 The Anonymize Face dialog box opens;<br />
 +
3 Fill out the dialog box as shown in Figure 19. The right column displays the script text corresponding to the dialog box options;<br />
 +
4 Press OK to run the algorithm.
  
 
{| 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 19. The Anonymize Face dialog box options and the corresponding script text. Here, <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">"face_orientation int 2"</font></span> is an image specific and corresponds to the Left option chosen in the "Which way is the patient's face pointing?" dialog<br /></font>'''</div>
+
|+ '''Figure 19. The Anonymize Face dialog box options and the corresponding script text. Here, <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">"face_orientation int 2"</font></span> is an image specific and corresponds to the Left option chosen in the "Which way is the patient's face pointing?" dialog'''
 
|-
 
|-
 
|
 
|
Line 21: Line 23:
 
<div class="CellBody">FaceAnonymizerBET("input_image_1 ext_image $image1", "face_orientation int 2", "mms_to_delete_from_face int 15", "vertical_deletion_limit_ratio float 0.33", "bet_do_estimate_with_sphere boolean true", "bet_image_influence float 0.01", "bet_stiffness float 0.015")</div>
 
<div class="CellBody">FaceAnonymizerBET("input_image_1 ext_image $image1", "face_orientation int 2", "mms_to_delete_from_face int 15", "vertical_deletion_limit_ratio float 0.33", "bet_do_estimate_with_sphere boolean true", "bet_image_influence float 0.01", "bet_stiffness float 0.015")</div>
 
|}
 
|}
 
<br /></font></div>
 
  
 
After the algorithm finishes running and the result image appears on the screen, make the result image active and call the next Extract Brain Surface (BET) algorithm.
 
After the algorithm finishes running and the result image appears on the screen, make the result image active and call the next Extract Brain Surface (BET) algorithm.
  
 
Recording the BET algorithm execution:
 
Recording the BET algorithm execution:
 +
1 Call Algorithms &gt; Brain Tools &gt; Extract Brain Surface (BET);<br />
 +
2 The Extract Brain dialog box opens;<br />
 +
3 Fill out the dialog box as shown in Figure 20. The right column displays the part of the script corresponding to the dialog box options;<br />
 +
4 Press OK to start the algorithm.<br />
  
<div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  1 Call Algorithms &gt; Brain Tools &gt; Extract Brain Surface (BET);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  2 The Extract Brain dialog box opens;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  3 Fill out the dialog box as shown in Figure 20. The right column displays the part of the script corresponding to the dialog box options;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  4 Press OK to start the algorithm.<br /></font></div>
 
 
<span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000"> </font></span>
 
  
 
{| 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 20. The Extract Brain dialog box options and the corresponding script text. Here, <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">"init_center_point list_float 114.22103,75.82523,94.18212" </font></span>is an image specific<br /></font>'''</div>
+
|+ '''Figure 20. The Extract Brain dialog box options and the corresponding script text. Here, <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">"init_center_point list_float 114.22103,75.82523,94.18212" </font></span>is an image specific'''
 
|-
 
|-
 
|
 
|
Line 41: Line 42:
 
|}
 
|}
  
After the algorithm finishes running and the result image appears on the screen, make the result image active and call the last algorithm - Fuzzy C-Means &gt; Single Channel.  <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>
+
After the algorithm finishes running and the result image appears on the screen, make the result image active and call the last algorithm - Fuzzy C-Means &gt; Single Channel.   
  
Recording the Fuzzy C-Means &gt; Single Channel algorithm execution:
+
Recording the Fuzzy C-Means &gt; Single Channel algorithm execution:<br />
 
+
1 Call Algorithms &gt; Segmentation &gt; Fuzzy C-Means &gt; Single Channel;<br />
<div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  1 Call Algorithms &gt; Segmentation &gt; Fuzzy C-Means &gt; Single Channel;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  2 The Fuzzy C-Means dialog box opens;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  3 Fill out the dialog box as shown in Figure 21. The right column displays the part of the script corresponding to the dialog box options;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  4 Press OK to start the algorithm.<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">
+
2 The Fuzzy C-Means dialog box opens;<br />
 +
3 Fill out the dialog box as shown in Figure 21. The right column displays the part of the script corresponding to the dialog box options;<br />
 +
4 Press OK to start the algorithm.<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 21. The FUzzy C-Means dialog box options and the corresponding script text. Here, <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">"centroids list_float 8318.767,20926.652,33534.54"</font></span> is an image specific<br /></font>'''</div>
+
|+ '''Figure 21. The FUzzy C-Means dialog box options and the corresponding script text. Here, <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">"centroids list_float 8318.767,20926.652,33534.54"</font></span> is an image specific'''
 
|-
 
|-
 
|
 
|
Line 55: Line 58:
 
<div class="CellBody">FuzzyCMeans("input_image_1 image $image1", "number_of_result_images int 4", "do_process_whole_image boolean true", "number_of_classes int 3", "exponent_q float 2.0", "do_crop_background boolean true", "threshold float 0.01", "end_tolerance float 0.01", "max_iterations int 200", "segmentation_type int 0", "centroids list_float 8318.767,20926.652,33534.54")</div>
 
<div class="CellBody">FuzzyCMeans("input_image_1 image $image1", "number_of_result_images int 4", "do_process_whole_image boolean true", "number_of_classes int 3", "exponent_q float 2.0", "do_crop_background boolean true", "threshold float 0.01", "end_tolerance float 0.01", "max_iterations int 200", "segmentation_type int 0", "centroids list_float 8318.767,20926.652,33534.54")</div>
 
|}
 
|}
 
<br /></font></div>
 
  
 
After the algorithm finishes running and the result image appears on the screen, close all intermediate images, and then save the final image.
 
After the algorithm finishes running and the result image appears on the screen, close all intermediate images, and then save the final image.
  
Now, save the script. You might consider to add comments to the script text. In order to do that,
+
Now, save the script. You might consider to add comments to the script text. In order to do that,<br />
 +
1 Click the Insert Comment icon located on the Record New Script dialog box toolbar;<br />
 +
2 The Enter Comment window appears;<br />
 +
3 Type in the comment and press OK;<br />
 +
4 The comment text appears in the Record New Script dialog box;<br />
 +
5 Save the script;<br />
 +
6 Close the dialog box.<br />
  
<div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  1 Click the Insert Comment icon located on the Record New Script dialog box toolbar;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  2 The Enter Comment window appears;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  3 Type in the comment and press OK;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  4 The comment text appears in the Record New Script dialog box;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  5 Save the script;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  6 Close the dialog box.<br /></font></div><div style="font-style: normal; margin-bottom: 6pt; margin-left: 0pt; margin-right: 0pt; margin-top: 14pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline">'''<font color="#000000"> To run the script via the Scripts menu<br /></font>'''</div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1 Call Scripts &gt; Run Script from the main MIPAV menu; <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  2 Select the script you've just recorded, and press OK;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  3 The MIPAV Script Tool dialog box opens;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  4 In the dialog box, use the Add Images from File button to select and add images, on which you wish to run the script, to the Images window;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  5 Then, use the mouse to drug images from the Images window to the Script Execution Setup window. Refer to Figure 22 and "Adding images to the Script Execution Setup";<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  6 Press Run Script.<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">
+
'''To run the script via the Scripts menu'''<br />
 +
1 Call Scripts &gt; Run Script from the main MIPAV menu; <br />
 +
2 Select the script you've just recorded, and press OK;<br />
 +
3 The MIPAV Script Tool dialog box opens;<br />
 +
4 In the dialog box, use the Add Images from File button to select and add images, on which you wish to run the script, to the Images window;<br />
 +
5 Then, use the mouse to drug images from the Images window to the Script Execution Setup window. Refer to Figure 22 and "Adding images to the Script Execution Setup";<br />
 +
6 Press Run Script.<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 22. Adding images to the Images window, first, and then moving the images to the main Script execution Setup window<br /></font>'''</div>
+
|+ '''Figure 22. Adding images to the Images window, first, and then moving the images to the main Script execution Setup window'''
 
|-
 
|-
 
|
 
|
Line 73: Line 86:
  
 
The script starts running and the intermediate images and progress bars appear on the screen. See Figure 23.
 
The script starts running and the intermediate images and progress bars appear on the screen. See Figure 23.
 
<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">
 
  
 
{| 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 23. The script is running in group mode and the intermediate images and progress bars appear on the screen<br /></font>'''</div>
+
|+ '''Figure 23. The script is running in group mode and the intermediate images and progress bars appear on the screen'''
 
|-
 
|-
 
|
 
|
 
[[Image:Script_ExecutionScriptInGroupMode copy.png]]
 
[[Image:Script_ExecutionScriptInGroupMode copy.png]]
 
|}
 
|}
 
 
  
 
When the algorithm finishes running, the progress bars disappear, and the results replace the original and intermediate images.
 
When the algorithm finishes running, the progress bars disappear, and the results replace the original and intermediate images.
Line 95: Line 104:
 
==== Cloning images, adding margins, and applying gaussian blur ====
 
==== Cloning images, adding margins, and applying gaussian blur ====
  
In this example, we will to show you how to record the script that does the following:
+
In this example, we will to show you how to record the script that does the following:<br />
 +
1 Clones an active image;<br />
 +
2 Adds margins to the clone;<br />
 +
3 Applies the Gaussian Blur algorithm to the clone, and produces the second clone;<br />
 +
4 Closes the original image and saves the clones.<br />
  
<div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  1 Clones an active image;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  2 Adds margins to the clone;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  3 Applies the Gaussian Blur algorithm to the clone, and produces the second clone;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  4 Closes the original image and saves the clones.<br /></font></div><div style="font-style: normal; margin-bottom: 6pt; margin-left: 0pt; margin-right: 0pt; margin-top: 14pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline">'''<font color="#000000"> To get started, <br /></font>'''</div>
+
'''To get started,''' <br />
  
 
open an image of interest and then, press Start Recording Script button. The Record New Script dialog box appears indicating that recording a script is started, see Figure 24.
 
open an image of interest and then, press Start Recording Script button. The Record New Script dialog box appears indicating that recording a script is started, see Figure 24.
  
<div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  1 Call the Utilities &gt; Clone (Copy). This clones the active image and the following string appears in the Recording Script dialog:<br /></font></div> <div class="CellBody"> Clone("input_image_1 ext_image $image1")</div>
+
1 Call the Utilities &gt; Clone (Copy). This clones the active image and the following string appears in the Recording Script dialog:<br /></font></div> <div class="CellBody"> Clone("input_image_1 ext_image $image1")</div>
  
 
Here, <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">ext_</font></span> indicates that this image is not produced within the script, but must be selected by a user.
 
Here, <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">ext_</font></span> indicates that this image is not produced within the script, but must be selected by a user.
  
 
Here, the command in the script is <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">Clone</font></span>. This command clones an image which is labeled as <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">$image1</font></span> in the script, and then passes it as <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">input_image_1</font></span> parameter to the <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">Clone</font></span> operator.
 
Here, the command in the script is <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">Clone</font></span>. This command clones an image which is labeled as <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">$image1</font></span> in the script, and then passes it as <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">input_image_1</font></span> parameter to the <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">Clone</font></span> operator.
 
<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">
 
  
 
{| 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 24. The Record New Script dialog box appears indicating that recording a script is started. The initial script (A) and the script with comments (B)<br /></font>'''</div>
+
|+ '''Figure 24. The Record New Script dialog box appears indicating that recording a script is started. The initial script (A) and the script with comments (B)'''
 
|-
 
|-
 
|
 
|
Line 118: Line 129:
 
|}
 
|}
  
<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  2 Now, select the clone image and call Utilities &gt; Add Image Margins. In the Add Image Border dialog box, specify the margins as shown in Figure 25 and press OK.<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">
+
2 Now, select the clone image and call Utilities &gt; Add Image Margins. In the Add Image Border dialog box, specify the margins as shown in Figure 25 and press OK.<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 25. The Add Image Border dialog box options<br /></font>'''</div>
+
|+ '''Figure 25. The Add Image Border dialog box options'''
 
|-
 
|-
 
|
 
|
Line 128: Line 139:
 
<div class="CellBody">In the dialog box:</div> <div class="CellBody">20 points margins are added to the top, bottom, left and right sides of the image</div> <div class="CellBody">The Replace Image option is checked indicating that the modified image will appear in the same frame</div>
 
<div class="CellBody">In the dialog box:</div> <div class="CellBody">20 points margins are added to the top, bottom, left and right sides of the image</div> <div class="CellBody">The Replace Image option is checked indicating that the modified image will appear in the same frame</div>
 
|}
 
|}
 
<br /></font></div>
 
  
 
This adds margins to the image clone1, and the following string appears in the Recording Script dialog:
 
This adds margins to the image clone1, and the following string appears in the Recording Script dialog:
Line 152: Line 161:
 
[[Image:Script_GaussianBlurParameters.png]]
 
[[Image:Script_GaussianBlurParameters.png]]
 
|
 
|
<div class="CellBody">Â </div> <div class="CellBody">For the first time, use the default parameters for Scale of Gaussian, Options, and Color Channel Selection</div> <div class="CellBody">Check the Destination &gt; New Image option</div> <div class="CellBody">Check the Process &gt; Whole Image option</div> <div class="CellBody">Press OK</div>
+
<div class="CellBody"> </div> <div class="CellBody">For the first time, use the default parameters for Scale of Gaussian, Options, and Color Channel Selection</div> <div class="CellBody">Check the Destination &gt; New Image option</div> <div class="CellBody">Check the Process &gt; Whole Image option</div> <div class="CellBody">Press OK</div>
 
|}
 
|}
  
<br /></font></div>
 
  
 
This applies the Gaussian Blur algorithm to the image clone, which now has margins added, and the following string appears in the Recording Script dialog:
 
This applies the Gaussian Blur algorithm to the image clone, which now has margins added, and the following string appears in the Recording Script dialog:
Line 166: Line 174:
 
; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">"do_output_new_image boolean true"</font></span> indicates that the new image appears in a image frame
 
; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">"do_output_new_image boolean true"</font></span> indicates that the new image appears in a image frame
 
; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">"do_process_whole_image boolean true"</font></span> indicates that the algorithm is applied to the whole image (not only to VOI regions)
 
; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">"do_process_whole_image boolean true"</font></span> indicates that the algorithm is applied to the whole image (not only to VOI regions)
; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">"do_separable_convolution boolean true"</font></span><nowiki> corresponds to checking the Use Separable Convolution Kernels option in the dialog box. For more information, refer to Volume 2 Algorithms, Section "Applying the Gaussian Blur algorithm".
+
; <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">"do_separable_convolution boolean true"</font></span> corresponds to checking the Use Separable Convolution Kernels option in the dialog box. For more information, refer to Volume 2 Algorithms, Section "Applying the Gaussian Blur algorithm". < br />
  
 
See Figure 27.<br />
 
See Figure 27.<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 27. The original image (A), the first clone after applying margins (B), and the second clone (C) after applying Gaussian Blur<br /></font>'''</div>
+
|+ '''Figure 27. The original image (A), the first clone after applying margins (B), and the second clone (C) after applying Gaussian Blur'''
 
|-
 
|-
 
|
 
|
Line 187: Line 195:
 
<div class="CellBody">C</div>
 
<div class="CellBody">C</div>
 
|}
 
|}
 
+
5 Now, you can close the original image. And the following string appears in the script: <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">CloseFrame("input_image_1 image $image1")</font></span> indicating that the image frame has been closed. <br /><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  6 You might save last two images. In order to do that, select the image frame, and then call File &gt; Save Image As from the main MIPAV menu. The image will be saved in specified format in the chosen location. The following strings appears in the script: <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">SaveImageAs("input_image_1 image $image2", "file_type string .mnc")</font></span> indicating that the image has been saved as a MINC file.[<sup>5</sup>]<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  7 To save the script, click File &gt; Save. The program saves the script in the scripts home directory.<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  8 You might add the comments in the script. In order to do that, press the Insert Comment button, and enter the comment in the dialog box that appears. Add as many comments as needed. Then, save the script. <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  9 Click File &gt; Exit to close the Record New Script dialog box. The dialog box closes. You should now be able to select and run the script from the Current Script box. <br />
<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  5 Now, you can close the original image. And the following string appears in the script: <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">CloseFrame("input_image_1 image $image1")</font></span> indicating that the image frame has been closed. <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  6 You might save last two images. In order to do that, select the image frame, and then call File &gt; Save Image As from the main MIPAV menu. The image will be saved in specified format in the chosen location. The following strings appears in the script: <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">SaveImageAs("input_image_1 image $image2", "file_type string .mnc")</font></span> indicating that the image has been saved as a MINC file.[#1342250 <sup>5</sup>]<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  7 To save the script, click File &gt; Save. The program saves the script in the scripts home directory.<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  8 You might add the comments in the script. In order to do that, press the Insert Comment button, and enter the comment in the dialog box that appears. Add as many comments as needed. Then, save the script. <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  9 Click File &gt; Exit to close the Record New Script dialog box. The dialog box closes. You should now be able to select and run the script from the Current Script box. <br />
+
 
+
  
 
==== Applying gaussian blur and gradient magnitude ====
 
==== Applying gaussian blur and gradient magnitude ====
  
In this example, we want to show you the script that does the following:
+
In this example, we want to show you the script that does the following:<br />
 
+
1 Clones an image;<br />
<div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  1 Clones an image;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  2 Apples Gaussian Blur to the clone;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  3 Saves the clone;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  4 Then, applies Gradient Magnitude to the saved clone;<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  5 Saves the result.<br /></font></div><div style="font-style: normal; margin-bottom: 6pt; margin-left: 0pt; margin-right: 0pt; margin-top: 14pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline">'''<font color="#000000"> To get started, <br /></font>'''</div>
+
2 Apples Gaussian Blur to the clone;<br />
 +
3 Saves the clone;<br />
 +
4 Then, applies Gradient Magnitude to the saved clone;<br />
 +
5 Saves the result.<br />
  
 +
'''To get started,''' <br />
 
open an image of interest and then, press the Start Recording Script button. The Record New Script dialog box appears indicating that recording a script is started. Refer to Figure 24.
 
open an image of interest and then, press the Start Recording Script button. The Record New Script dialog box appears indicating that recording a script is started. Refer to Figure 24.
  
Line 210: Line 220:
  
 
{| 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 28. The Gaussian Blur and Gradient Magnitude parameters which were used to record the script<br /></font>'''</div>
+
|+ '''Figure 28. The Gaussian Blur and Gradient Magnitude parameters which were used to record the script'''
 
|-
 
|-
 
|
 
|
Line 226: Line 236:
  
 
In this example, we want to show you how to record the script which includes:
 
In this example, we want to show you how to record the script which includes:
 
+
1 Delineating a VOI on the opened image <br />
<div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  1 Delineating a VOI on the opened image <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  2 Extracting a surface from the VOI<br /></font></div>
+
2 Extracting a surface from the VOI<br />
  
 
Please, remember that to apply VOIs to images in scripts, you need to create and save the 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, and then, open and apply the VOIs while you are recording the script. In this example, we will use the VOI which helps extract the cerebellum from the brain image. See Figure 29.
 
Please, remember that to apply VOIs to images in scripts, you need to create and save the 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, and then, open and apply the VOIs while you are recording the script. In this example, we will use the VOI which helps extract the cerebellum from the brain image. See Figure 29.
  
 
{| 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 29. The Cerebellum VOI is delineated on the image<br /></font>'''</div>
+
|+ '''Figure 29. The Cerebellum VOI is delineated on the image'''
 
|-
 
|-
 
|
 
|
Line 248: Line 258:
 
Here, the command in the script is <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">OpenVOI(parameters)</font></span><nowiki>; in other words, apply a VOI to </nowiki><span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">$image1</font></span>, which is listed in the parameters list with a label <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">input_image_1.</font></span>
 
Here, the command in the script is <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">OpenVOI(parameters)</font></span><nowiki>; in other words, apply a VOI to </nowiki><span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">$image1</font></span>, which is listed in the parameters list with a label <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">input_image_1.</font></span>
  
<div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  2 Now, select the VOI and then call Algorithms &gt; Extract Surface (marching cubes). <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  3 In the Extract Surface dialog box that appears, specify the algorithm parameters as shown in [MIPAV_Scripting.html#1333077 Figure 301], then press OK.<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  4 The following string appears in the Record New Script dialog box:<br /></font></div> <div class="CellBody">ExtractSurfaceCubes("input_image_1 image $image1", "extraction_type string VOI", "do_decimate boolean true", "file_name string brain.sur", "do_blur_before_extraction boolean false", "blur_std_dev float 0.5")</div>
+
2 Now, select the VOI and then call Algorithms &gt; Extract Surface (marching cubes). <br />
 +
3 In the Extract Surface dialog box that appears, specify the algorithm parameters as shown in Figure 30, then press OK.<br />
 +
4 The following string appears in the Record New Script dialog box:<br />
 +
<div class="CellBody">ExtractSurfaceCubes("input_image_1 image $image1", "extraction_type string VOI", "do_decimate boolean true", "file_name string brain.sur", "do_blur_before_extraction boolean false", "blur_std_dev float 0.5")</div>
  
 
Here, the command in the script is <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">ExtractSurfaceCubes(parameter</font></span><span style="font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline">''<font color="#000000">1</font>''</span><span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">,..parameter</font></span><span style="font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline">''<font color="#000000">N</font>''</span><span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">)</font></span>. The parameters are as follows:
 
Here, the command in the script is <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">ExtractSurfaceCubes(parameter</font></span><span style="font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline">''<font color="#000000">1</font>''</span><span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">,..parameter</font></span><span style="font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline">''<font color="#000000">N</font>''</span><span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">)</font></span>. The parameters are as follows:
Line 262: Line 275:
  
 
{| 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 30. The Extract Surface dialog box<br /></font>'''</div>
+
|+ '''Figure 30. The Extract Surface dialog box'''
 
|-
 
|-
 
|
 
|
 
[[Image:Script_ExtractSurfaceParam.png]]
 
[[Image:Script_ExtractSurfaceParam.png]]
 
|
 
|
<div class="CellBody">Â </div> <div class="CellBody">Check the VOI Region checkbox;</div> <div class="CellBody">Check the Decimate Surface parameter;</div> <div class="CellBody">Do not check the Blur by checkbox;</div> <div class="CellBody">Enter the surface file name;</div> <div class="CellBody">Press OK.</div>
+
<div class="CellBody"> </div> <div class="CellBody">Check the VOI Region checkbox;</div> <div class="CellBody">Check the Decimate Surface parameter;</div> <div class="CellBody">Do not check the Blur by checkbox;</div> <div class="CellBody">Enter the surface file name;</div> <div class="CellBody">Press OK.</div>
 
|}
 
|}
  
Line 274: Line 287:
 
==== Examples of working scripts ====
 
==== Examples of working scripts ====
  
Below are the summary of the scripts that were used as examples in Section [MIPAV_Scripting.html#1318075 "Examples:" on page 456]. Comments using in the scripts are shown as <span style="font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline">''<font color="#000000"><nowiki>#comment</nowiki></font>''</span>.
+
Below are the summary of the scripts that were used as examples in Section "Examples:". Comments using in the scripts are shown as <span style="font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline">''<font color="#000000"><nowiki>#comment</nowiki></font>''</span>.
  
 
<div style="font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 12pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline">''<font color="#000000"> Script: Cloning an image, then adding margins and applying Gaussian Blur to the clone<br /></font>''</div><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"> <br /></font></div> <div class="CellBody"><nowiki>#Clone an image</nowiki></div> <div class="CellBody">Clone("input_image_1 ext_image $image1")</div> <div class="CellBody"><nowiki>#Add margins to the clone - $image1</nowiki></div> <div class="CellBody">AddMargins("input_image_1 image $image2", "do_output_new_image boolean false", "left_side int 20", "right_side int 20", "top_side int 20", "bottom_side int 20", "front int 0", "back int 0", "margin_value double -5213.51513671875", "margin_value_rgb list_double 0.0,0.0,0.0")</div> <div class="CellBody"><nowiki>#Apply GB and create a new clone - $image2</nowiki></div> <div class="CellBody">GaussianBlur("input_image_1 image $image2", "do_output_new_image boolean true", "do_process_whole_image boolean true", "do_process_in_2.5D boolean false", "do_separable_convolution boolean true", "gauss_std_dev list_float 1.0,1.0,1.0", "gauss_do_z_resolution_correction boolean true", "do_process_r_g_b_channel list_boolean false,false,false")</div> <div class="CellBody"><nowiki>#Close the original image</nowiki></div> <div class="CellBody">CloseFrame("input_image_1 image $image1")</div> <div class="CellBody"><nowiki>#Save the clone 2 - $image2</nowiki></div> <div class="CellBody">SaveImageAs("input_image_1 image $image2", "file_type string .mnc")</div><div style="font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 12pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline">''<font color="#000000"> Script: Flipping an image twice<br /></font>''</div><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"> <br /></font></div> <div class="CellBody"><nowiki>#Flip the image vertically</nowiki></div> <div class="CellBody">Flip("input_image_1 ext_image $image1", "flip_axis string X")</div> <div class="CellBody"><nowiki>#Flip the result image horizontally</nowiki></div> <div class="CellBody">Flip("input_image_1 image $image1", "flip_axis string Y")</div> <div class="CellBody"><nowiki>#Save the result </nowiki></div> <div class="CellBody">SaveImageAs("input_image_1 ext_image $image1", "file_type string .mnc")</div><div style="font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 12pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline">''<font color="#000000"> Script: Applying Gaussian Blur and then Gradient Magnitude<br /></font>''</div>
 
<div style="font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 12pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline">''<font color="#000000"> Script: Cloning an image, then adding margins and applying Gaussian Blur to the clone<br /></font>''</div><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"> <br /></font></div> <div class="CellBody"><nowiki>#Clone an image</nowiki></div> <div class="CellBody">Clone("input_image_1 ext_image $image1")</div> <div class="CellBody"><nowiki>#Add margins to the clone - $image1</nowiki></div> <div class="CellBody">AddMargins("input_image_1 image $image2", "do_output_new_image boolean false", "left_side int 20", "right_side int 20", "top_side int 20", "bottom_side int 20", "front int 0", "back int 0", "margin_value double -5213.51513671875", "margin_value_rgb list_double 0.0,0.0,0.0")</div> <div class="CellBody"><nowiki>#Apply GB and create a new clone - $image2</nowiki></div> <div class="CellBody">GaussianBlur("input_image_1 image $image2", "do_output_new_image boolean true", "do_process_whole_image boolean true", "do_process_in_2.5D boolean false", "do_separable_convolution boolean true", "gauss_std_dev list_float 1.0,1.0,1.0", "gauss_do_z_resolution_correction boolean true", "do_process_r_g_b_channel list_boolean false,false,false")</div> <div class="CellBody"><nowiki>#Close the original image</nowiki></div> <div class="CellBody">CloseFrame("input_image_1 image $image1")</div> <div class="CellBody"><nowiki>#Save the clone 2 - $image2</nowiki></div> <div class="CellBody">SaveImageAs("input_image_1 image $image2", "file_type string .mnc")</div><div style="font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 12pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline">''<font color="#000000"> Script: Flipping an image twice<br /></font>''</div><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"> <br /></font></div> <div class="CellBody"><nowiki>#Flip the image vertically</nowiki></div> <div class="CellBody">Flip("input_image_1 ext_image $image1", "flip_axis string X")</div> <div class="CellBody"><nowiki>#Flip the result image horizontally</nowiki></div> <div class="CellBody">Flip("input_image_1 image $image1", "flip_axis string Y")</div> <div class="CellBody"><nowiki>#Save the result </nowiki></div> <div class="CellBody">SaveImageAs("input_image_1 ext_image $image1", "file_type string .mnc")</div><div style="font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 12pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline">''<font color="#000000"> Script: Applying Gaussian Blur and then Gradient Magnitude<br /></font>''</div>

Latest revision as of 21:04, 22 February 2012

Applying Face De-Identification, BSE, and Fuzzy C-Means

In this example, we will to show you how to record a script, and then run it in via the Scripting menu. The script includes:

1 Applying the Face De-Identification algorithm;
2 Applying the Extract Brain Surface (BET) algorithm;
3 And finally, performing brain segmentation using the Fuzzy C-Means > Single Channel algorithm.

Open an image of interest and then, press Start Recording Script button on the Scripts toolbar. The Record New Script dialog box appears indicating that recording a script is started.

Recording the Face De-Identification algorithm execution:
1 Call Algorithms > Brain Tools > Face De-Identification;
2 The Anonymize Face dialog box opens;
3 Fill out the dialog box as shown in Figure 19. The right column displays the script text corresponding to the dialog box options;
4 Press OK to run the algorithm.

Figure 19. The Anonymize Face dialog box options and the corresponding script text. Here, "face_orientation int 2" is an image specific and corresponds to the Left option chosen in the "Which way is the patient's face pointing?" dialog

Script AnonymizeFace.png

FaceAnonymizerBET("input_image_1 ext_image $image1", "face_orientation int 2", "mms_to_delete_from_face int 15", "vertical_deletion_limit_ratio float 0.33", "bet_do_estimate_with_sphere boolean true", "bet_image_influence float 0.01", "bet_stiffness float 0.015")

After the algorithm finishes running and the result image appears on the screen, make the result image active and call the next Extract Brain Surface (BET) algorithm.

Recording the BET algorithm execution: 1 Call Algorithms > Brain Tools > Extract Brain Surface (BET);
2 The Extract Brain dialog box opens;
3 Fill out the dialog box as shown in Figure 20. The right column displays the part of the script corresponding to the dialog box options;
4 Press OK to start the algorithm.


Figure 20. The Extract Brain dialog box options and the corresponding script text. Here, "init_center_point list_float 114.22103,75.82523,94.18212" is an image specific

File:Script BET DialogBox12.gif

ExtractBrain("input_image_1 image $image1", "orientation_type int 0", "do_use_sphere_estimation boolean false", "do_show_just_init_ellipse boolean false", "num_iterations int 100", "depth int 11", "image_ratio float 0.2", "stiffness float 0.15", "do_second_stage_erosion boolean false", "factor_above_median_to_erode float 0.0", "do_extract_paint boolean false", "do_init_with_center_of_mass boolean true", "init_center_point list_float 114.22103,75.82523,94.18212")

After the algorithm finishes running and the result image appears on the screen, make the result image active and call the last algorithm - Fuzzy C-Means > Single Channel.

Recording the Fuzzy C-Means > Single Channel algorithm execution:
1 Call Algorithms > Segmentation > Fuzzy C-Means > Single Channel;
2 The Fuzzy C-Means dialog box opens;
3 Fill out the dialog box as shown in Figure 21. The right column displays the part of the script corresponding to the dialog box options;
4 Press OK to start the algorithm.

Figure 21. The FUzzy C-Means dialog box options and the corresponding script text. Here, "centroids list_float 8318.767,20926.652,33534.54" is an image specific

Scripting FuzzyC-Means.png

FuzzyCMeans("input_image_1 image $image1", "number_of_result_images int 4", "do_process_whole_image boolean true", "number_of_classes int 3", "exponent_q float 2.0", "do_crop_background boolean true", "threshold float 0.01", "end_tolerance float 0.01", "max_iterations int 200", "segmentation_type int 0", "centroids list_float 8318.767,20926.652,33534.54")

After the algorithm finishes running and the result image appears on the screen, close all intermediate images, and then save the final image.

Now, save the script. You might consider to add comments to the script text. In order to do that,
1 Click the Insert Comment icon located on the Record New Script dialog box toolbar;
2 The Enter Comment window appears;
3 Type in the comment and press OK;
4 The comment text appears in the Record New Script dialog box;
5 Save the script;
6 Close the dialog box.

To run the script via the Scripts menu
1 Call Scripts > Run Script from the main MIPAV menu;
2 Select the script you've just recorded, and press OK;
3 The MIPAV Script Tool dialog box opens;
4 In the dialog box, use the Add Images from File button to select and add images, on which you wish to run the script, to the Images window;
5 Then, use the mouse to drug images from the Images window to the Script Execution Setup window. Refer to Figure 22 and "Adding images to the Script Execution Setup";
6 Press Run Script.

Figure 22. Adding images to the Images window, first, and then moving the images to the main Script execution Setup window

Script AddingFilesToGroupMode.png


The script starts running and the intermediate images and progress bars appear on the screen. See Figure 23.

Figure 23. The script is running in group mode and the intermediate images and progress bars appear on the screen

Script ExecutionScriptInGroupMode copy.png

When the algorithm finishes running, the progress bars disappear, and the results replace the original and intermediate images.

Script

The script text is shown below. Note that the comment strings included in the script start with "#".

# First Face De-Identification
FaceAnonymizerBET("input_image_1 ext_image $image1", "face_orientation int 2", "mms_to_delete_from_face int 15", "vertical_deletion_limit_ratio float 0.33", "bet_do_estimate_with_sphere boolean true", "bet_image_influence float 0.01", "bet_stiffness float 0.015")
#Here, "face_orientation int 2" is an image specific.
# Second BET
ExtractBrain("input_image_1 image $image1", "orientation_type int 0", "do_use_sphere_estimation boolean false", "do_show_just_init_ellipse boolean false", "num_iterations int 100", "depth int 11", "image_ratio float 0.2", "stiffness float 0.15", "do_second_stage_erosion boolean false", "factor_above_median_to_erode float 0.0", "do_extract_paint boolean false", "do_init_with_center_of_mass boolean true", "init_center_point list_float 114.22103,75.82523,94.18212")
#Here, "init_center_point list_float 114.22103,75.82523,94.18212" is an image specific.
# Third Fuzzy C-Means
FuzzyCMeans("input_image_1 image $image1", "number_of_result_images int 4", "do_process_whole_image boolean true", "number_of_classes int 3", "exponent_q float 2.0", "do_crop_background boolean true", "threshold float 0.01", "end_tolerance float 0.01", "max_iterations int 200", "segmentation_type int 0", "centroids list_float 8318.767,20926.652,33534.54")
#Here, "centroids list_float 8318.767,20926.652,33534.54" is an image specific.
#Closing intermediate images
CloseFrame("input_image_1 image $image4")
CloseFrame("input_image_1 image $image3")
CloseFrame("input_image_1 image $image2")
#Saving results
SaveImageAs("input_image_1 image $image5", "file_type string .xml")

Cloning images, adding margins, and applying gaussian blur

In this example, we will to show you how to record the script that does the following:
1 Clones an active image;
2 Adds margins to the clone;
3 Applies the Gaussian Blur algorithm to the clone, and produces the second clone;
4 Closes the original image and saves the clones.

To get started,

open an image of interest and then, press Start Recording Script button. The Record New Script dialog box appears indicating that recording a script is started, see Figure 24.

1 Call the Utilities > Clone (Copy). This clones the active image and the following string appears in the Recording Script dialog:
</font></div>
Clone("input_image_1 ext_image $image1")

Here, ext_ indicates that this image is not produced within the script, but must be selected by a user.

Here, the command in the script is Clone. This command clones an image which is labeled as $image1 in the script, and then passes it as input_image_1 parameter to the Clone operator.

Figure 24. The Record New Script dialog box appears indicating that recording a script is started. The initial script (A) and the script with comments (B)

Script RecordScript2.png

Script ScriptwithComments.png

2 Now, select the clone image and call Utilities > Add Image Margins. In the Add Image Border dialog box, specify the margins as shown in Figure 25 and press OK.

Figure 25. The Add Image Border dialog box options

Script AddImageBorder.png

In the dialog box:
20 points margins are added to the top, bottom, left and right sides of the image
The Replace Image option is checked indicating that the modified image will appear in the same frame

This adds margins to the image clone1, and the following string appears in the Recording Script dialog:

AddMargins("input_image_1 image $image2", "do_output_new_image boolean false", "left_side int 20", "right_side int 20", "top_side int 20", "bottom_side int 20", "front int 0", "back int 0", "margin_value double -5213.51513671875", "margin_value_rgb list_double 0.0,0.0,0.0")

Here, the command in the script is AddMargins(parameter1,...parameterN). Script parameters are as follows:

"input_image_1 image $image2" shows that the script applies to the active image clone
"do_output_new_image boolean false" indicates that the new image (with margins) appears in the same image frame replacing the old one[4]
"left_side int 20", "right_side int 20", "top_side int 20", "bottom_side int 20" are the image margins, refer to Figure 25
"front int 0", "back int 0" indicates that there are no slices added to the front and back of the image, refer to Figure 25
"margin_value double -5213.51513671875" - the margin fill value for grayscale images
"margin_value_rgb list_double 0.0,0.0,0.0" - the margin fill value for RGB images
3 Select the clone image with margins and call Algorithms > Filters (spatial) > Gaussian Blur. In the Gaussian Blur dialog box that appears, specify the parameters as shown in Figure 28 and press OK.
Figure 26. The Gaussian Blur dialog box

Script GaussianBlurParameters.png

For the first time, use the default parameters for Scale of Gaussian, Options, and Color Channel Selection
Check the Destination > New Image option
Check the Process > Whole Image option
Press OK


This applies the Gaussian Blur algorithm to the image clone, which now has margins added, and the following string appears in the Recording Script dialog:

GaussianBlur("input_image_1 image $image2", "do_output_new_image boolean true", "do_process_whole_image boolean true", "do_process_in_2.5D boolean false", "do_separable_convolution boolean true", "gauss_std_dev list_float 1.0,1.0,1.0", "gauss_do_z_resolution_correction boolean true", "do_process_r_g_b_channel list_boolean false,false,false")

Here, the command in the script is GaussianBlur(parameter1,...parameterN). The parameters are as follows:

"input_image_1 image $image2" shows that the script applies to the image clone
"do_output_new_image boolean true" indicates that the new image appears in a image frame
"do_process_whole_image boolean true" indicates that the algorithm is applied to the whole image (not only to VOI regions)
"do_separable_convolution boolean true" corresponds to checking the Use Separable Convolution Kernels option in the dialog box. For more information, refer to Volume 2 Algorithms, Section "Applying the Gaussian Blur algorithm". < br />

See Figure 27.

Figure 27. The original image (A), the first clone after applying margins (B), and the second clone (C) after applying Gaussian Blur

File:ScriptingImage146.gif

File:ScriptingClone147.gif

ScriptingClone2.png

A
B
C
5 Now, you can close the original image. And the following string appears in the script: CloseFrame("input_image_1 image $image1") indicating that the image frame has been closed.
6 You might save last two images. In order to do that, select the image frame, and then call File > Save Image As from the main MIPAV menu. The image will be saved in specified format in the chosen location. The following strings appears in the script: SaveImageAs("input_image_1 image $image2", "file_type string .mnc") indicating that the image has been saved as a MINC file.[5]
7 To save the script, click File > Save. The program saves the script in the scripts home directory.
8 You might add the comments in the script. In order to do that, press the Insert Comment button, and enter the comment in the dialog box that appears. Add as many comments as needed. Then, save the script.
9 Click File > Exit to close the Record New Script dialog box. The dialog box closes. You should now be able to select and run the script from the Current Script box.

Applying gaussian blur and gradient magnitude

In this example, we want to show you the script that does the following:
1 Clones an image;
2 Apples Gaussian Blur to the clone;
3 Saves the clone;
4 Then, applies Gradient Magnitude to the saved clone;
5 Saves the result.

To get started,
open an image of interest and then, press the Start Recording Script button. The Record New Script dialog box appears indicating that recording a script is started. Refer to Figure 24.

1 Call the Utilities > Clone (Copy). This clones the active image and the following string appears in the Recording Script dialog box:
Clone("input_image_1 ext_image $image1")
2 Apply the Gaussian Blur algorithm to the clone. The following string appears in the Recording Script dialog box:
GaussianBlur("input_image_1 image $image2", "do_output_new_image boolean true", "do_process_whole_image boolean true", "do_process_in_2.5D boolean false", "do_separable_convolution boolean true", "gauss_std_dev list_float 1.1,1.1,1.1", "gauss_do_z_resolution_correction boolean true", "do_process_r_g_b_channel list_boolean false,false,false")

See also Figure 28 (Gaussian Blur).

3 Now, save the image which appears after applying Gaussian Blur. Use either File > Save Image or File > Save Image As option. The following string appears in the Recording Script dialog box:
SaveImageAs("input_image_1 image $image3", "file_type string .mnc")
4 Apply the Gradent Magnitude algorithm to the same image. The following string appears in the Recording Script dialog box:
GradientMagnitude("input_image_1 image $image3", "do_output_new_image boolean true", "do_process_whole_image boolean true", "do_process_in_2.5D boolean false", "do_separable_convolution boolean true", "gauss_std_dev list_float 1.0,1.0,1.0", "gauss_do_z_resolution_correction boolean true", "do_process_r_g_b_channel list_boolean false,false,false")

See also Figure 28 (Gradient Magnitude).

5 Save the image using the Save Image As option. The following string appears in the Recording Script dialog box:
SaveImageAs("input_image_1 image $image4", "file_type string .mnc")
6 Save the script, and then close the Recording Script dialog box. You should now be able to select and run the script from the Current Script box. If the script doesn't appear under Current Script, click the Refresh Script Listing icon and try again.
Figure 28. The Gaussian Blur and Gradient Magnitude parameters which were used to record the script

Script GaussianBlurParameters2.png

Script GradientMagnitudeParameters.png


Figure 28 shows the options selected for the Gaussian Blur and Gradient Magnitude algorithms. You might consider to compare the parametes chosen in the dialog boxes with the corresponding text of the script as it shown in step 2 and step 4.

Tip: If the script doesn't appear under Current Script, click the Refresh Script Listing icon and try again.

Extracting a surface from a VOI

In this example, we want to show you how to record the script which includes: 1 Delineating a VOI on the opened image
2 Extracting a surface from the VOI

Please, remember that to apply VOIs to images in scripts, you need to create and save the VOIs in advance of creating a script, and then, open and apply the VOIs while you are recording the script. In this example, we will use the VOI which helps extract the cerebellum from the brain image. See Figure 29.

Figure 29. The Cerebellum VOI is delineated on the image

Script BrainCerebellumVOI.png

To delineate the VOI on the image, use the Draw Polygon/Polyline VOI tool from the MIPAV toolbar. After you've created the VOI, save it through the VOI >Save VOI command.
To record the script

Open an image of interest and then, press Start Recording Script button. The Record New Script dialog box appears indicating that recording a script is started.

1 Call the VOI > Open VOI menu, and then select the VOI file. The following string appears in the Record New Script dialog box:
OpenVOI("input_image_1 ext_image $image1")

Here, the command in the script is OpenVOI(parameters); in other words, apply a VOI to $image1, which is listed in the parameters list with a label input_image_1.

2 Now, select the VOI and then call Algorithms > Extract Surface (marching cubes).
3 In the Extract Surface dialog box that appears, specify the algorithm parameters as shown in Figure 30, then press OK.
4 The following string appears in the Record New Script dialog box:

ExtractSurfaceCubes("input_image_1 image $image1", "extraction_type string VOI", "do_decimate boolean true", "file_name string brain.sur", "do_blur_before_extraction boolean false", "blur_std_dev float 0.5")

Here, the command in the script is ExtractSurfaceCubes(parameter1,..parameterN). The parameters are as follows:

"input_image_1 image $image1" indicates that the script is applying to the image
"extraction_type string VOI" corresponds to selecting the VOI region option in the dialog box and indicates that the algorithm is applied only to the image region bounded by the VOI
"do_decimate boolean true" corresponds to checking the Decimate Surface parameter in the dialog box
"file_name string brain.sur" indicates that the extracted surface will be saved as the brain.sur file
"do_blur_before_extraction boolean false" - shows that there is no blurring will be applying to the image before extraction. This corresponds to not checking the Blur by (Std.Dev.) checkbox
"blur_std_dev float 0.5" - the default value for the Blur by (Std.Dev.) parameter. It is only used if the above parameter is set to true
Figure 30. The Extract Surface dialog box

Script ExtractSurfaceParam.png

Check the VOI Region checkbox;
Check the Decimate Surface parameter;
Do not check the Blur by checkbox;
Enter the surface file name;
Press OK.

5 Now, click File > Save. The program saves the script in the scripts home directory.
6 Click File > Exit to close the Record New Script dialog box. The dialog box closes. You should now be able to select and run the script from the Current Script box. If the script name doesn't appear in Current Script, press Refresh to reload the scripts home directory.
Tip: The file extension for the script file is ".sct." Make sure that you type this extension at the end of the file name.

Examples of working scripts

Below are the summary of the scripts that were used as examples in Section "Examples:". Comments using in the scripts are shown as #comment.

Script: Cloning an image, then adding margins and applying Gaussian Blur to the clone

#Clone an image
Clone("input_image_1 ext_image $image1")
#Add margins to the clone - $image1
AddMargins("input_image_1 image $image2", "do_output_new_image boolean false", "left_side int 20", "right_side int 20", "top_side int 20", "bottom_side int 20", "front int 0", "back int 0", "margin_value double -5213.51513671875", "margin_value_rgb list_double 0.0,0.0,0.0")
#Apply GB and create a new clone - $image2
GaussianBlur("input_image_1 image $image2", "do_output_new_image boolean true", "do_process_whole_image boolean true", "do_process_in_2.5D boolean false", "do_separable_convolution boolean true", "gauss_std_dev list_float 1.0,1.0,1.0", "gauss_do_z_resolution_correction boolean true", "do_process_r_g_b_channel list_boolean false,false,false")
#Close the original image
CloseFrame("input_image_1 image $image1")
#Save the clone 2 - $image2
SaveImageAs("input_image_1 image $image2", "file_type string .mnc")
Script: Flipping an image twice

#Flip the image vertically
Flip("input_image_1 ext_image $image1", "flip_axis string X")
#Flip the result image horizontally
Flip("input_image_1 image $image1", "flip_axis string Y")
#Save the result
SaveImageAs("input_image_1 ext_image $image1", "file_type string .mnc")
Script: Applying Gaussian Blur and then Gradient Magnitude
#Applying Gaussian Blur and sending output to as a new image frame - $image2
GaussianBlur("input_image_1 ext_image $image1", "do_output_new_image boolean true", "do_process_whole_image boolean true", "do_process_in_2.5D boolean false", "do_separable_convolution boolean true", "gauss_std_dev list_float 1.0,1.0,1.0", "gauss_do_z_resolution_correction boolean true", "do_process_r_g_b_channel list_boolean false,false,false")
#Applying Gradient Magnitude to $image2 and sending output to as a new image frame -$image3
GradientMagnitude("input_image_1 image $image2", "do_output_new_image boolean true", "do_process_whole_image boolean true", "do_process_in_2.5D boolean false", "do_separable_convolution boolean true", "gauss_std_dev list_float 1.0,1.0,1.0", "gauss_do_z_resolution_correction boolean true", "do_process_r_g_b_channel list_boolean false,false,false")


Combining scripts and other programs