BioGTK  5.1.1
A .NET library & program for annotating, editing various microscopy imaging formats using Bioformats supported images.
Loading...
Searching...
No Matches
BioGTK.Tools Class Reference
Inheritance diagram for BioGTK.Tools:

Classes

class  Tool
 

Public Member Functions

void UpdateView ()
 

‍UpdateView() is a function that updates the view of the viewer.


 
void ToolDown (PointD e, ButtonPressEventArgs buts)
 
void ToolUp (PointD e, ButtonReleaseEventArgs buts)
 
void ToolMove (PointD e, MotionNotifyEventArgs buts)
 

Static Public Member Functions

static Tools Create ()
 
static Tool GetTool (string name)
 
static Tool GetTool (Tool.Type typ)
 

Static Public Attributes

static bool applyToStack = false
 
static ColorTool colorTool
 
static bool rEnabled = true
 
static bool gEnabled = true
 
static bool bEnabled = true
 
static ColorS drawColor = new ColorS(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)
 
static ColorS eraseColor = new ColorS(0, 0, 0)
 
static ColorS tolerance = new ColorS(0, 0, 0)
 
static Rectangle selectionRectangle
 
static Dictionary< string, Tooltools = new Dictionary<string, Tool>()
 
static Tool currentTool
 
static RectangleD selectionRect
 
static TextInput ti = null
 
static ROI selectedROI = null
 
static bool colorOne = true
 

Protected Member Functions

 Tools (Builder builder, IntPtr handle)
 
void SetupHandlers ()
 Sets up the handlers.
 

Properties

static ColorS DrawColor [get, set]
 
static ColorS EraseColor [get, set]
 
static int StrokeWidth [get, set]
 

Constructor & Destructor Documentation

◆ Tools()

BioGTK.Tools.Tools ( Builder  builder,
IntPtr  handle 
)
inlineprotected
43 : base(handle)
44 {
45 selectColor.Red = 0;
46 selectColor.Green = 0;
47 selectColor.Blue = 150;
48 selectColor.Alpha= 255;
49 white.Blue = 255;
50 white.Green = 255;
51 white.Red = 255;
52 white.Alpha = 255;
53 _builder = builder;
54 builder.Autoconnect(this);
56 Tool.Init();
57 ColorS col = new ColorS(ushort.MaxValue);
58 //We initialize the tools
59 currentTool = GetTool(Tool.Type.move);
60 floodFiller = new QueueLinearFloodFiller(floodFiller);
61 magicSel = MagicSelect.Create(0);
62 App.ApplyStyles(this);
63 }
Definition MagicSelect.cs:10
static MagicSelect Create(int index)
Definition MagicSelect.cs:41
static Tool GetTool(string name)
Definition Tools.cs:253
static Tool currentTool
Definition Tools.cs:204
void SetupHandlers()
Sets up the handlers.
Definition Tools.cs:795

Member Function Documentation

◆ Create()

static Tools BioGTK.Tools.Create ( )
inlinestatic

It creates a new instance of the Tools class, which is a class that inherits from the Gtk.Window class

Returns
A new instance of the Tools class.
37 {
38 Builder builder = new Builder(new FileStream(System.IO.Path.GetDirectoryName(Environment.ProcessPath) + "/" + "Glade/Tools.glade", FileMode.Open));
39 return new Tools(builder, builder.GetObject("tools").Handle);
40 }
Tools(Builder builder, IntPtr handle)
Definition Tools.cs:43

◆ GetTool() [1/2]

static Tool BioGTK.Tools.GetTool ( string  name)
inlinestatic

If the tools dictionary contains the name of the tool, return the tool, otherwise return the move tool

Parameters
nameThe name of the tool to get.
Returns
The tool that is being returned is the tool that is being used.
254 {
255 if (tools.ContainsKey(name))
256 return (Tool)tools[name];
257 else
258 return GetTool(Tool.Type.move);
259 }
static Dictionary< string, Tool > tools
Definition Tools.cs:79

◆ GetTool() [2/2]

static Tool BioGTK.Tools.GetTool ( Tool::Type  typ)
inlinestatic

It returns a Tool object from the tools dictionary, using the Tool.Type enum as the key

Parameters
typThe type of tool to get.
Returns
The tool object.
266 {
267 return (Tool)tools[typ.ToString()];
268 }

◆ SetupHandlers()

