BioLib  3.6.2
A GUI-less version of Bio .NET library for editing & annotating various microscopy image formats.
Loading...
Searching...
No Matches
BioLib.ROI Class Reference
Inheritance diagram for BioLib.ROI:

Classes

class  Mask
 Represents a Mask layer. More...
 

Public Types

enum  Type {
  Rectangle , Point , Line , Polygon ,
  Polyline , Freeform , Ellipse , Label ,
  Mask
}
 
enum  CoordinateSystem { pixel , micron }
 

Public Member Functions

ROI Copy ()
 
ROI Copy (ZCT cord)
 
RectangleD GetSelectBound (double scaleX, double scaleY)
 
PointD[] ImagePoints (Resolution res)
 The function "ImagePoints" takes a Resolution object as input and returns an array of PointD objects that have been converted to image space using the provided resolution values.
 
RectangleD[] GetSelectBoxes (double s)
 
RectangleD[] GetSelectBoxes ()
 
PointD GetCenter ()
 
double DistanceTo (PointD point)
 
void UpdatePoint (PointD p, int i)
 
PointD GetPoint (int i)
 
PointD[] GetPoints ()
 
PointF[] GetPointsF ()
 
void AddPoint (PointD p)
 
void AddPoints (PointD[] p)
 
void AddPoints (int[] xp, int[] yp)
 
void AddPoints (float[] xp, float[] yp)
 
void RemovePoints (int[] indexs)
 
void ClearPoints ()
 
int GetPointCount ()
 
PointD[] stringToPoints (string s)
 
string PointsToString (BioImage b)
 
void UpdateBoundingBox ()
 
void Dispose ()
 

Static Public Member Functions

static ROI CreatePoint (ZCT coord, double x, double y)
 
static ROI CreateLine (ZCT coord, PointD x1, PointD x2)
 
static ROI CreateRectangle (ZCT coord, double x, double y, double w, double h)
 
static ROI CreateEllipse (ZCT coord, double x, double y, double w, double h)
 
static ROI CreatePolygon (ZCT coord, PointD[] pts)
 
static ROI CreateFreeform (ZCT coord, PointD[] pts)
 
static ROI CreateMask (ZCT coord, float[] mask, int width, int height, PointD loc, double physicalX, double physicalY)
 
static ROI CreateMask (ZCT coord, Byte[] mask, int width, int height, PointD loc, double physicalX, double physicalY)
 

Public Attributes

Type type
 
List< int > selectedPoints = new List<int>()
 
RectangleD BoundingBox
 
float fontSize = 12
 
Cairo.FontSlant slant
 
Cairo.FontWeight weight
 
string family = "Times New Roman"
 
ZCT coord
 
Color strokeColor
 
Color fillColor
 
bool isFilled = false
 
string id = ""
 
string roiID = ""
 
string roiName = ""
 
string properties = ""
 
int serie = 0
 
double strokeWidth = 1
 
int shapeIndex = 0
 
bool closed = false
 
bool subPixel = false
 

Static Public Attributes

static float selectBoxSize = 8f
 

Properties

PointD Point [get, set]
 
RectangleD Rect [get, set]
 
double X [get, set]
 
double Y [get, set]
 
double W [get, set]
 
double H [get, set]
 
int Resolution [get, set]
 
List< PointD > PointsD [get]
 
bool Selected [get, set]
 
Mask roiMask [get, set]
 
string Text [get, set]
 

Detailed Description

Definition at line 296 of file Bio.cs.

Member Enumeration Documentation

◆ CoordinateSystem

enum BioLib.ROI.CoordinateSystem

Definition at line 439 of file Bio.cs.

440 {
441 pixel,
442 micron
443 }

◆ Type

enum BioLib.ROI.Type

Definition at line 299 of file Bio.cs.

300 {
301 Rectangle,
302 Point,
303 Line,
304 Polygon,
305 Polyline,
306 Freeform,
307 Ellipse,
308 Label,
309 Mask
310 }

