Keywords: front-page

## Lab: Mask Application

[Exercises] [Workspace]

Purpose: The purpose of this lab exercise is to demonstrate uses of the data object validity mask. In this exercise, you will add a validity mask to an image, and then calculate the statistics of that image. The validity mask will cause the statistics calculation to be performed using valid image data points only.

Activities:

1. Read the image $DIP/data/echo.kdf and display it using the operators "User defined" and Display Image.

   1. Glyphs:Input/Output:Data Files:User defined
   2. Glyphs:Visualization:Non-Interactive Display:Display Image

2. Compute the statistics of the image using the Statistics operator.

   1. Glyphs:Data Manip:Analysis & Information:Statistics
   2. Glyphs:Input/Output:Information:File Viewer

3. Read the image $DIP/data/echo-mask.kdf and display it.
4. Copy the value data in "echo-mask.kdf" to the mask segment using the Copy from Value operator with the "Mask" option selected. The resultant image will have no value segment but will have a mask segment.

   1. Glyphs:Data Manip:Segment Operators:Copy from Value

5. Input this new file with only a mask segment into the first image using the Insert Segments operator. Use the mask image as "Input 1" and the echo image as "Input 2". The resultant image now has value and mask segments.

   1. Glyphs:Data Manip:Segment Operators:Insert Segments
   2. Open the Insert Segments pane and set up the parameters so that the "Mask" is inserted.

6. Display the new image and compute its statistics. Compare the statistics with those of the unasked image. Also compare how the images are displayed. Note that when you move the mouse cursor over the masked areas in the image, the position is printed, but there is no value associated with it.

Exercises

1. Compute the histograms of the original image and the new image with a validity mask segment, and compare them.

Khoros Workspace
Execute the visual program c3s5mask-application-echo.wk