void BioGTK.Tools.SetupHandlers ( )
inlineprotected

Sets up the handlers.

It sets up the handlers for the buttons

796 {
797 this.ButtonPressEvent += Tools_ButtonPressEvent;
798 ti = TextInput.Create();
799 view.Drawn += View_Drawn;
800 }
static TextInput Create()
Definition TextInput.cs:36
static TextInput ti
Definition Tools.cs:245

◆ ToolDown()

void BioGTK.Tools.ToolDown ( PointD  e,
ButtonPressEventArgs  buts 
)
inline

The function is called when the user clicks the mouse button.

The function checks the current tool and if it's a line, polygon, freeform, rectangle, ellipse, delete, or text tool, it does something.

If the tool is a line tool, it creates a new ROI object and adds it to the list of annotations.

If the tool is a polygon tool, it creates a new ROI object and adds it to the list of annotations.

If the tool is a freeform tool, it creates a new ROI object and adds it to the list of annotations.

If the tool is a rectangle tool, it creates a new ROI object and adds it to the list of annotations.

If the tool is an ellipse tool, it creates a new ROI object and adds it to the list of annotations.

Parameters
PointDA point with double precision
ButtonPressEventArgs
Returns
The return type is void.
312 {
313 if (App.viewer == null || currentTool == null || ImageView.SelectedImage == null)
314 return;
315 Plugins.MouseDown(ImageView.SelectedImage, e, buts);
316 Scripting.UpdateState(Scripting.State.GetDown(e, buts.Event.Button));
317 PointF p = new PointF((float)e.X, (float)e.Y);
318 if (currentTool.type == Tool.Type.line && buts.Event.Button == 1)
319 {
320 selectedROI = new ROI();
321 selectedROI.type = ROI.Type.Line;
322 selectedROI.AddPoint(new PointD(e.X, e.Y));
323 selectedROI.AddPoint(new PointD(e.X, e.Y));
324 selectedROI.coord = App.viewer.GetCoordinate();
325 if (ImageView.SelectedImage.isPyramidal)
326 selectedROI.serie = App.viewer.Level;
327 else
328 selectedROI.serie = ImageView.SelectedImage.series;
329 //ImageView.SelectedImage.Annotations.Add(selectedROI);
330 AddROI(selectedROI);
331 }
332 else
333 if (currentTool.type == Tool.Type.polygon && buts.Event.Button == 1)
334 {
335 if (selectedROI == null)
336 {
337 selectedROI = new ROI();
338 selectedROI.type = ROI.Type.Polygon;
339 selectedROI.AddPoint(new PointD(e.X, e.Y));
340 selectedROI.coord = App.viewer.GetCoordinate();
341 if (ImageView.SelectedImage.isPyramidal)
342 selectedROI.serie = App.viewer.Level;
343 else
344 selectedROI.serie = ImageView.SelectedImage.series;
345 AddROI(selectedROI);
346 }
347 else
348 {
349 //If we click on a point 1 we close this polygon
350 float width = (float)App.viewer.ToScreenScaleW(ROI.selectBoxSize);
351 RectangleD[] rds = selectedROI.GetSelectBoxes(width);
352 if (rds[0].IntersectsWith(e.X,e.Y))
353 {
354 selectedROI.closed = true;
355 selectedROI.Selected = false;
356 selectedROI = null;
357 return;
358 }
359 else
360 {
361 if(selectedROI.closed == false)
362 selectedROI.AddPoint(new PointD(e.X, e.Y));
363 }
364 }
365 }
366 else
367 if (currentTool.type == Tool.Type.freeform && buts.Event.Button == 1)
368 {
369 if (selectedROI == null)
370 {
371 selectedROI = new ROI();
372 selectedROI.type = ROI.Type.Freeform;
373 selectedROI.AddPoint(new PointD(e.X, e.Y));
374 selectedROI.coord = App.viewer.GetCoordinate();
375 if (ImageView.SelectedImage.isPyramidal)
376 selectedROI.serie = App.viewer.Level;
377 else
378 selectedROI.serie = ImageView.SelectedImage.series;
379 AddROI(selectedROI);
380 }
381 else
382 {
383 selectedROI.AddPoint(new PointD(e.X, e.Y));
384 }
385 }
386 else
387 if (currentTool.type == Tool.Type.rect && buts.Event.Button == 1)
388 {
389 selectedROI = new ROI();
390 selectedROI.type = ROI.Type.Rectangle;
391 selectedROI.Rect = new RectangleD(e.X, e.Y, 1, 1);
392 selectedROI.coord = App.viewer.GetCoordinate();
393 if (ImageView.SelectedImage.isPyramidal)
394 selectedROI.serie = App.viewer.Level;
395 else
396 selectedROI.serie = ImageView.SelectedImage.series;
397 AddROI(selectedROI);
398 }
399 else
400 if (currentTool.type == Tool.Type.ellipse && buts.Event.Button == 1)
401 {
402 selectedROI = new ROI();
403 selectedROI.type = ROI.Type.Ellipse;
404 selectedROI.Rect = new RectangleD(e.X, e.Y, 1, 1);
405 selectedROI.coord = App.viewer.GetCoordinate();
406 if (ImageView.SelectedImage.isPyramidal)
407 selectedROI.serie = App.viewer.Level;
408 else
409 selectedROI.serie = ImageView.SelectedImage.series;
410 AddROI(selectedROI);
411 }
412 else
413 if (currentTool.type == Tool.Type.delete && buts.Event.Button == 1)
414 {
415 for (int i = 0; i < ImageView.SelectedImage.Annotations.Count; i++)
416 {
417 ROI an = ImageView.SelectedImage.Annotations[i];
418 if (an.BoundingBox.IntersectsWith(e.X, e.Y))
419 {
420 if (an.selectedPoints.Count == 0)
421 {
422 ImageView.SelectedImage.Annotations.Remove(an);
423 break;
424 }
425 else
426 if (an.selectedPoints.Count == 1 && !(an.type == ROI.Type.Polygon || an.type == ROI.Type.Polyline || an.type == ROI.Type.Freeform))
427 {
428 ImageView.SelectedImage.Annotations.Remove(an);
429 break;
430 }
431 else
432 {
433 if (an.type == ROI.Type.Polygon ||
434 an.type == ROI.Type.Polyline ||
435 an.type == ROI.Type.Freeform)
436 {
437 an.closed = false;
438 an.RemovePoints(an.selectedPoints.ToArray());
439 break;
440 }
441 }
442 }
443 }
444
445 UpdateView();
446 }
447 else
448 if (currentTool.type == Tool.Type.text && buts.Event.Button == 1)
449 {
450 selectedROI = new ROI();
451 selectedROI.type = ROI.Type.Label;
452 if (selectedROI.PointsD.Count == 0)
453 selectedROI.AddPoint(new PointD(e.X, e.Y));
454 else
455 selectedROI.UpdatePoint(new PointD(e.X, e.Y), 0);
456 selectedROI.coord = App.viewer.GetCoordinate();
457 if (ImageView.SelectedImage.isPyramidal)
458 selectedROI.serie = App.viewer.Level;
459 else
460 selectedROI.serie = ImageView.SelectedImage.series;
461 ti = TextInput.Create();
462 ti.ShowAll();
463 ti.Run();
464 AddROI(selectedROI);
465 }
466 else
467 if (buts.Event.Button == 2)
468 {
469 currentTool = GetTool(Tool.Type.pan);
470 }
471 }
AForge.PointF PointF
Definition ImageView.cs:11
void UpdatePoint(PointD p, int i)
Definition Bio.cs:977
void AddPoint(PointD p)
Definition Bio.cs:1017
RectangleD[] GetSelectBoxes(double s)
Definition Bio.cs:845
List< PointD > PointsD
Definition Bio.cs:524
bool closed
Definition Bio.cs:557
Type type
Definition Tools.cs:169
static ROI selectedROI
Definition Tools.cs:277
void UpdateView()
‍UpdateView() is a function that updates the view of the viewer.
Definition Tools.cs:271

