# Using a ViDi Tool with an External ROI

Alternatively, you can also add a Controls Functions, such as an EditRegion function, and use it to pass in the Region values to the ViDi function. In this case, you would use the X, Y and Angle data from the pattern as the Fixture parameter data for the EditRegion function, and assign the ViDi function's Region parameter to the X, Y, High, Wide and Angle values defined by the EditRegion function. Then within the ViDi function, in the ViDi Editor, you will set the ViDi tool's ROI to ExternalROI, and the tool's region of interest will be defined by the EditRegion function.

To configure a ViDi function to use an external ROI, perform the following:

1. Add a function that will provide the ROI and configure the ROI within your images. In the above example, an EditRegion function is being used.

   Note: If your object being inspected will undergo movement, you can also add a fixture to orient the EditRegion function. In the example above, a FindPatMaxRedLine function is looking for the CEF letters on the circuit board. A Fixture function has been added to extract the X, Y and Angle data from the function, and is used to define the Fixture parameters of the EditRegion function.
2. Add a ViDi function.
3. Set the Region parameter as an Absolute Reference to the X, Y, High, Wide and Angle outputs of the EditRegion function.
4. Launch the ViDi Editor.
5. Add the training and testing images.
6. The ViDi Editor will automatically apply the external ROI data to the images.

Note:

In the event that an external fixture or ROI fails to properly align an image within the ViDi Editor, an error message, "No Views Extracted" will be displayed in the image.

You can enter the filter syntax view_index = -1 in the Display filter to show all the views that are exhibiting this behavior.

To correct the issue, note the names of the images that are experiencing this issue, then return to the Spreadsheet Editor and adjust the fixture data to account for the fixture failure.