BioGTK  6.7.0
A .NET library & program for annotating, editing various microscopy imaging formats using Bioformats supported images. Including whole slide, pyramidal, and series.
Loading...
Searching...
No Matches
Promotions.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Threading.Tasks;
6
7namespace BioGTK
8{
9 public enum PromotionType
10 {
11 Point,
12 Box
13 }
14
15 public abstract class Promotion
16 {
17 public abstract float[] GetInput();
18 public abstract float[] GetLable();
19 public PromotionType mType;
20 public ForeGround foreGround;
21 }
22
23 /* The PointPromotion class represents a promotion with X and Y coordinates and an operation type. */
25 {
26 public PointPromotion(ForeGround optype)
27 {
28 this.mType = PromotionType.Point;
29 this.foreGround = optype;
30 }
31 public int X { get; set; }
32 public int Y { get; set; }
33 public override float[] GetInput()
34 {
35 return new float[2] { X ,Y};
36 }
37 public override float[] GetLable()
38 {
39 if (this.foreGround == ForeGround.foreground)
40 {
41 return new float[1] { 1 };
42 }
43 else
44 {
45 return new float[1] { 0 };
46 }
47 }
48 }
49 public enum ForeGround
50 {
51 foreground,
52 background
53 }
54
55 /* The BoxPromotion class represents a promotion that involves a box shape, defined by a left-up
56 point and a right-bottom point. */
58 {
59 public BoxPromotion()
60 {
61 this.mLeftUp = new PointPromotion(ForeGround.foreground);
62 this.mRightBottom = new PointPromotion(ForeGround.foreground);
63 this.mType = PromotionType.Box;
64 }
65 public override float[] GetInput()
66 {
67 return new float[4] { this.mLeftUp.X,
68 this.mLeftUp.Y,
69 this.mRightBottom.X,
70 this.mRightBottom.Y };
71 }
72 public override float[] GetLable()
73 {
74 return new float[2] { 2,3 };
75 }
76 public PointPromotion mLeftUp { get; set; }
77 public PointPromotion mRightBottom { get; set; }
78
79 }
80
81 /* The MaskPromotion class represents a mask with a specified width and height. */
83 {
84 public MaskPromotion(int wid,int hei)
85 {
86 this.mWidth = wid;
87 this.mHeight = hei;
88 this.mMask = new float[this.mWidth,this.mHeight];
89 }
90
91 float[,] mMask { get; set; }
92 public int mWidth { get; set; }
93 public int mHeight { get; set; }
94 }
95}
Definition ML.cs:17