◆ ToolMove()

void BioGTK.Tools.ToolMove ( PointD  e,
MotionNotifyEventArgs  buts 
)
inline

This function is called when the mouse is moved. It is used to update the view when the user is panning, drawing a line, drawing a freeform, drawing a rectangle, drawing an ellipse, selecting a rectangle, deleting an annotation, drawing a magic wand selection, and erasing

Parameters
PointDA point in the image space
MotionNotifyEventArgs
Returns
The return type is void.
624 {
625 if (App.viewer == null)
626 return;
627 Plugins.MouseMove(ImageView.SelectedImage, e, buts);
628 if (buts.Event.State == ModifierType.Button1Mask)
629 Scripting.UpdateState(Scripting.State.GetMove(e, 1));
630 if (buts.Event.State == ModifierType.Button2Mask)
631 Scripting.UpdateState(Scripting.State.GetMove(e, 2));
632 if (buts.Event.State == ModifierType.Button3Mask)
633 Scripting.UpdateState(Scripting.State.GetMove(e, 3));
634 if (buts.Event.State == ModifierType.Button4Mask)
635 Scripting.UpdateState(Scripting.State.GetMove(e, 4));
636 if (buts.Event.State == ModifierType.Button5Mask)
637 Scripting.UpdateState(Scripting.State.GetMove(e, 5));
638 if (buts.Event.State == ModifierType.None)
639 Scripting.UpdateState(Scripting.State.GetMove(e, 0));
640 if ((Tools.currentTool.type == Tools.Tool.Type.pan && buts.Event.State.HasFlag(Gdk.ModifierType.Button1Mask)) || buts.Event.State.HasFlag(Gdk.ModifierType.Button2Mask))
641 {
642 if (ImageView.SelectedImage.isPyramidal)
643 {
644 if (App.viewer.OpenSlide)
645 {
646 if (App.viewer.MouseMoveInt.X != 0 || App.viewer.MouseMoveInt.Y != 0)
647 {
648 App.viewer.PyramidalOriginTransformed = new PointD(App.viewer.PyramidalOriginTransformed.X + (ImageView.mouseDown.X - e.X), App.viewer.PyramidalOriginTransformed.Y + (ImageView.mouseDown.Y - e.Y));
649 }
650 }
651 else
652 {
653 if (App.viewer.MouseMoveInt.X != 0 || App.viewer.MouseMoveInt.Y != 0)
654 {
655 App.viewer.PyramidalOriginTransformed = new PointD(App.viewer.PyramidalOriginTransformed.X + (ImageView.mouseDown.X - e.X), App.viewer.PyramidalOriginTransformed.Y + (ImageView.mouseDown.Y - e.Y));
656 }
657 }
658 }
659 else
660 {
661 App.viewer.Origin = new PointD(App.viewer.Origin.X + (ImageView.mouseDown.X - e.X), App.viewer.Origin.Y + (ImageView.mouseDown.Y - e.Y));
662 }
663 UpdateView();
664 }
665 if (ImageView.SelectedImage == null || selectedROI == null)
666 return;
667 if (currentTool.type == Tool.Type.move && buts.Event.State.HasFlag(Gdk.ModifierType.Button1Mask))
668 {
669 for (int i = 0; i < selectedROI.PointsD.Count; i++)
670 {
671 PointD pd = new PointD(e.X - ImageView.mouseDown.X, e.Y - ImageView.mouseDown.Y);
672 selectedROI.UpdatePoint(new PointD(selectedROI.PointsD[i].X + pd.X, selectedROI.PointsD[i].Y + pd.Y), i);
673 }
674 UpdateView();
675 }
676 if (currentTool.type == Tool.Type.line && buts.Event.State.HasFlag(Gdk.ModifierType.Button1Mask))
677 {
678 selectedROI.UpdatePoint(new PointD(e.X, e.Y), 1);
679 UpdateView();
680 }
681 else
682 if (currentTool.type == Tool.Type.freeform && buts.Event.State.HasFlag(Gdk.ModifierType.Button1Mask))
683 {
684 if (selectedROI.GetPointCount() == 0)
685 {
686 selectedROI.type = ROI.Type.Freeform;
687 selectedROI.AddPoint(new PointD(e.X, e.Y));
688 selectedROI.coord = App.viewer.GetCoordinate();
689 selectedROI.closed = true;
690 //ImageView.SelectedImage.Annotations.Add(selectedROI);
691 AddROI(selectedROI);
692 }
693 else
694 {
695 selectedROI.AddPoint(new PointD(e.X, e.Y));
696 }
697 UpdateView();
698 }
699 else
700 if (currentTool.type == Tool.Type.rect && selectedROI.type == ROI.Type.Rectangle)
701 {
702 if (selectedROI.GetPointCount() == 4)
703 {
704 selectedROI.Rect = new RectangleD(selectedROI.X, selectedROI.Y, e.X - selectedROI.X, e.Y - selectedROI.Y);
705 UpdateView();
706 return;
707 }
708 }
709 else
710 if (currentTool.type == Tool.Type.ellipse && selectedROI.type == ROI.Type.Ellipse)
711 {
712 if (selectedROI.GetPointCount() == 4)
713 {
714 selectedROI.Rect = new RectangleD(selectedROI.X, selectedROI.Y, e.X - selectedROI.X, e.Y - selectedROI.Y);
715 UpdateView();
716 }
717 }
718 else
719 if (currentTool.type == Tool.Type.select && buts.Event.State.HasFlag(Gdk.ModifierType.Button1Mask))
720 {
721 PointD d = new PointD(e.X - ImageView.mouseDown.X, e.Y - ImageView.mouseDown.Y);
722 Tools.GetTool(Tools.Tool.Type.select).Rectangle = new RectangleD(ImageView.mouseDown.X, ImageView.mouseDown.Y,Math.Abs(d.X),Math.Abs(d.Y));
723 RectangleD r = Tools.GetTool(Tools.Tool.Type.select).Rectangle;
724 foreach (ROI an in ImageView.SelectedImage.AnnotationsRGB)
725 {
726 if (an.GetSelectBound(ROI.selectBoxSize * ImageView.SelectedImage.PhysicalSizeX, ROI.selectBoxSize * ImageView.SelectedImage.PhysicalSizeY).IntersectsWith(r))
727 {
728 an.selectedPoints.Clear();
729 ImageView.selectedAnnotations.Add(an);
730 an.Selected = true;
731 RectangleD[] sels = an.GetSelectBoxes(App.viewer.Scale.Width);
732 for (int i = 0; i < sels.Length; i++)
733 {
734 if (sels[i].IntersectsWith(r))
735 {
736 an.selectedPoints.Add(i);
737 }
738 }
739 }
740 else
741 {
742 an.Selected = false;
743 an.selectedPoints.Clear();
744 }
745 }
746 }
747 /*else
748 if (currentTool.type == Tool.Type.select && buts.Event.State != Gdk.ModifierType.Button1Mask)
749 {
750 Tools.GetTool(Tools.Tool.Type.select).Rectangle = new RectangleD(0, 0, 0, 0);
751 }
752 */
753 else
754 if (ImageView.keyDown == Gdk.Key.Delete)
755 {
756 foreach (ROI an in ImageView.selectedAnnotations)
757 {
758 if (an != null)
759 {
760 if (an.selectedPoints.Count == 0)
761 {
762 ImageView.SelectedImage.Annotations.Remove(an);
763 }
764 else
765 {
766 if (an.type == ROI.Type.Polygon ||
767 an.type == ROI.Type.Polyline ||
768 an.type == ROI.Type.Freeform)
769 {
770 an.closed = false;
771 an.RemovePoints(an.selectedPoints.ToArray());
772 }
773 }
774 }
775 }
776 UpdateView();
777 }
778
779 if (Tools.currentTool.type == Tools.Tool.Type.magic && !buts.Event.State.HasFlag(Gdk.ModifierType.Button1Mask))
780 {
781 //First we draw the selection rectangle
782 PointD d = new PointD(e.X - ImageView.mouseDown.X, e.Y - ImageView.mouseDown.Y);
783 Tools.GetTool(Tools.Tool.Type.select).Rectangle = new RectangleD(ImageView.mouseDown.X, ImageView.mouseDown.Y, d.X, d.Y);
784 UpdateView();
785 }
786 }
double X
Definition Bio.cs:457
int GetPointCount()
Definition Bio.cs:1079
Type type
Definition Bio.cs:520
double Y
Definition Bio.cs:469