Constructor & Destructor Documentation

◆ ROI()

BioLib.ROI.ROI ( )

Definition at line 960 of file Bio.cs.

961 {
962 coord = new ZCT(0, 0, 0);
963 strokeColor = Color.Yellow;
964 BoundingBox = new RectangleD(0, 0, 1, 1);
965 }

Member Function Documentation

◆ AddPoint()

void BioLib.ROI.AddPoint ( PointD p)

‍Adds a point to the list of points and updates the bounding box

Parameters
PointD

Definition at line 1197 of file Bio.cs.

1198 {
1199 Points.Add(p);
1201 }
void UpdateBoundingBox()
Definition Bio.cs:1305

◆ AddPoints() [1/3]

void BioLib.ROI.AddPoints ( float[] xp,
float[] yp )

‍Adds a range of float points to the Points collection and updates the bounding box

Parameters
pThe points to add to the polygon

Definition at line 1224 of file Bio.cs.

1225 {
1226 for (int i = 0; i < xp.Length; i++)
1227 {
1228 Points.Add(new PointD(xp[i], yp[i]));
1229 }
1231 }

◆ AddPoints() [2/3]

void BioLib.ROI.AddPoints ( int[] xp,
int[] yp )

‍Adds a range of integer points to the Points collection and updates the bounding box

Parameters
pThe points to add to the polygon

Definition at line 1213 of file Bio.cs.

1214 {
1215 for (int i = 0; i < xp.Length; i++)
1216 {
1217 Points.Add(new PointD(xp[i], yp[i]));
1218 }
1220 }

◆ AddPoints() [3/3]

void BioLib.ROI.AddPoints ( PointD[] p)

‍Adds a range of points to the Points collection and updates the bounding box

Parameters
pThe points to add to the polygon

Definition at line 1205 of file Bio.cs.

1206 {
1207 Points.AddRange(p);
1209 }

◆ ClearPoints()

void BioLib.ROI.ClearPoints ( )

Definition at line 1252 of file Bio.cs.

1253 {
1254 Points.Clear();
1255 }

◆ Copy() [1/2]

ROI BioLib.ROI.Copy ( )

Definition at line 880 of file Bio.cs.

881 {
882 ROI copy = new ROI();
883 copy.id = id;
884 copy.roiID = roiID;
885 copy.roiName = roiName;
886 copy.text = text;
887 copy.strokeWidth = strokeWidth;
888 copy.strokeColor = strokeColor;
889 copy.fillColor = fillColor;
890 copy.Points = Points;
891 copy.Selected = Selected;
892 copy.shapeIndex = shapeIndex;
893 copy.closed = closed;
894 copy.family = family;
895 copy.fontSize = fontSize;
896 copy.slant = slant;
897 copy.selectBoxs = selectBoxs;
898 copy.BoundingBox = BoundingBox;
899 copy.isFilled = isFilled;
900 copy.coord = coord;
901 copy.selectedPoints = selectedPoints;
902
903 return copy;
904 }

◆ Copy() [2/2]

ROI BioLib.ROI.Copy ( ZCT cord)

Definition at line 905 of file Bio.cs.

906 {
907 ROI copy = new ROI();
908 copy.type = type;
909 copy.id = id;
910 copy.roiID = roiID;
911 copy.roiName = roiName;
912 copy.text = text;
913 copy.strokeWidth = strokeWidth;
914 copy.strokeColor = strokeColor;
915 copy.fillColor = fillColor;
916 copy.Points.AddRange(Points);
917 copy.Selected = Selected;
918 copy.shapeIndex = shapeIndex;
919 copy.closed = closed;
920 copy.family = family;
921 copy.fontSize = fontSize;
922 copy.slant = slant;
923 copy.selectBoxs.AddRange(selectBoxs);
924 copy.BoundingBox = BoundingBox;
925 copy.isFilled = isFilled;
926 copy.coord = cord;
927 copy.selectedPoints = selectedPoints;
928 return copy;
929 }

