private Task <List <PoreDto> > AnalyzeShapesAsync(List <PoreAnalyzeData> shapes) { return(Task.Run(() => { for (int i = 0; i < shapes.Count; i++) { var shape = shapes[i]; var shapeId = _shapeAnalyzer.Analyze(shape.getShapeDescriptor()); shape.ShapeId = shapeId; progressBar.Increment(1); } return shapes.GroupBy(s => s.ShapeId) .Select(g => { var poredata = g.First(); return new PoreDto() { PoreImage = poredata.Bmp, Id = poredata.ShapeId, Area = poredata.Area }; }).ToList(); })); }
public BlobView(ShapeAnalyzer shapeAnalyzer, PoreAnalyzeData data) { InitializeComponent(); pictureBox1.Image = data.Bmp; listBox1.Items.Add($"Moment invariant 1: {Convert.ToDecimal(data.GeometricMoment1)}"); listBox1.Items.Add($"Moment invariant 2: {Convert.ToDecimal(data.GeometricMoment2)}"); listBox1.Items.Add($"Moment invariant 3: {Convert.ToDecimal(data.GeometricMoment3)}"); listBox1.Items.Add($"Moment invariant 7: {Convert.ToDecimal(data.GeometricMoment7)}"); listBox1.Items.Add($"Malinowska's coefficient: {Convert.ToDecimal(data.MalinowskasCoefficient)}"); listBox1.Items.Add($"Area: {Convert.ToDecimal(data.Area)}"); listBox1.Items.Add($"Shape Id: {shapeAnalyzer.Analyze(data.getShapeDescriptor())}"); }