You are here: Start » AVL.NET » AVL.NET Designers

AVL.NET Designers

Introduction

It is possible in AVL.NET to edit geometrical primitives the same way as in Aurora Vision Studio. All that need to be done is to reference the following assemblies:

  • Avl.NET.Designers.dll
  • Avl.Net.Amr.dll
  • Avl.Net.Kit.dll

Appropriate classes are declared in AvlNet.Designers namespace.

Designer usage in AVL.NET is almost the same as of .NET Designers. Each designer class exposes at least a public property of the type it is designed to edit and a public ShowDialog() method which returns a DialogResult enumeration.

Example

The following example is a part of the simple image thresholding application that allows to threshold an image within the user-defined ROI which can be defined with RegionDesigner. The complete source code can be found here.

The application is a single-form application that uses the RegionDesigner from the Avl.NET.Designers.dll assembly and contains two picture boxes, two track bar controls responsible for setting the thresholds and several buttons that allow to load images:


//...
Region roi = new Region();
/// <summary>
/// image being thresholded
/// </summary>
Image image = new Image();
//...

/// <summary>
/// Performs image thresholding either in defined ROI or of a cropped image.
/// </summary>
private void UpdateThresholdResult()
{
    // create an empty image to be filled in the ThresholdImage function
    using (var thresholdedImage = new Image())
    {
        //... 
        AVL.ThresholdImage(image, roi, minTrackBar.Value, maxTrackBar.Value, 1.0f, thresholdedImage);
            //... 
            if (resultPreview.Image != null)
                resultPreview.Image.Dispose();
            resultPreview.Image = thresholdedImage.CreateBitmap();
            //... 
}

/// <summary>
/// Opens a RegionDesigner to edit a ROI within which an image will be thresholded.
/// </summary>
private void regionButton_Click(object sender, EventArgs e)
{
    using (var designer = new RegionDesigner())
    {
        if (image != null)
            designer.Backgrounds = new Image[] { image };

        designer.Region = roi;
        if (designer.ShowDialog(this) == DialogResult.OK)
        {
            roi.Reset(designer.Region);
        }
    }

    UpdatePreview();
    UpdateThresholdResult();
}

Clicking on the Edit ROI button opens the following dialog:


Available designer classes

Previous: Relation between AVL.NET and AVL/C++ Next: HMI Controls for AVL.NET