◆ CreateEllipse()

static ROI BioLib.ROI.CreateEllipse ( ZCT coord,
double x,
double y,
double w,
double h )
static

Create an ellipse ROI at the specified ZCT coordinate with the specified width and height

Parameters
ZCTThe ZCT coordinates of the image you want to create the ROI on.
xx-coordinate of the top-left corner of the rectangle
yThe y-coordinate of the upper-left corner of the rectangle to create.
wwidth
hheight
Returns
A new ROI object.

Definition at line 1081 of file Bio.cs.

1082 {
1083 ROI an = new ROI();
1084 an.coord = coord;
1085 an.type = Type.Ellipse;
1086 an.Rect = new RectangleD(x, y, w, h);
1087 return an;
1088 }

◆ CreateFreeform()

static ROI BioLib.ROI.CreateFreeform ( ZCT coord,
PointD[] pts )
static

‍Create a new ROI object of type Freeform, with the specified ZCT coordinate and points

Parameters
ZCTA class that contains the Z, C, and T coordinates of the ROI.
ptsan array of PointD objects, which are just a pair of doubles (x,y)
Returns
A new ROI object.

Definition at line 1110 of file Bio.cs.

1111 {
1112 ROI an = new ROI();
1113 an.coord = coord;
1114 an.type = Type.Freeform;
1115 an.AddPoints(pts);
1116 an.closed = true;
1117 return an;
1118 }

◆ CreateLine()

static ROI BioLib.ROI.CreateLine ( ZCT coord,
PointD x1,
PointD x2 )
static

Create a new ROI object, set its type to Line, add two points to it, and return it

Parameters
ZCTZ is the Z-axis, C is the color channel, and T is the time frame.
PointDX,Y
PointDX,Y
Returns
A new ROI object.

Definition at line 1046 of file Bio.cs.

1047 {
1048 ROI an = new ROI();
1049 an.coord = coord;
1050 an.type = Type.Line;
1051 an.AddPoint(x1);
1052 an.AddPoint(x2);
1053 return an;
1054 }

◆ CreateMask() [1/2]

static ROI BioLib.ROI.CreateMask ( ZCT coord,
Byte[] mask,
int width,
int height,
PointD loc,
double physicalX,
double physicalY )
static

Definition at line 1130 of file Bio.cs.

1131 {
1132 ROI an = new ROI();
1133 an.coord = coord;
1134 an.type = Type.Mask;
1135 an.roiMask = new Mask(mask, width, height, physicalX, physicalY, loc.X, loc.Y);
1136 an.AddPoint(loc);
1137 an.X = loc.X + an.roiMask.X;
1138 an.Y = loc.X + an.roiMask.Y;
1139 return an;
1140 }

◆ CreateMask() [2/2]

static ROI BioLib.ROI.CreateMask ( ZCT coord,
float[] mask,
int width,
int height,
PointD loc,
double physicalX,
double physicalY )
static

Definition at line 1119 of file Bio.cs.

1120 {
1121 ROI an = new ROI();
1122 an.coord = coord;
1123 an.type = Type.Mask;
1124 an.roiMask = new Mask(mask, width, height, physicalX, physicalY, loc.X, loc.Y);
1125 an.AddPoint(loc);
1126 an.X = loc.X + (an.roiMask.X * an.roiMask.PhysicalSizeX);
1127 an.Y = loc.X + (an.roiMask.Y * an.roiMask.PhysicalSizeY);
1128 return an;
1129 }

◆ CreatePoint()

static ROI BioLib.ROI.CreatePoint ( ZCT coord,
double x,
double y )
static

Create a new ROI object, add a point to it, and return it

Parameters
ZCTa class that contains the Z, C, and T coordinates of the image.
xx coordinate of the point
yThe y coordinate of the point
Returns
A new ROI object

Definition at line 1030 of file Bio.cs.

