diff --git a/src/Aeon.Acquisition/Aeon.Acquisition.csproj b/src/Aeon.Acquisition/Aeon.Acquisition.csproj index ff30574..7507b16 100644 --- a/src/Aeon.Acquisition/Aeon.Acquisition.csproj +++ b/src/Aeon.Acquisition/Aeon.Acquisition.csproj @@ -6,7 +6,7 @@ Bonsai Rx Project Aeon Acquisition net472 0.5.0 - build231008 + build231009 diff --git a/src/Aeon.Acquisition/DistanceFromPoint.cs b/src/Aeon.Acquisition/DistanceFromPoint.cs index d6c7f55..127f292 100644 --- a/src/Aeon.Acquisition/DistanceFromPoint.cs +++ b/src/Aeon.Acquisition/DistanceFromPoint.cs @@ -23,22 +23,31 @@ static double Distance(Point2f left, Point2f right) return Math.Sqrt(delta.X * delta.X + delta.Y * delta.Y); } - public IObservable> Process(IObservable> source) + public IObservable> Process(IObservable> source) { return source.Select(x => { - var distance = Distance(x.Item1.Centroid, new Point2f(Value)); - return Timestamped.Create(distance, x.Item2); + var distance = Distance(x.Value, new Point2f(Value)); + return Timestamped.Create(distance, x.Seconds); }); } - public IObservable> Process(IObservable> source) + public IObservable> Process(IObservable> source) + { + return source.Select(x => + { + var distance = Distance(x.Value.Centroid, new Point2f(Value)); + return Timestamped.Create(distance, x.Seconds); + }); + } + + public IObservable> Process(IObservable> source) { return source.Select(x => { var point = new Point2f(Value); - var distance = x.Item1.Min(component => Distance(point, component.Centroid)); - return Timestamped.Create(distance, x.Item2); + var distance = x.Value.Min(component => Distance(point, component.Centroid)); + return Timestamped.Create(distance, x.Seconds); }); } } diff --git a/src/Aeon.Acquisition/FormatBinaryRegions.cs b/src/Aeon.Acquisition/FormatBinaryRegions.cs index 12bc4fc..e17c5c2 100644 --- a/src/Aeon.Acquisition/FormatBinaryRegions.cs +++ b/src/Aeon.Acquisition/FormatBinaryRegions.cs @@ -1,4 +1,4 @@ -using Bonsai; +using Bonsai; using System; using System.ComponentModel; using System.Linq; @@ -15,12 +15,12 @@ public class FormatBinaryRegions { const int Address = 200; - public IObservable Process(IObservable> source) + public IObservable Process(IObservable> source) { - return source.Select(value => + return source.Select(x => { - var region = value.Item1; - var timestamp = value.Item2; + var region = x.Value; + var timestamp = x.Seconds; return HarpMessage.FromSingle( Address, timestamp, @@ -34,12 +34,12 @@ public IObservable Process(IObservable Process(IObservable> source) + public IObservable Process(IObservable> source) { - return source.SelectMany(value => + return source.SelectMany(x => { - var regions = value.Item1; - var timestamp = value.Item2; + var regions = x.Value; + var timestamp = x.Seconds; return regions.Select((region, index) => HarpMessage.FromSingle( Address, timestamp, @@ -54,4 +54,4 @@ public IObservable Process(IObservable Extracts information on the largest binary blob in the input image. @@ -76,6 +77,9 @@ + + + @@ -100,9 +104,10 @@ - - - + + + + \ No newline at end of file diff --git a/src/Aeon.Acquisition/RegionContainsPoint.cs b/src/Aeon.Acquisition/RegionContainsPoint.cs index 0abd99f..ed4b393 100644 --- a/src/Aeon.Acquisition/RegionContainsPoint.cs +++ b/src/Aeon.Acquisition/RegionContainsPoint.cs @@ -34,22 +34,31 @@ static bool Contains(Point[][] contour, Point2f point) return false; } - public IObservable> Process(IObservable> source) + public IObservable> Process(IObservable> source) { return source.Select(x => { - var containsPoint = Contains(Regions, x.Item1.Centroid); - return Timestamped.Create(containsPoint, x.Item2); + var containsPoint = Contains(Regions, x.Value); + return Timestamped.Create(containsPoint, x.Seconds); }); } - public IObservable> Process(IObservable> source) + public IObservable> Process(IObservable> source) + { + return source.Select(x => + { + var containsPoint = Contains(Regions, x.Value.Centroid); + return Timestamped.Create(containsPoint, x.Seconds); + }); + } + + public IObservable> Process(IObservable> source) { return source.Select(x => { var regions = Regions; - var containsPoint = x.Item1.Any(component => Contains(regions, component.Centroid)); - return Timestamped.Create(containsPoint, x.Item2); + var containsPoint = x.Value.Any(component => Contains(regions, component.Centroid)); + return Timestamped.Create(containsPoint, x.Seconds); }); } }