Examples
Contents
Examples:
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:
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:
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:
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")
|
Recording the Fuzzy C-Means > Single Channel algorithm execution:
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,
The script starts running and the intermediate images and progress bars appear on the screen. See Figure 23.
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 "#".
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:
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 [MIPAV_Scripting.html#1320274 Figure 295].
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.
{| align="center" |
|
|}
|
|}
This adds margins to the image clone1, and the following string appears in the Recording Script dialog:
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[#1321322 4]
- "left_side int 20", "right_side int 20", "top_side int 20", "bottom_side int 20" are the image margins, refer to [MIPAV_Scripting.html#1320579 Figure 296]
- "front int 0", "back int 0" indicates that there are no slices added to the front and back of the image, refer to [MIPAV_Scripting.html#1320579 Figure 296]
- "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
|
|}
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:
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''
{| align="center" |
|
|
|- |
|
|
|}
Applying gaussian blur and gradient magnitude
In this example, we want to show you the script that does the following:
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 [MIPAV_Scripting.html#1320274 Figure 295].
See also [MIPAV_Scripting.html#1332721 Figure 299] (Gaussian Blur).
See also [MIPAV_Scripting.html#1332721 Figure 299] (Gradient Magnitude).
{| align="center" |
|
|}