1031 {
1032 ROI an = new ROI();
1033 an.coord = coord;
1034 an.AddPoint(new PointD(x, y));
1035 an.type = Type.Point;
1036 return an;
1037 }

◆ CreatePolygon()

static ROI BioLib.ROI.CreatePolygon ( ZCT coord,
PointD[] pts )
static

‍Create a new ROI object of type Polygon, with the given coordinate system and points

Parameters
ZCTThe ZCT coordinate of the ROI.
ptsan array of PointD objects, which are just a pair of doubles (x,y)
Returns
A ROI object

Definition at line 1095 of file Bio.cs.

1096 {
1097 ROI an = new ROI();
1098 an.coord = coord;
1099 an.type = Type.Polygon;
1100 an.AddPoints(pts);
1101 an.closed = true;
1102 return an;
1103 }

◆ CreateRectangle()

static ROI BioLib.ROI.CreateRectangle ( ZCT coord,
double x,
double y,
double w,
double h )
static

Create a new ROI object with a rectangle shape, and add a line to the recorder

Parameters
ZCTThe ZCT coordinates of the image you want to create the ROI on.
xx coordinate of the top left corner of the rectangle
yy-coordinate of the top-left corner of the rectangle
wwidth
hheight
Returns
A new ROI object.

Definition at line 1064 of file Bio.cs.

1065 {
1066 ROI an = new ROI();
1067 an.coord = coord;
1068 an.type = Type.Rectangle;
1069 an.Rect = new RectangleD(x, y, w, h);
1070 return an;
1071 }

◆ Dispose()

void BioLib.ROI.Dispose ( )

Definition at line 1359 of file Bio.cs.

1360 {
1361 if (roiMask != null)
1362 {
1363 roiMask.Dispose();
1364 }
1365 }

◆ DistanceTo()

double BioLib.ROI.DistanceTo ( PointD point)

Definition at line 1148 of file Bio.cs.

1149 {
1150 var center = GetCenter();
1151 return (float)Math.Sqrt(Math.Pow(center.X - point.X, 2) + Math.Pow(center.Y - point.Y, 2));
1152 }

◆ GetCenter()

PointD BioLib.ROI.GetCenter ( )

Definition at line 1142 of file Bio.cs.

1143 {
1144 return new PointD(Rect.X + (Rect.W / 2.0), Rect.Y + (Rect.H / 2.0));
1145 }

◆ GetPoint()

PointD BioLib.ROI.GetPoint ( int i)

This function returns the point at the specified index

Parameters
iThe index of the point to get.
Returns
The point at index i in the Points array.

Definition at line 1170 of file Bio.cs.

1171 {
1172 return Points[i];
1173 }

◆ GetPointCount()

int BioLib.ROI.GetPointCount ( )

This function returns the number of points in the polygon

Returns
The number of points in the list.

Definition at line 1259 of file Bio.cs.

1260 {
1261 return Points.Count;
1262 }

◆ GetPoints()

PointD[] BioLib.ROI.GetPoints ( )

It returns an array of PointD objects

Returns
An array of PointD objects.

Definition at line 1177 of file Bio.cs.

1178 {
1179 return Points.ToArray();
1180 }

◆ GetPointsF()

PointF[] BioLib.ROI.GetPointsF ( )

It converts a list of points to an array of points

Returns
A PointF array.

Definition at line 1184 of file Bio.cs.

1185 {
1186 PointF[] pfs = new PointF[Points.Count];
1187 for (int i = 0; i < Points.Count; i++)
1188 {
1189 pfs[i].X = (float)Points[i].X;
1190 pfs[i].Y = (float)Points[i].Y;
1191 }
1192 return pfs;
1193 }

◆ GetSelectBound()

RectangleD BioLib.ROI.GetSelectBound ( double scaleX,
double scaleY )

‍This function returns a rectangle that is the bounding box of the object, but with a border of half the scale

Parameters
scalethe scale of the image
Returns
A rectangle with the following properties:

Definition at line 951 of file Bio.cs.

