You are here: Start » FIL.NET » FIL.NET Designers
FIL.NET Designers
Introduction
When using the .NET Framework 4.8, it is possible in FIL.NET to edit geometrical primitives the same way as in FabImage Studio. All that needs to be done is to install the FilNet.Designers NuGet package from the local NuGet source.
Appropriate classes are declared in FilNet.Designers
namespace.
Designer usage in FIL.NET is almost the same as of .NET dialogs. 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 and contains two picture boxes, two track bar controls responsible for setting the thresholds and several buttons that allow to load images:
//... Region roi = null; /// <summary> /// image being thresholded /// </summary> readonly 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 (Image thresholdedImage = new Image()) { //... Fil.Invoke.ThresholdImage(image, roi, minTrackBar.Value, maxTrackBar.Value, 1.0f, thresholdedImage); //... resultPreview.Image?.Dispose(); resultPreview.Image = thresholdedImage.ToBitmap(); //... } /// <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) { if (roi == null && !designer.Region.Empty) { roi = new Region(); designer.Region.MoveTo(roi); } else if (designer.Region.Empty) { roi?.Dispose(); roi = null; } } } UpdatePreview(); UpdateThresholdResult(); }
Clicking on the Edit ROI button opens the following dialog:
Available designer classes
- Arc2DArrayDesigner
- Arc2DDesigner
- ArcFittingFieldArrayDesigner
- ArcFittingFieldDesigner
- BoxArrayDesigner
- BoxDesigner
- Circle2DArrayDesigner
- Circle2DDesigner
- CircleFittingFieldArrayDesigner
- CircleFittingFieldDesigner
- EdgeModelDesigner
- GrayModelDesigner
- Line2DArrayDesigner
- Line2DDesigner
- LocationArrayDesigner
- LocationDesigner
- PathArrayDesigner
- PathDesigner
- PathFittingFieldArrayDesigner
- PathFittingFieldDesigner
- Point2DArrayDesigner
- Point2DDesigner
- Rectangle2DArrayDesigner
- Rectangle2DDesigner
- RegionDesigner
- Segment2DArrayDesigner
- Segment2DDesigner
- SegmentFittingFieldArrayDesigner
- SegmentFittingFieldDesigner
- SegmentScanFieldArrayDesigner
- SegmentScanFieldDesigner
- ShapeRegionDesigner
Previous: Serialization | Next: HMI Controls for FIL.NET |