You are here: Start » FIL.NET » FIL.NET - FIL Relation
FIL.NET - FIL Relation
Overview
FIL.NET is an FIL wrapper which means that when we call FIL.NET functions, we actually call native FIL functions. That requires the FIL.dll library to be present in the same location as the FilNet.dll assembly when running the application that references FilNet.dll assembly.
Functions
In .NET a function must be a member of some type (which makes it a method rather than a function). Therefore while in FIL functions
may be accessed through the namespace only (e.g. fil::AddImages(...)
), in FIL.NET all the library functions are
static methods of the FIL class:
using FilNet; // Use function AddImages to add two images. FIL.AddImages(image1, image2, 1.0f, imageSum);
Types
Most of the native FIL types have their counterpart in the FilNet.dll assembly, which are native FIL type wrappers. Internally, a managed type
contains a native pointer to the FIL type and because of those native pointers (unmanaged resources),
objects of those types need to be disposed properly
when not used any more to avoid memory leaks. This is guaranteed thanks to the
System.IDisposable
interface but it is the user's responsibility to call it's
Dispose method
to release resources immediately instead of leaving it to the next
Garbage Collection. This may increase the application performance. More about managing FilNet types can be found here.
Optionals and Conditionals
The FIL's ftl::Optional
and ftl::Conditional
types are both mapped by the FilNet.NullableRef<T>
or FilNet.SafeNullableRef<T>
types for
reference types
and System.Nullable<T>
for
value types.
The table below lists how different types are handled in FIL.NET:
FIL Type | FIL.NET Type |
---|---|
Plain Types (e.g float, int, double, long) | |
float | float |
ftl::Optional<float> | System.Nullable<float> |
ftl::Conditional<float> | |
ftl::Array<float> |
System.Collections.Generic.List<float> |
Structures (e.g. Point2D, Point3D, Circle2D) | |
ftl::Optional<ftl::Point2D> | System.Nullable<FilNet.Point2D> |
ftl::Conditional<ftl::Point2D> | |
ftl::Array<ftl::Point2D> | System.Collections.Generic.IList<FilNet.Point2D> |
Classes (e.g. Region, Image, Path) | |
fil::Region | FilNet.Region |
ftl::Optional<fil::Region> | FilNet.NullableRef<Region>or FilNet.SafeNullableRef<Region> |
ftl::Conditional<fil::Region> | |
ftl::Array<fil::Region> |
FilNet.SafeList<Region>or System.Collections.Generic.List<Region> |
Settings
There are such options that may control the functions behavior as diagnostic mode, SSE acceleration, parallel computing, etc. Most of them can also be modified in FIL.NET with Settings class.
FIL | FIL.NET |
---|---|
void fil::EnableSSEAcceleration(bool enable) | FilNet.Settings.IsSSEEnabled setter |
bool fil::GetSSEAccelerationEnabled() | FilNet.Settings.IsSSEEnabled getter |
void fil::SetParallelComputing(bool enabled, int num_threads) |
FilNet.Settings.IsParallelComputingEnabled setter FilNet.Settings.ParallelComputingThreadCount setter |
int fil::GetParallelComputingThreadsCount() |
FilNet.Settings.ParallelComputingThreadCount getter |
void fil::EnableFilDiagnosticOutputs(bool enable) | FilNet.Settings.IsDiagnosticModeEnabled setter |
bool fil::GetFilDiagnosticOutputsEnabled() | FilNet.Settings.IsDiagnosticModeEnabled getter |
Following snippet presents example Settings class usage. This is a part of the bigger example.
//... private void diagnosticModeButton_CheckedChanged(object sender, EventArgs e) { FilNet.Settings.IsDiagnosticModeEnabled = (sender as ToolStripButton).Checked; UpdateImages(); } //...
Overloads
.NET makes it possible to overload methods. There are some cases when an argument can be skipped, making the function execute with default values and greatly reducing necessary parameter count in the function call:
ftl::NIL
value which
makes the function execute with default ROI.
In FIL.NET such methods have appropriate overloads with those optional values skipped.ftl::NIL
for such outputs when
one does not want the function
to calculate value for it. It is impossible in .NET to disable output calculation that way though. Instead, appropriate overloads may be used
to skip the output calculation e.g. PathToLineDistance in one of its overloads skips the outConnectingSegment output.Previous: Getting Started with FabImage Library .NET | Next: FIL.NET Dialogs |