# Edit Mask

The Mask toolbar is launched by right-clicking in an image, and selecting Edit Mask from the menu. After you have applied the mask to one image, click the Apply button so the mask will be used by all the images in your training image set. Press the Close button to return to the process of constructing your ViDi application.

The default Edit Mask toolbar:

The Expert Mode Edit Mask toolbar version:

Setting | Description
--- | ---
Drawing Tools | There are three drawing tools, and they can be used in conjunction. The size of the area drawn is defined by the Width value. Line: Click and drag to create a line in your image. Tip: Hold down the Shift key while drawing, and the tool will draw a straight line between two points. If you want to fill in a rectangular area, draw the outline using the line drawing tool (hold down the Shift key to create straight lines), and then fill it in using the magic wand tool. Circle: Place the cursor at the center of your circular object, and drag outward. Tip: Hold down the Shift key to have the circle expand from the corner of a bounding box. Magic Wand: Click and drag to fill in areas of the image. You can also click on individual features to apply fill to just that area. Note: The Eraser tool can be used to trim and/or remove extraneous drawings on the image.
Width | Defines the pixel width of the mask drawing tools, border mask and the grow area. The Width should be set prior to applying the mask. While editing your mask, either with a drawing tool, border mask or area growth, if you adjust the Width value, the new value will only be applied to the next mask you create (it will not change previously created masks, even in the same editing session).
Border Mask | Creates a mask around the border of the image, based on the Width value. Applying a mask to the border of the image is helpful when you have images that arbitrarily cut off an object, such as a piece of fabric or a textile, because the field of view of the camera acquiring the image crops the object.
Grow Area | Expands the area of the mask by the Width value.
Invert | Inverts the mask, i.e. the area that is masked will be unmasked, and the area that did not contain a mask will be masked.
Dim | Dims the current mask by dividing its intensity by a factor of two. This is particularly useful when the Masking Mode parameter is set to Overlay, where a mask at half intensity will be ignored for sampling, but useful for providing labeling information. Note: This option is only available in Expert Mode.
Clear | Removes the mask from the image.
Import/Export | The import and export buttons launch an Import Mask-Image and Export Mask-Image dialog for importing or exporting a mask image, as a .PNG file. A mask image is a two-dimensional array of pixels that has the same size as the view in which the mask resides. The pixel values in the mask image determine whether or not the corresponding pixels in the view are used for training or runtime processing. The import/export options allow you to either import a previously created mask image, or export one that was just created.
Undo/Apply/Close | Options to control the application of the mask. Undo: Undoes the last action. Apply: Applies the mask to the image, and also allows the mask to be applied to all of the images in the Training Set. If there are tools that are chained, the mask will also be applied to downstream tools. Close: Ends the mask editing session. The mask editing session must be closed to perform any other actions in the application.