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

FIL.NET Designers

Introduction

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

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

Appropriate classes are declared in FilNet.Designers namespace.

Designer usage in FIL.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 Fil.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())
    {
        //... 
        FIL.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 FIL.NET and FIL/C++ Next: HMI Controls for FIL.NET