To define a model, you can use MpatAllocModel() to define which portion of the model source image to use as your model, or you can use MpatAllocAutoModel() to have MIL automatically extract a unique model for you.
The model should be unique and not defined from a flat region (consistent pixel values with no edges present). Also, the model source image should be of the best quality possible. If noisy, try to clean the image, using the image processing techniques discussed previously in this manual.
When allocating a model, you must specify its size. Generally, relative to the target image, small models take longer to find than larger ones, although very large models can also be time-consuming.
For information on defining a model that might appear at different angles in the target image, see the Rotation section later in this chapter.
Upon allocation, the model is extracted from the selected region in the model source image buffer and stored in a non-displayable model buffer. The model source image buffer is then no longer needed. To view the portion of the image from which the model was extracted, use MpatCopy() or MpatDraw().
You can use MpatDraw() to draw the various model features. You can use a previously allocated graphics context (see Chapter 22: Generating graphics) to control the drawing color, or use the default graphics context (M_DEFAULT). You can also choose to draw in the display's overlay buffer. By drawing into the display's overlay buffer, you can annotate an image non-destructively. For more information, see Chapter 21: Displaying an image.
Models are usually saved on disk for future use, using MpatSave(). You can also set and save the model's search constraints. For information on setting a model's search constraints, see the Steps to performing a pattern search section earlier in this chapter.