952 {
953 if (type == Type.Mask)
954 return BoundingBox;
955 double fx = scaleX / 2;
956 double fy = scaleY / 2;
957 return new RectangleD(BoundingBox.X - fx, BoundingBox.Y - fy, BoundingBox.W + scaleX, BoundingBox.H + scaleY);
958 }

◆ GetSelectBoxes() [1/2]

RectangleD[] BioLib.ROI.GetSelectBoxes ( )

It returns an array of RectangleF objects that are used to draw the selection boxes around the points of the polygon

Parameters
sthe size of the select box
Returns
A list of RectangleF objects.

Definition at line 1013 of file Bio.cs.

1014 {
1015 double f = ROI.selectBoxSize / 2;
1016 selectBoxs.Clear();
1017 for (int i = 0; i < Points.Count; i++)
1018 {
1019 selectBoxs.Add(new RectangleD((float)(Points[i].X - f), (float)(Points[i].Y - f), (float)ROI.selectBoxSize, (float)ROI.selectBoxSize));
1020 }
1021 return selectBoxs.ToArray();
1022 }

◆ GetSelectBoxes() [2/2]

RectangleD[] BioLib.ROI.GetSelectBoxes ( double s)

It returns an array of RectangleF objects that are used to draw the selection boxes around the points of the polygon

Parameters
sthe size of the select box
Returns
A list of RectangleF objects.

Definition at line 997 of file Bio.cs.

998 {
999 double f = s / 2;
1000 selectBoxs.Clear();
1001 for (int i = 0; i < Points.Count; i++)
1002 {
1003 selectBoxs.Add(new RectangleD((float)(Points[i].X - f), (float)(Points[i].Y - f), (float)s, (float)s));
1004 }
1005 return selectBoxs.ToArray();
1006 }

◆ ImagePoints()

PointD[] BioLib.ROI.ImagePoints ( Resolution res)

The function "ImagePoints" takes a Resolution object as input and returns an array of PointD objects that have been converted to image space using the provided resolution values.

Parameters
ResolutionThe "Resolution" parameter is an object that contains information about the resolution of an image. It typically includes properties such as the stage size (width and height), physical size (width and height), and possibly other properties related to the image resolution.
Returns
The method is returning an array of PointD objects.

Definition at line 977 of file Bio.cs.

978 {
979 if (type == Type.Rectangle || type == Type.Mask)
980 {
981 PointD[] pts = new PointD[4];
982 pts[0] = PointsD[0];
983 pts[1] = new PointD(PointsD[0].X + BoundingBox.W, PointsD[0].Y);
984 pts[2] = new PointD(PointsD[0].X + BoundingBox.W, PointsD[0].Y + BoundingBox.H);
985 pts[3] = new PointD(PointsD[0].X, PointsD[0].Y + BoundingBox.H);
986 return BioImage.ToImageSpace(pts.ToList(), res.StageSizeX, res.StageSizeY, res.PhysicalSizeX, res.PhysicalSizeY);
987 }
988 else
989 return BioImage.ToImageSpace(PointsD, res.StageSizeX, res.StageSizeY, res.PhysicalSizeX, res.PhysicalSizeY);
990 }

◆ PointsToString()

string BioLib.ROI.PointsToString ( BioImage b)

This function takes a BioImage object and returns a string of the points in the image space

Parameters
BioImageThe image that the ROI is on
Returns
The points of the polygon in the image space.

Definition at line 1290 of file Bio.cs.

1291 {
1292 string pts = "";
1293 PointD[] ps = b.ToImageSpace(Points);
1294 for (int j = 0; j < ps.Length; j++)
1295 {
1296 if (j == ps.Length - 1)
1297 pts += ps[j].X.ToString(CultureInfo.InvariantCulture) + "," + ps[j].Y.ToString(CultureInfo.InvariantCulture);
1298 else
1299 pts += ps[j].X.ToString(CultureInfo.InvariantCulture) + "," + ps[j].Y.ToString(CultureInfo.InvariantCulture) + " ";
1300 }
1301 return pts;
1302 }