◆ ToolUp()

void BioGTK.Tools.ToolUp ( PointD  e,
ButtonReleaseEventArgs  buts 
)
inline

The function is called when the mouse button is released

Parameters
PointDA point with double precision
ButtonReleaseEventArgs
Returns
The return type is void.
479 {
480 Plugins.MouseUp(ImageView.SelectedImage, e, buts);
481 PointD p = new PointD((float)e.X, (float)e.Y);
482 PointD mouseU = ImageView.SelectedImage.ToImageSpace(p);
483 if (App.viewer == null || currentTool == null || ImageView.SelectedImage == null)
484 return;
485 Scripting.UpdateState(Scripting.State.GetUp(e, buts.Event.Button));
486 if (currentTool.type == Tool.Type.pan && buts.Event.Button == 2)
487 currentTool = GetTool(Tool.Type.move);
488 if (currentTool.type == Tool.Type.point && buts.Event.Button == 1)
489 {
490 ROI an = new ROI();
491 an.AddPoint(new PointD(e.X, e.Y));
492 an.type = ROI.Type.Point;
493 an.coord = App.viewer.GetCoordinate();
494 an.Selected = true;
495 selectedROI = an;
496 //ImageView.SelectedImage.Annotations.Add(an);
497 AddROI(an);
498 }
499 else
500 if (currentTool.type == Tool.Type.line && selectedROI.type == ROI.Type.Line && buts.Event.Button == 1)
501 {
502 if (selectedROI.GetPointCount() > 0)
503 {
504 selectedROI.UpdatePoint(new PointD(e.X, e.Y), 1);
505 selectedROI = null;
506 }
507 }
508 else
509 if (currentTool.type == Tool.Type.rect && selectedROI.type == ROI.Type.Rectangle && buts.Event.Button == 1)
510 {
511 if (selectedROI.GetPointCount() == 4)
512 {
513 selectedROI = null;
514 }
515 }
516 else
517 if (currentTool.type == Tool.Type.ellipse && selectedROI.type == ROI.Type.Ellipse && buts.Event.Button == 1)
518 {
519 if (selectedROI.GetPointCount() == 4)
520 {
521 selectedROI = null;
522 }
523 }
524 else
525 if (currentTool.type == Tool.Type.freeform && selectedROI.type == ROI.Type.Freeform && buts.Event.Button == 1)
526 {
527 selectedROI = null;
528 }
529 else
530 if (Tools.currentTool.type == Tools.Tool.Type.magic && buts.Event.Button == 1)
531 {
532 PointD pf = new PointD(ImageView.mouseUp.X - ImageView.mouseDown.X, ImageView.mouseUp.Y - ImageView.mouseDown.Y);
533 ZCT coord = App.viewer.GetCoordinate();
534
535 Rectangle r = new Rectangle((int)ImageView.mouseDown.X, (int)ImageView.mouseDown.Y, (int)(ImageView.mouseUp.X - ImageView.mouseDown.X), (int)(ImageView.mouseUp.Y - ImageView.mouseDown.Y));
536 if (r.Width <= 2 || r.Height <= 2)
537 return;
538 AForge.Bitmap bf = ImageView.SelectedImage.Buffers[ImageView.SelectedImage.Coords[coord.Z, coord.C, coord.T]].GetCropBuffer(r);
539 Statistics[] sts = Statistics.FromBytes(bf);
540 Statistics st = sts[0];
541 AForge.Bitmap crop = bf;
542 Threshold th;
543 if (magicSel.Numeric)
544 {
545 th = new Threshold((int)magicSel.Threshold);
546 }
547 else
548 if (magicSel.Index == 2)
549 th = new Threshold((int)(st.Min + st.Mean));
550 else
551 if (magicSel.Index == 1)
552 th = new Threshold((int)st.Median);
553 else
554 th = new Threshold(st.Min);
555 th.ApplyInPlace(crop);
556 Invert inv = new Invert();
557 AForge.Bitmap det;
558 if (bf.BitsPerPixel > 8)
559 det = AForge.Imaging.Image.Convert16bppTo8bpp((crop));
560 else
561 det = crop;
562 BlobCounter blobCounter = new BlobCounter();
563 blobCounter.ProcessImage(det);
564 Blob[] blobs = blobCounter.GetObjectsInformation();
565 // create convex hull searching algorithm
566 GrahamConvexHull hullFinder = new GrahamConvexHull();
567 // lock image to draw on it
568 // process each blob
569 foreach (Blob blob in blobs)
570 {
571 if (blob.Rectangle.Width < magicSel.Max && blob.Rectangle.Height < magicSel.Max)
572 continue;
573 List<IntPoint> leftPoints = new List<IntPoint>();
574 List<IntPoint> rightPoints = new List<IntPoint>();
575 List<IntPoint> edgePoints = new List<IntPoint>();
576 List<IntPoint> hull = new List<IntPoint>();
577 // get blob's edge points
578 blobCounter.GetBlobsLeftAndRightEdges(blob,
579 out leftPoints, out rightPoints);
580 edgePoints.AddRange(leftPoints);
581 edgePoints.AddRange(rightPoints);
582 // blob's convex hull
583 hull = hullFinder.FindHull(edgePoints);
584 PointD[] pfs = new PointD[hull.Count];
585 for (int i = 0; i < hull.Count; i++)
586 {
587 pfs[i] = new PointD(r.X + hull[i].X, r.Y + hull[i].Y);
588 }
589 ROI an = ROI.CreateFreeform(coord, pfs);
590 ImageView.SelectedImage.Annotations.Add(an);
591 }
592 }
593 else
594 if (Tools.currentTool.type == Tools.Tool.Type.bucket && buts.Event.Button == 1)
595 {
596 if (mouseU.X >= ImageView.SelectedImage.SizeX && mouseU.Y >= ImageView.SelectedImage.SizeY)
597 return;
598 floodFiller.FillColor = DrawColor;
599 floodFiller.Tolerance = new ColorS(0, 0, 0);
600 floodFiller.Bitmap = ImageView.SelectedBuffer;
601 floodFiller.FloodFill(new AForge.Point((int)mouseU.X, (int)mouseU.Y));
602 App.viewer.UpdateImages();
603 }
604 else
605 if (Tools.currentTool.type == Tools.Tool.Type.dropper && buts.Event.Button == 1)
606 {
607 if (mouseU.X < ImageView.SelectedImage.SizeX && mouseU.Y < ImageView.SelectedImage.SizeY)
608 {
609 DrawColor = ImageView.SelectedBuffer.GetPixel((int)mouseU.X, (int)mouseU.Y);
610 }
611 }
612 UpdateView();
613 }
AForge.Rectangle Rectangle
Definition ImageView.cs:14
int Threshold
Definition MagicSelect.cs:82
bool Numeric
Definition MagicSelect.cs:74
int Index
Definition MagicSelect.cs:98
int Max
Definition MagicSelect.cs:94
static ColorS DrawColor
Definition Tools.cs:207

