1using System.Runtime.InteropServices;
20 public abstract class ThresholdT<T> where T : struct, IComparable<T>
68 var sizeOfInterval = Marshal.SizeOf(typeof(Backend.Types.peak_icv_interval_u));
70 var intervalBackend = Activator.CreateInstance(TypeTraits.GetCTypeOfInterval<
IntervalT<T>>(),
73 var handle = GCHandle.Alloc(intervalBackend, GCHandleType.Pinned);
74 IntPtr ptr = handle.AddrOfPinnedObject();
78 DllHelper.ExecuteAndMapReturnCodes(() =>
79 CInterface.peak_icv_Threshold_Process(image._handle,
81 (nuint) sizeOfInterval, out region._handle));
127 var intervalBackend =
new Backend.Types.peak_icv_interval();
128 var sizeOfInterval = Marshal.SizeOf(typeof(Backend.Types.peak_icv_interval));
132 Backend.Types.peak_icv_interval* ptr = &intervalBackend;
133 DllHelper.ExecuteAndMapReturnCodes(() =>
134 CInterface.peak_icv_Threshold_GetRange(image._handle, (IntPtr) ptr, (nuint) sizeOfInterval));
137 return new Interval(intervalBackend.minimum, intervalBackend.maximum);
175 var intervalBackend =
new Backend.Types.peak_icv_interval_f();
176 var sizeOfInterval = Marshal.SizeOf(typeof(Backend.Types.peak_icv_interval_f));
180 Backend.Types.peak_icv_interval_f* ptr = &intervalBackend;
181 DllHelper.ExecuteAndMapReturnCodes(() =>
182 CInterface.peak_icv_Threshold_GetRange(image._handle, (IntPtr) ptr, (nuint) sizeOfInterval));
185 return new IntervalF(intervalBackend.minimum, intervalBackend.maximum);
189 internal static class CInterface
191 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
192 public static extern Backend.Types.peak_icv_status peak_icv_Threshold_Process(
Image.Handle inputImage,
193 IntPtr interval, nuint sizeOfInterval, out
Region.Handle outputRegion);
195 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
196 public static extern Backend.Types.peak_icv_status peak_icv_Threshold_GetRange(
Image.Handle inputImage,
197 IntPtr interval, nuint sizeOfInterval);
Represents an interval consisting of a lower and upper boundary value.
T Maximum
Gets the upper boundary of the interval.
T Minimum
Gets the lower boundary of the interval.
Represents an interval with floating-point boundaries.
Represents an interval with signed integer boundaries.
Class for thresholding an image.
Region Process(Image image)
Applies a threshold on a given single-channel image of type integer and returns a region with selecte...
ThresholdT(IntervalT< T > interval)
Creates an instance of class ThresholdT.
Class for thresholding an image of type float.
ThresholdF(IntervalF interval)
Creates an instance of class Threshold for thresholding images of type float.
static IntervalF GetRange(Image image)
Queries the minimum and maximum representable pixel values for the specified image’s pixel format.
Class for thresholding an image of type integer.
Threshold(Interval interval)
Creates an instance of class Threshold for thresholding images of type integer.
static Interval GetRange(Image image)
Queries the minimum and maximum representable pixel values for the specified image’s pixel format.
Constructs an Image from an IImageView Instance.
Represents a region defined by a set of points in the image plane.