◆ RemovePoints()

void BioLib.ROI.RemovePoints ( int[] indexs)

It removes points from a list of points based on an array of indexes

Parameters
indexsan array of integers that represent the indexes of the points to be removed

Definition at line 1235 of file Bio.cs.

1236 {
1237 List<PointD> inds = new List<PointD>();
1238 for (int i = 0; i < Points.Count; i++)
1239 {
1240 bool found = false;
1241 for (int ind = 0; ind < indexs.Length; ind++)
1242 {
1243 if (indexs[ind] == i)
1244 found = true;
1245 }
1246 if (!found)
1247 inds.Add(Points[i]);
1248 }
1249 Points = inds;
1251 }

◆ stringToPoints()

PointD[] BioLib.ROI.stringToPoints ( string s)

It takes a string of points and returns an array of points

Parameters
sThe string to convert to points.
Returns
A list of points.

Definition at line 1268 of file Bio.cs.

1269 {
1270 List<PointD> pts = new List<PointD>();
1271 string[] ints = s.Split(' ');
1272 for (int i = 0; i < ints.Length; i++)
1273 {
1274 string[] sints;
1275 if (s.Contains("\t"))
1276 sints = ints[i].Split('\t');
1277 else
1278 sints = ints[i].Split(',');
1279 double x = double.Parse(sints[0], CultureInfo.InvariantCulture);
1280 double y = double.Parse(sints[1], CultureInfo.InvariantCulture);
1281 pts.Add(new PointD(x, y));
1282 }
1283 return pts.ToArray();
1284 }

◆ UpdateBoundingBox()

void BioLib.ROI.UpdateBoundingBox ( )

It takes a list of points and returns a rectangle that contains all of the points

Definition at line 1305 of file Bio.cs.

1306 {
1307 if (type == Type.Mask)
1308 {
1309 double minx = double.MaxValue;
1310 double miny = double.MaxValue;
1311 double maxx = double.MinValue;
1312 double maxy = double.MinValue;
1313 for (int y = 0; y < roiMask.Height; y++)
1314 {
1315 for (int x = 0; x < roiMask.Width; x++)
1316 {
1317 if (roiMask.IsSelected(x, y))
1318 {
1319 if (minx > x)
1320 minx = x;
1321 if (miny > y)
1322 miny = y;
1323 if (maxx < x)
1324 maxx = x;
1325 if (maxy < y)
1326 maxy = y;
1327 }
1328 }
1329 }
1330 BoundingBox = new RectangleD(PointsD[0].X + (minx * roiMask.PhysicalSizeX), PointsD[0].Y + (miny * roiMask.PhysicalSizeY),
1331 (maxx - minx) * roiMask.PhysicalSizeX, (maxy - miny) * roiMask.PhysicalSizeY);
1332 return;
1333 }
1334 PointD min = new PointD(double.MaxValue, double.MaxValue);
1335 PointD max = new PointD(double.MinValue, double.MinValue);
1336 foreach (PointD p in Points)
1337 {
1338 if (min.X > p.X)
1339 min.X = p.X;
1340 if (min.Y > p.Y)
1341 min.Y = p.Y;
1342
1343 if (max.X < p.X)
1344 max.X = p.X;
1345 if (max.Y < p.Y)
1346 max.Y = p.Y;
1347 }
1348 RectangleD r = new RectangleD();
1349 r.X = min.X;
1350 r.Y = min.Y;
1351 r.W = max.X - min.X;
1352 r.H = max.Y - min.Y;
1353 if (r.W == 0)
1354 r.W = 1;
1355 if (r.H == 0)
1356 r.H = 1;
1357 BoundingBox = r;
1358 }

◆ UpdatePoint()

void BioLib.ROI.UpdatePoint ( PointD p,
int i )

This function updates the point at the specified index

Parameters
PointDA class that contains an X and Y coordinate.
iThe index of the point to update