◆ UpdateView()

void BioGTK.Tools.UpdateView ( )
inline

‍UpdateView() is a function that updates the view of the viewer.

272 {
273 App.viewer.UpdateView();
274 }

Member Data Documentation

◆ applyToStack

bool BioGTK.Tools.applyToStack = false
static

◆ bEnabled

bool BioGTK.Tools.bEnabled = true
static

◆ colorOne

bool BioGTK.Tools.colorOne = true
static

◆ colorTool

ColorTool BioGTK.Tools.colorTool
static

◆ currentTool

Tool BioGTK.Tools.currentTool
static

◆ drawColor

ColorS BioGTK.Tools.drawColor = new ColorS(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)
static

◆ eraseColor

ColorS BioGTK.Tools.eraseColor = new ColorS(0, 0, 0)
static

◆ gEnabled

bool BioGTK.Tools.gEnabled = true
static

◆ rEnabled

bool BioGTK.Tools.rEnabled = true
static

◆ selectedROI

ROI BioGTK.Tools.selectedROI = null
static

◆ selectionRect

RectangleD BioGTK.Tools.selectionRect
static

◆ selectionRectangle

Rectangle BioGTK.Tools.selectionRectangle
static

◆ ti

TextInput BioGTK.Tools.ti = null
static

◆ tolerance

ColorS BioGTK.Tools.tolerance = new ColorS(0, 0, 0)
static

◆ tools

Dictionary<string,Tool> BioGTK.Tools.tools = new Dictionary<string, Tool>()
static

Property Documentation

◆ DrawColor

ColorS BioGTK.Tools.DrawColor
staticgetset
207 {
208 get
209 {
210 return drawColor;
211 }
212 set
213 {
214 drawColor = value;
215 tools[Tool.Type.color1.ToString()].color = drawColor;
216 }
217 }
static ColorS drawColor
Definition Tools.cs:72

◆ EraseColor

ColorS BioGTK.Tools.EraseColor
staticgetset
220 {
221 get
222 {
223 return eraseColor;
224 }
225 set
226 {
227 eraseColor = value;
228 tools[Tool.Type.color2.ToString()].color = eraseColor;
229 }
230 }
static ColorS eraseColor
Definition Tools.cs:73

◆ StrokeWidth

int BioGTK.Tools.StrokeWidth
staticgetset
234 {
235 get
236 {
237 return width;
238 }
239 set
240 {
241 width = value;
242 }
243 }

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