Definition at line 1157 of file Bio.cs.

1158 {
1159 if (i < Points.Count)
1160 {
1161 Points[i] = p;
1162 }
1164 }

Member Data Documentation

◆ BoundingBox

RectangleD BioLib.ROI.BoundingBox

Definition at line 456 of file Bio.cs.

◆ closed

bool BioLib.ROI.closed = false

Definition at line 474 of file Bio.cs.

◆ coord

ZCT BioLib.ROI.coord

Definition at line 461 of file Bio.cs.

◆ family

string BioLib.ROI.family = "Times New Roman"

Definition at line 460 of file Bio.cs.

◆ fillColor

Color BioLib.ROI.fillColor

Definition at line 463 of file Bio.cs.

◆ fontSize

float BioLib.ROI.fontSize = 12

Definition at line 457 of file Bio.cs.

◆ id

string BioLib.ROI.id = ""

Definition at line 465 of file Bio.cs.

◆ isFilled

bool BioLib.ROI.isFilled = false

Definition at line 464 of file Bio.cs.

◆ properties

string BioLib.ROI.properties = ""

Definition at line 468 of file Bio.cs.

◆ roiID

string BioLib.ROI.roiID = ""

Definition at line 466 of file Bio.cs.

◆ roiName

string BioLib.ROI.roiName = ""

Definition at line 467 of file Bio.cs.

◆ selectBoxSize

float BioLib.ROI.selectBoxSize = 8f
static

Definition at line 445 of file Bio.cs.

◆ selectedPoints

List<int> BioLib.ROI.selectedPoints = new List<int>()

Definition at line 455 of file Bio.cs.

◆ serie

int BioLib.ROI.serie = 0

Definition at line 469 of file Bio.cs.

◆ shapeIndex

int BioLib.ROI.shapeIndex = 0

Definition at line 473 of file Bio.cs.

◆ slant

Cairo.FontSlant BioLib.ROI.slant

Definition at line 458 of file Bio.cs.

◆ strokeColor

Color BioLib.ROI.strokeColor

Definition at line 462 of file Bio.cs.

◆ strokeWidth

double BioLib.ROI.strokeWidth = 1

Definition at line 472 of file Bio.cs.

◆ subPixel

bool BioLib.ROI.subPixel = false

Definition at line 488 of file Bio.cs.

◆ type

Type BioLib.ROI.type

Definition at line 444 of file Bio.cs.

◆ weight

Cairo.FontWeight BioLib.ROI.weight

Definition at line 459 of file Bio.cs.

Property Documentation

◆ H

double BioLib.ROI.H
getset

Definition at line 416 of file Bio.cs.

417 {
418 get
419 {
420 if (type == Type.Mask)
421 {
422 return roiMask.Height * roiMask.PhysicalSizeY;
423 }
424 if (type == Type.Point)
425 return strokeWidth;
426 else
427 return BoundingBox.H;
428 }
429 set
430 {
431 Rect = new RectangleD(X, Y, W, value);
432 }
433 }

◆ Point

PointD BioLib.ROI.Point
getset

Definition at line 312 of file Bio.cs.

313 {
314 get
315 {
316 if (type == Type.Mask)
317 return new PointD(roiMask.X * roiMask.PhysicalSizeX, roiMask.Y * roiMask.PhysicalSizeY);
318 return Points[0];
319 }
320 set
321 {
322 UpdatePoint(value, 0);
324 }
325 }
void UpdatePoint(PointD p, int i)
Definition Bio.cs:1157

◆ PointsD

List<PointD> BioLib.ROI.PointsD
get

Definition at line 447 of file Bio.cs.

448 {
449 get
450 {
451 return Points;
452 }
453 }

◆ Rect

RectangleD BioLib.ROI.Rect
getset

Definition at line 326 of file Bio.cs.

327 {
328 get
329 {
330 if (Points.Count == 0)
331 return new RectangleD(0, 0, 0, 0);
332 if (type == Type.Line || type == Type.Polyline || type == Type.Polygon || type == Type.Freeform || type == Type.Label)
333 return BoundingBox;
334 if (type == Type.Rectangle || type == Type.Ellipse)
335 return new RectangleD(Points[0].X, Points[0].Y, Points[1].X - Points[0].X, Points[2].Y - Points[0].Y);
336 if (type == Type.Mask)
337 {
338 return new RectangleD(roiMask.X * roiMask.PhysicalSizeX, roiMask.Y * roiMask.PhysicalSizeY, roiMask.Width * roiMask.PhysicalSizeX, roiMask.Height * roiMask.PhysicalSizeY);
339 }
340 else
341 return new RectangleD(Points[0].X, Points[0].Y, W, H);
342 }
343 set
344 {
345 if (type == Type.Line || type == Type.Polyline || type == Type.Polygon || type == Type.Freeform)
346 {
347 BoundingBox = value;
348 }
349 else
350 if (Points.Count < 4 && (type == Type.Rectangle || type == Type.Ellipse))
351 {
352 AddPoint(new PointD(value.X, value.Y));
353 AddPoint(new PointD(value.X + value.W, value.Y));
354 AddPoint(new PointD(value.X, value.Y + value.H));
355 AddPoint(new PointD(value.X + value.W, value.Y + value.H));
356 }
357 else
358 if (type == Type.Rectangle || type == Type.Ellipse)
359 {
360 Points[0] = new PointD(value.X, value.Y);
361 Points[1] = new PointD(value.X + value.W, value.Y);
362 Points[2] = new PointD(value.X, value.Y + value.H);
363 Points[3] = new PointD(value.X + value.W, value.Y + value.H);
364 }
366 }
367 }
void AddPoint(PointD p)
Definition Bio.cs:1197

◆ Resolution

int BioLib.ROI.Resolution
getset

Definition at line 434 of file Bio.cs.

435 {
436 get { return resolution; }
437 set { resolution = value; }
438 }

◆ roiMask

Mask BioLib.ROI.roiMask
getset

Definition at line 489 of file Bio.cs.

489{ get; set; }

◆ Selected

bool BioLib.ROI.Selected
getset

Definition at line 476 of file Bio.cs.

477 {
478 get { return selected; }
479 set
480 {
481 if (roiMask != null)
482 roiMask.Selected = value;
483 selected = value;
484 if (!selected)
485 selectedPoints.Clear();
486 }
487 }

◆ Text

string BioLib.ROI.Text
getset

Definition at line 930 of file Bio.cs.

931 {
932 get
933 {
934 return text;
935 }
936 set
937 {
938 text = value;
939 if (type == Type.Label)
940 {
942 }
943 }
944 }

◆ W

double BioLib.ROI.W
getset

Definition at line 398 of file Bio.cs.

399 {
400 get
401 {
402 if (type == Type.Mask)
403 {
404 return roiMask.Width * roiMask.PhysicalSizeX;
405 }
406 if (type == Type.Point)
407 return strokeWidth;
408 else
409 return BoundingBox.W;
410 }
411 set
412 {
413 Rect = new RectangleD(X, Y, value, H);
414 }
415 }

◆ X

double BioLib.ROI.X
getset

Definition at line 368 of file Bio.cs.

369 {
370 get
371 {
372 if (type == Type.Mask)
373 {
374 return roiMask.X * roiMask.PhysicalSizeX;
375 }
376 return Point.X;
377 }
378 set
379 {
380 Rect = new RectangleD(value, Y, W, H);
381 }
382 }

◆ Y

double BioLib.ROI.Y
getset

Definition at line 383 of file Bio.cs.

384 {
385 get
386 {
387 if (type == Type.Mask)
388 {
389 return roiMask.Y * roiMask.PhysicalSizeY;
390 }
391 return Point.Y;
392 }
393 set
394 {
395 Rect = new RectangleD(X, value, W, H);
396 }
397 }

The documentation for this class was generated from the following file: