BioImager  5.0.0
A .NET microscopy imaging application based on Bio library. Supports various microscopes by using imported libraries & GUI automation. Supports XInput game controllers to move stage, take images, run ImageJ macros on images or Bio C# scripts.
Loading...
Searching...
No Matches
BioImager.ImageView Class Reference

ImageView control for image stacks, pyramidal and whole-slide-images. More...

Inheritance diagram for BioImager.ImageView:

Classes

struct  Layer
 

Public Types

enum  ViewMode { Raw , Filtered , RGBImage , Emission }
 

Public Member Functions

 ImageView (BioImage im, bool OpenWithOpenSlide=true)
 Initializing the image viewer. *‍/.
 
 ImageView ()
 Initializing the ImageView class. *‍/.
 
void SetCoordinate (int z, int c, int t)
 
ZCT GetCoordinate ()
 
void AddImage (BioImage im)
 
void UpdateRGBChannels ()
 
void InitGUI ()
 
void UpdateSelectBoxSize (float size)
 
void UpdateOverlay ()
 
void UpdateStatus ()
 
void UpdateView (bool refreshImages=true)
 
void UpdateViewLegacy (bool refresh)
 
async void UpdateImages (bool updatePyramidal=true)
 
void RemoveImage (int i)
 
void RemoveImages ()
 
void UpdateImage ()
 
void GetRange ()
 
void DrawView (System.Drawing.Graphics g)
 Draws the viewport when Hardware Acceleration is off.
 
double GetScale ()
 
double GetSelectionBoxHitSize ()
 
void CopySelection ()
 It takes the selected ROIs and copies them to the clipboard.
 
void PasteSelection ()
 
PointD ImageToViewSpace (double x, double y)
 
PointF ToViewSpace (PointF p)
 
PointD ToViewSpace (PointD p)
 
PointD ToViewSpace (double x, double y)
 
double ToViewSizeH (double d)
 
double ToViewW (double d)
 
double ToViewH (double d)
 
PointD ToScreenSpace (double x, double y)
 
PointD ToScreenSpace (PointD p)
 
PointF ToScreenSpace (PointF p)
 
PointF[] ToScreenSpace (PointF[] p)
 
PointF ToScreenSpace (Point3D p)
 
float ToScreenScaleW (double x)
 
float ToScreenScaleH (double y)
 
PointF ToScreenScale (PointD p)
 
RectangleD ToScreenRect (double x, double y, double w, double h)
 
SKRect ToSKRect (double x, double y, double w, double h)
 
RectangleD ToScreenSpace (RectangleD p)
 
RectangleD ToScreenSpace (RectangleF p)
 
RectangleD[] ToScreenSpace (RectangleD[] p)
 
RectangleF[] ToScreenSpace (RectangleF[] p)
 
PointF[] ToScreenSpace (PointD[] p)
 
float ToScreenW (double x)
 
float ToScreenH (double y)
 
void ImageView_KeyDown (object sender, KeyEventArgs e)
 
void GoToImage ()
 
void GoToImage (int i)
 
new void Dispose ()
 
void GoToStage ()
 
void MoveStageToImage ()
 
void MoveStageToImage (int i)
 

Public Attributes

List< Layer > Layers = new List<Layer>()
 
Image Buf = null
 
bool init = false
 
List< BioImage > Images = new List<BioImage>()
 
string filepath = ""
 
int serie = 0
 
int minSizeX = 50
 
int minSizeY = 20
 
bool loopZ = true
 
bool loopT = true
 
bool loopC = true
 
bool showRROIs = true
 
bool showGROIs = true
 
bool showBROIs = true
 
Drawing.Bitmap overviewImage
 

Static Public Attributes

static List< ROI > selectedAnnotations = new List<ROI>()
 
static PointD mouseDown
 
static bool down
 
static PointD mouseUp
 
static bool up
 
static MouseButtons mouseUpButtons
 
static MouseButtons mouseDownButtons
 
static bool showBounds = true
 
static bool showText = true
 

Protected Member Functions

override bool ProcessCmdKey (ref Message msg, Keys keyData)
 
override void Dispose (bool disposing)
 Clean up any resources being used.
 
override void OnLayout (LayoutEventArgs e)
 

Properties

static BioImage SelectedImage [get, set]
 
static Bitmap SelectedBuffer [get]
 
static bool Ctrl [get]
 
int SelectedIndex = 0 [get, set]
 A property that is used to set the selected index of the image. *‍/.
 
Tools tools [get]
 
Rectangle OverView [get]
 
bool ShowStage [get, set]
 
bool ShowControls [get, set]
 Setting the visibility of the trackBarPanel. *‍/.
 
bool ShowStatus [get, set]
 Setting the value of the property ShowStatus. *‍/.
 
double PxWmicron [get, set]
 Only used when opening stacks.
 
double PxHmicron [get, set]
 Only used when opening stacks.
 
ViewMode Mode [get, set]
 Setting the view mode of the application. *‍/.
 
string Path [get]
 A property that returns the filepath. *‍/.
 
Channel RChannel [get]
 A property that returns the R channel of the selected image. *‍/.
 
Channel GChannel [get]
 A property that returns the G channel of the image. *‍/.
 
Channel BChannel [get]
 Getting the B channel of the image. *‍/.
 
bool OpenSlide [get]
 
int? MacroResolution [get]
 
int? LabelResolution [get]
 
int ViewWidth [get]
 
int ViewHeight [get]
 
PointD Origin [get, set]
 A property of the class PointD. *‍/.
 
PointD PyramidalOrigin [get, set]
 Setting the value of the pyramidalOrigin variable. *‍/.
 
double Resolution [get, set]
 A property of the class ImageViewer. It is a getter and setter for the resolution of the image.
 
int Level [get]
 Current level when viewing whole-slide and pyramidal images.
 
new AForge.SizeF Scale [get, set]
 Scale when opening image stacks.
 
ContextMenuStrip ViewContextMenu [get]
 A property that returns a ContextMenuStrip object. *‍/.
 
int ZFps [get, set]
 Setting the interval of the timer to the value of the fps. *‍/.
 
int TimeFps [get, set]
 Setting the interval of the timer to the value of the timefps variable. *‍/.
 
int CFps [get, set]
 Setting the interval of the timer to the inverse of the fps. *‍/.
 
List< ROI > AnnotationsR [get]
 
List< ROI > AnnotationsG [get]
 
List< ROI > AnnotationsB [get]
 
List< ROI > AnnotationsRGB [get]
 
PointD PyramidalOriginTransformed [get, set]
 
PointD MouseDownInt [get, set]
 
PointD MouseUpInt [get, set]
 
PointD MouseMoveInt [get, set]
 
bool ShowMasks = true [get, set]
 
bool ShowOverview [get, set]
 

Detailed Description

ImageView control for image stacks, pyramidal and whole-slide-images.

Definition at line 6 of file ImageView.ScrollBars.cs.

Member Enumeration Documentation

◆ ViewMode

Enumerator
Raw 
Filtered 
RGBImage 
Emission 

Definition at line 598 of file ImageView.cs.

Constructor & Destructor Documentation

◆ ImageView() [1/2]

BioImager.ImageView.ImageView ( BioImage im,
bool OpenWithOpenSlide = true )

Initializing the image viewer. *‍/.

Definition at line 36 of file ImageView.cs.

37 {
38 string file = im.ID.Replace("\\", "/");
39 InitializeComponent();
40 bool useGpuTiles = im.Resolutions.Count > 1;
41 BioLib.SlideSourceBase.UseGPU = useGpuTiles;
42 OpenSlideGTK.SlideSourceBase.useGPU = useGpuTiles;
43 viewpanel.Paint += Viewpanel_Paint;
44 AttachViewerInput(viewpanel);
45
46 if (im.isPyramidal)
47 {
48 gl.Size = new System.Drawing.Size(800, 600);
49 if (im.openSlideImage != null && OpenWithOpenSlide)
50 {
51 Initialize(im.file, im);
52 }
53 else
54 Initialize(im.file, im);
55 hScrollBar.Visible = true;
56 vScrollBar.Visible = true;
57 }
58 else
59 {
60 hScrollBar.Visible = false;
61 vScrollBar.Visible = false;
62 Tools.selectBoxSize = GetSelectBoxSize();
63 }
64 App.viewer = this;
65 serie = im.series;
66 gl.Dock = DockStyle.Fill;
67 viewpanel.Controls.Add(gl);
68 AttachViewerInput(gl);
69 InitializeOverview();
70 Dock = DockStyle.Fill;
71 AddImage(im);
72 UpdateRenderSurfaceMode();
73 App.viewer = this;
74 if (file == "" || file == null)
75 return;
76 InitGUI();
77 MouseWheel += new System.Windows.Forms.MouseEventHandler(ImageView_MouseWheel);
78 zBar.MouseWheel += new System.Windows.Forms.MouseEventHandler(ZTrackBar_MouseWheel);
79 cBar.MouseWheel += new System.Windows.Forms.MouseEventHandler(CTrackBar_MouseWheel);
80 tBar.MouseWheel += new System.Windows.Forms.MouseEventHandler(TimeTrackBar_MouseWheel);
81 //We set the trackbar event to handled so that it only scrolls one tick not the default multiple.
82 zBar.MouseWheel += (sender, e) => ((HandledMouseEventArgs)e).Handled = true;
83 tBar.MouseWheel += (sender, e) => ((HandledMouseEventArgs)e).Handled = true;
84 cBar.MouseWheel += (sender, e) => ((HandledMouseEventArgs)e).Handled = true;
85 this.SizeChanged += ImageView_SizeChanged;
86 this.KeyDown += ImageView_KeyDown;
87 this.KeyPress += ImageView_KeyPress;
88 this.KeyUp += ImageView_KeyUp;
89 TimeFps = 60;
90 ZFps = 60;
91 CFps = 1;
92 resolutions = im.Resolutions;
93 if (im.isPyramidal)
94 {
95 // Keep the renderer bound to the currently selected pyramidal source.
96 if (im.OpenSlideBase != null)
97 {
98 if (slideRenderer == null)
99 slideRenderer = new SlideRenderer(gl);
100 if (!slideRenderer.IsSource(im.OpenSlideBase))
101 slideRenderer.SetSource(im.OpenSlideBase);
102 }
103 else if (im.SlideBase != null)
104 {
105 if (slideRenderer == null)
106 slideRenderer = new SlideRenderer(gl);
107 if (!slideRenderer.IsSource(im.SlideBase))
108 slideRenderer.SetSource(im.SlideBase);
109 }
110 }
111 InitGL();
112 update = true;
113 InitPreview();
114 GoToImage();
115 UpdateImages();
116 Mode = ViewMode.Filtered;
117 UpdateView();
118
119 }
void UpdateView(bool refreshImages=true)
ViewMode Mode
Setting the view mode of the application. *‍/.
Definition ImageView.cs:609
int TimeFps
Setting the interval of the timer to the value of the timefps variable. *‍/.
Definition ImageView.cs:843
int CFps
Setting the interval of the timer to the inverse of the fps. *‍/.
Definition ImageView.cs:859
int ZFps
Setting the interval of the timer to the value of the fps. *‍/.
Definition ImageView.cs:827
void ImageView_KeyDown(object sender, KeyEventArgs e)
void AddImage(BioImage im)
Definition ImageView.cs:475
async void UpdateImages(bool updatePyramidal=true)
void SetSource(OpenSlideBase source)
bool IsSource(OpenSlideBase source)

◆ ImageView() [2/2]

BioImager.ImageView.ImageView ( )

Initializing the ImageView class. *‍/.

Definition at line 121 of file ImageView.cs.

122 {
123 InitializeComponent();
124 viewpanel.Paint += Viewpanel_Paint;
125 AttachViewerInput(viewpanel);
126 InitGL();
127 AttachViewerInput(gl);
128 InitializeOverview();
129 Dock = DockStyle.Fill;
130 App.viewer = this;
131 InitGUI();
132 //Buf = image.GetBufByCoord(GetCoordinate());
133 MouseWheel += new System.Windows.Forms.MouseEventHandler(ImageView_MouseWheel);
134 zBar.MouseWheel += new System.Windows.Forms.MouseEventHandler(ZTrackBar_MouseWheel);
135 cBar.MouseWheel += new System.Windows.Forms.MouseEventHandler(CTrackBar_MouseWheel);
136 tBar.MouseWheel += new System.Windows.Forms.MouseEventHandler(TimeTrackBar_MouseWheel);
137 this.SizeChanged += ImageView_SizeChanged;
138 //We set the trackbar event to handled so that it only scrolls one tick not the default multiple.
139 zBar.MouseWheel += (sender, e) => ((HandledMouseEventArgs)e).Handled = true;
140 tBar.MouseWheel += (sender, e) => ((HandledMouseEventArgs)e).Handled = true;
141 cBar.MouseWheel += (sender, e) => ((HandledMouseEventArgs)e).Handled = true;
142 TimeFps = 60;
143 ZFps = 60;
144 CFps = 1;
145 update = true;
146 UpdateImages();
147 GoToImage();
148 UpdateView();
149 }

Member Function Documentation

◆ AddImage()

void BioImager.ImageView.AddImage ( BioImage im)

This function adds an image to the list of images, and then updates the GUI to reflect the new image

Parameters
BioImageThis is a class that contains the image data, and some other information about the image.

Definition at line 475 of file ImageView.cs.

476 {
477 ZCT initialCoordinate = new ZCT(im.Coordinate.Z, im.Coordinate.C, im.Coordinate.T);
478 Images.Add(im);
479 SelectedIndex = Images.Count - 1;
480 centerOnNextResize = true;
481 bool c = false;
482 foreach (var item in Layers)
483 {
484 if (item.Resolution == im.PhysicalSizeX)
485 c = true;
486 }
487 if (!c)
488 Layers.Add(new Layer(im.PhysicalSizeX));
489 if (im.isPyramidal)
490 {
491 hScrollBar.Visible = true;
492 vScrollBar.Visible = true;
493 }
494 else
495 {
496 hScrollBar.Visible = false;
497 vScrollBar.Visible = false;
498 Tools.selectBoxSize = GetSelectBoxSize();
499 }
500 InitGUI();
501 SetCoordinate(initialCoordinate.Z, initialCoordinate.C, initialCoordinate.T);
502 UpdateImages();
503
504 GoToImage(Images.Count - 1);
505 QueueInitialCenterAfterLayout(Images.Count - 1);
506 }
AForge.ZCT ZCT
Definition TabsView.cs:17
List< BioImage > Images
Definition ImageView.cs:323
void SetCoordinate(int z, int c, int t)
Definition ImageView.cs:431
int SelectedIndex
A property that is used to set the selected index of the image. *‍/.
Definition ImageView.cs:390
List< Layer > Layers
Definition ImageView.cs:254

◆ CopySelection()

void BioImager.ImageView.CopySelection ( )

It takes the selected ROIs and copies them to the clipboard.

Definition at line 3187 of file ImageView.cs.

3188 {
3189 copys.Clear();
3190 string s = "";
3191 foreach (ROI item in AnnotationsRGB)
3192 {
3193 if (item.Selected)
3194 {
3195 copys.Add(item);
3196 s += BioImage.ROIToString(item);
3197 }
3198 }
3199 System.Windows.Forms.Clipboard.SetText(s);
3200 }
BioLib.BioImage BioImage
Definition TabsView.cs:15
List< ROI > AnnotationsRGB

◆ Dispose() [1/2]

new void BioImager.ImageView.Dispose ( )

Definition at line 3951 of file ImageView.cs.

3952 {
3953 foreach (var bitmap in Bitmaps)
3954 bitmap?.Dispose();
3955 Bitmaps.Clear();
3956 base.Dispose();
3957 }

◆ Dispose() [2/2]

override void BioImager.ImageView.Dispose ( bool disposing)
protected

Clean up any resources being used.

Parameters
disposingtrue if managed resources should be disposed; otherwise, false.

Definition at line 15 of file ImageView.designer.cs.

16 {
17 if (disposing && (components != null))
18 {
19 components.Dispose();
20 }
21 base.Dispose(disposing);
22 }

◆ DrawView()

void BioImager.ImageView.DrawView ( System.Drawing.Graphics g)

Draws the viewport when Hardware Acceleration is off.

Parameters
g

Definition at line 2562 of file ImageView.cs.

2563 {
2564 try
2565 {
2566 drawing = true;
2567 if (SelectedImage == null)
2568 return;
2569 if (UsesSlideRenderer(SelectedImage))
2570 {
2571 UpdateImages();
2572 return;
2573 }
2574 g.TranslateTransform(ViewWidth / 2, ViewHeight / 2);
2575 if (Scale.Width == 0 || float.IsInfinity(Scale.Width))
2576 Scale = new SizeF(1, 1);
2577 g.ScaleTransform(Scale.Width, Scale.Height);
2578 if (Bitmaps.Count == 0)
2579 return;
2580 System.Drawing.RectangleF[] rf = new System.Drawing.RectangleF[1];
2581 System.Drawing.Pen blue = new System.Drawing.Pen(Brushes.Blue, 1 / Scale.Width);
2582 int i = 0;
2583 foreach (BioImage im in Images)
2584 {
2585 if (!IsLayerEnabled(im.PhysicalSizeX) && !im.isPyramidal)
2586 continue;
2587 RectangleD r = ToScreenRect(im.Volume.Location.X, im.Volume.Location.Y, im.Volume.Width, im.Volume.Height);
2588 double w = ToViewW(ViewWidth);
2589 double h = ToViewH(ViewHeight);
2590 RectangleF rg = new RectangleF((float)((-Origin.X) - (w / 2)), (float)((-Origin.Y) - (h / 2)), (float)(w), (float)(h));
2591 RectangleF rec = new RectangleF((float)im.Volume.Location.X, (float)im.Volume.Location.Y, (float)im.Volume.Width, (float)im.Volume.Height);
2592 if (SelectedImage.isPyramidal)
2593 {
2594 var tr = g.Transform;
2595 g.ResetTransform();
2596 g.DrawImage(Bitmaps[i], 0, 0);
2597 g.Transform = tr;
2598 }
2599 else
2600 if (rg.IntersectsWith(rec))
2601 {
2602 g.DrawImage(Bitmaps[i], (float)r.X, (float)r.Y, (float)r.W, (float)r.H);
2603 }
2604 if (i == SelectedIndex && !SelectedImage.isPyramidal)
2605 {
2606 rf[0] = new System.Drawing.RectangleF((float)r.X, (float)r.Y, (float)r.W, (float)r.H);
2607 g.DrawRectangles(blue, rf);
2608 }
2609 i++;
2610 }
2611 if (ShowStage)
2612 {
2613 RectangleD d = Microscope.GetViewRectangle(false);
2614 RectangleF[] rfs = new RectangleF[1] { new RectangleF((float)d.X, (float)d.Y, (float)d.W, (float)d.H) };
2615 var v = ToScreenSpace(rfs);
2616 System.Drawing.Pen red = new System.Drawing.Pen(Brushes.Red, 1 / Scale.Width);
2617 g.DrawRectangle(red, v[0].X, v[0].Y, v[0].Width, v[0].Height);
2618 }
2619 blue.Dispose();
2620 update = false;
2621 drawing = false;
2622 }
2623 catch (Exception e)
2624 {
2625 Console.WriteLine(e.Message);
2626 }
2627 }
AForge.RectangleD RectangleD
AForge.RectangleF RectangleF
System.Drawing.SizeF SizeF
new AForge.SizeF Scale
Scale when opening image stacks.
Definition ImageView.cs:779
PointD Origin
A property of the class PointD. *‍/.
Definition ImageView.cs:718
PointD ToScreenSpace(double x, double y)
double ToViewW(double d)
RectangleD ToScreenRect(double x, double y, double w, double h)
static BioImage SelectedImage
Definition ImageView.cs:270
double ToViewH(double d)

◆ GetCoordinate()

ZCT BioImager.ImageView.GetCoordinate ( )

It returns the coordinate of the selected image

Returns
The Coordinate property of the SelectedImage object.

Definition at line 463 of file ImageView.cs.

464 {
465 if (SelectedImage != null)
466 return SelectedImage.Coordinate;
467 else
468 return new ZCT();
469 }

◆ GetRange()

void BioImager.ImageView.GetRange ( )

It creates a new RangeTool object, which is a form that allows the user to set the range of the data to be displayed.

The RangeTool object is created with the following parameters:

  • timeEnabled: a boolean that indicates whether the data has a time component.
  • Mode: a ViewMode enum that indicates whether the data is filtered or not.
  • zBar.Minimum: the minimum value of the zBar.
  • zBar.Maximum: the maximum value of the zBar.
  • tBar.Minimum: the minimum value of the tBar.
  • tBar.Maximum: the maximum value of the tBar.
  • cBar.Minimum: the minimum value of the cBar.
  • cBar.Maximum: the maximum value of the cBar.

The RangeTool object is then shown to the user.

If the user clicks the

Returns
A RangeTool object.

Definition at line 1879 of file ImageView.cs.

1880 {
1881 RangeTool t;
1882 if (Mode == ViewMode.Filtered)
1883 t = new RangeTool(timeEnabled, true, zBar.Minimum, zBar.Maximum, tBar.Minimum, tBar.Maximum, cBar.Minimum, cBar.Maximum);
1884 else
1885 t = new RangeTool(timeEnabled, false, zBar.Minimum, zBar.Maximum, tBar.Minimum, tBar.Maximum, cBar.Minimum, cBar.Maximum);
1886 if (t.ShowDialog() != DialogResult.OK)
1887 return;
1888 zBar.Minimum = t.ZMin;
1889 zBar.Maximum = t.ZMax;
1890 tBar.Minimum = t.TimeMin;
1891 tBar.Maximum = t.TimeMax;
1892 cBar.Minimum = t.CMin;
1893 cBar.Maximum = t.CMax;
1894 }

◆ GetScale()

double BioImager.ImageView.GetScale ( )

GetScale() returns the scale of the image in the viewport.

Returns
The scale of the image.

Definition at line 2658 of file ImageView.cs.

2659 {
2660 return GetSelectionBoxHitSize();
2661 }
double GetSelectionBoxHitSize()

◆ GetSelectionBoxHitSize()

double BioImager.ImageView.GetSelectionBoxHitSize ( )

Definition at line 2663 of file ImageView.cs.

2664 {
2665 return GetSelectBoxSizeForScreenPixels(MinSelectionHitScreenSize);
2666 }

◆ GoToImage() [1/2]

void BioImager.ImageView.GoToImage ( )

If the selected image is not null, set the origin to the center of the image, and set the scale to the height of the image.

Returns
The method is returning the value of the variable "Scale"

Definition at line 3728 of file ImageView.cs.

3729 {
3731 }

◆ GoToImage() [2/2]

void BioImager.ImageView.GoToImage ( int i)

It takes an image index and centers the image in the viewport

Parameters
ithe index of the image to go to
Returns
The method is returning the value of the variable "i"

Definition at line 3770 of file ImageView.cs.

3771 {
3772 if (i < 0 || Images.Count <= i)
3773 return;
3774 App.viewer = this;
3775 if (SelectedIndex != i)
3776 SelectedIndex = i;
3777 BioImage image = Images[i];
3778 int viewportWidth = GetEffectiveViewWidth();
3779 int viewportHeight = GetEffectiveViewHeight();
3780 if (UsesSlideRenderer(image))
3781 {
3782 CenterPyramidalImage(image, viewportWidth, viewportHeight);
3783 UpdateView();
3784 return;
3785 }
3786
3787 double dx = image.Volume.Width / 2;
3788 double dy = image.Volume.Height / 2;
3789 origin = new PointD(-(image.Volume.Location.X + dx), -(image.Volume.Location.Y + dy));
3790 double screenWidth = Math.Abs(ToScreenScaleW(image.Volume.Width));
3791 double screenHeight = Math.Abs(ToScreenScaleH(image.Volume.Height));
3792 double wx = screenWidth > 0 ? viewportWidth / screenWidth : 1;
3793 double wy = screenHeight > 0 ? viewportHeight / screenHeight : 1;
3794 double fitScale = Math.Min(wx, wy);
3795 if (fitScale <= 0 || double.IsNaN(fitScale) || double.IsInfinity(fitScale))
3796 fitScale = 1;
3797 scale = new SizeF((float)fitScale, (float)fitScale);
3798 update = true;
3799 UpdateView();
3800 }
AForge.PointD PointD
float ToScreenScaleH(double y)
float ToScreenScaleW(double x)

◆ GoToStage()

void BioImager.ImageView.GoToStage ( )

Definition at line 4071 of file ImageView.cs.

4072 {
4074 double dx = d.W / 2;
4075 double dy = d.H / 2;
4076 Origin = new PointD(-(d.X + dx), -(d.Y + dy));
4077 double wx, wy;
4078 wx = Math.Abs(ViewWidth / ToScreenScaleW(d.W));
4079 wy = Math.Abs(ViewHeight / ToScreenScaleH(d.H));
4080 scale.Width = (float)wy;
4081 scale.Height = (float)wy;
4082 update = true;
4083 UpdateView();
4084 }
static RectangleD GetViewRectangle(bool update)

◆ ImageToViewSpace()

PointD BioImager.ImageView.ImageToViewSpace ( double x,
double y )

It takes a point in the image space and returns the point in the view space

Parameters
xthe x coordinate of the point in the image
ythe y coordinate of the point in the image
Returns
The point in the image space that corresponds to the point in the view space.

Definition at line 3301 of file ImageView.cs.

3302 {
3303 if (SelectedImage == null)
3304 return ToViewSpace(x, y);
3305 if (SelectedImage.isPyramidal)
3306 {
3307 return new PointD(PyramidalOrigin.X + (x * Resolution), PyramidalOrigin.Y + (y * Resolution));
3308 }
3309 else
3310 return ToViewSpace(x, y);
3311 }
PointD PyramidalOrigin
Setting the value of the pyramidalOrigin variable. *‍/.
Definition ImageView.cs:730
PointF ToViewSpace(PointF p)
double Resolution
A property of the class ImageViewer. It is a getter and setter for the resolution of the image.
Definition ImageView.cs:746

◆ ImageView_KeyDown()

void BioImager.ImageView.ImageView_KeyDown ( object sender,
KeyEventArgs e )

If the user presses the "C" key while holding down the "Control" key, then the function "CopySelection" is called

Parameters
senderThe object that raised the event.
KeyEventArgsThe event arguments for the key press.
Returns
The return value is a PointD object.

Definition at line 3651 of file ImageView.cs.

3652 {
3653 double moveAmount = 5 * Scale.Width;
3654 Plugins.KeyDownEvent(sender, e);
3655 if (e.KeyCode == Keys.C && e.Control)
3656 {
3657 CopySelection();
3658 return;
3659 }
3660 if (e.KeyCode == Keys.V && e.Control)
3661 {
3663 return;
3664 }
3665 if (e.KeyCode == Keys.Subtract || e.KeyCode == Keys.NumPad7)
3666 {
3667 if (SelectedImage.isPyramidal)
3668 ZoomPyramidalAt(new System.Drawing.Point(ViewWidth / 2, ViewHeight / 2), 0.9);
3669 else
3670 Scale = new SizeF(Scale.Width - 0.1f, Scale.Height - 0.1f);
3671 if (!SelectedImage.isPyramidal)
3672 UpdateView();
3673 }
3674 if (e.KeyCode == Keys.Add || e.KeyCode == Keys.NumPad9)
3675 {
3676 if (SelectedImage.isPyramidal)
3677 ZoomPyramidalAt(new System.Drawing.Point(ViewWidth / 2, ViewHeight / 2), 1.1);
3678 else
3679 Scale = new SizeF(Scale.Width + 0.1f, Scale.Height + 0.1f);
3680 if (!SelectedImage.isPyramidal)
3681 UpdateView();
3682 }
3683 if (e.KeyCode == Keys.W || e.KeyCode == Keys.NumPad8)
3684 {
3685 if (SelectedImage.isPyramidal)
3686 PyramidalOrigin = new PointD(PyramidalOrigin.X, PyramidalOrigin.Y - moveAmount);
3687 else
3688 Origin = new PointD(Origin.X, Origin.Y + moveAmount);
3689 UpdateView();
3690 }
3691 if (e.KeyCode == Keys.S || e.KeyCode == Keys.NumPad2)
3692 {
3693 if (SelectedImage.isPyramidal)
3694 PyramidalOrigin = new PointD(PyramidalOrigin.X, PyramidalOrigin.Y + moveAmount);
3695 else
3696 Origin = new PointD(Origin.X, Origin.Y - moveAmount);
3697 UpdateView();
3698 }
3699 if (e.KeyCode == Keys.A || e.KeyCode == Keys.NumPad4)
3700 {
3701 if (SelectedImage.isPyramidal)
3702 PyramidalOrigin = new PointD(PyramidalOrigin.X - moveAmount, PyramidalOrigin.Y);
3703 else
3704 Origin = new PointD(Origin.X + moveAmount, Origin.Y);
3705 UpdateView();
3706 }
3707 if (e.KeyCode == Keys.D || e.KeyCode == Keys.NumPad6)
3708 {
3709 if (SelectedImage.isPyramidal)
3710 PyramidalOrigin = new PointD(PyramidalOrigin.X + moveAmount, PyramidalOrigin.Y);
3711 else
3712 Origin = new PointD(Origin.X - moveAmount, Origin.Y);
3713 UpdateView();
3714 }
3715 }
System.Windows.Forms.Keys Keys
Definition ImageView.cs:17
void CopySelection()
It takes the selected ROIs and copies them to the clipboard.
static void KeyDownEvent(object o, KeyEventArgs e)
Definition Plugin.cs:71

◆ InitGUI()

void BioImager.ImageView.InitGUI ( )

It initializes the GUI

Returns
The image is being returned.

Definition at line 874 of file ImageView.cs.

875 {
876 if (SelectedImage == null)
877 return;
878 ZCT coordinate = new ZCT(SelectedImage.Coordinate.Z, SelectedImage.Coordinate.C, SelectedImage.Coordinate.T);
879 initializingCoordinates = true;
880 ZarrChannelView.InitializeChannels(SelectedImage);
881 zBar.Maximum = Math.Max(0, SelectedImage.SizeZ - 1);
882 if (!SelectedImage.IsZarrSource && SelectedImage.Buffers.Count > 0 && SelectedImage.Buffers[0].RGBChannelsCount == 3)
883 cBar.Maximum = 0;
884 else
885 cBar.Maximum = Math.Max(0, SelectedImage.SizeC - 1);
886 if (SelectedImage.SizeT > 1)
887 {
888 tBar.Maximum = Math.Max(0, SelectedImage.SizeT - 1);
889 tBar.Enabled = true;
890 timeEnabled = true;
891 }
892 else
893 {
894 tBar.Enabled = false;
895 timeEnabled = false;
896 tBar.Maximum = Math.Max(0, SelectedImage.SizeT - 1);
897 }
898 //rgbPictureBox.Image = image.plane.GetBitmap();
899 //we clear the channel comboboxes incase we have channels from previous loaded image.
900 bool sameImage = ReferenceEquals(rgbSelectorImage, SelectedImage);
901 rgbSelectorImage = SelectedImage;
902 bool[] previousEnabled = (bool[])rgbEnabled.Clone();
903 int[] previousChannels = (int[])SelectedImage.rgbChannels.Clone();
904 initializingRgbSelectors = true;
905 channelBoxR.Items.Clear();
906 channelBoxG.Items.Clear();
907 channelBoxB.Items.Clear();
908
909 channelBoxR.Items.Add("");
910 channelBoxG.Items.Add("");
911 channelBoxB.Items.Add("");
912 foreach (Channel ch in SelectedImage.Channels)
913 {
914 channelBoxR.Items.Add(ch);
915 channelBoxG.Items.Add(ch);
916 channelBoxB.Items.Add(ch);
917 }
918 System.Windows.Forms.ComboBox[] rgbBoxes = { channelBoxR, channelBoxG, channelBoxB };
919 int count = SelectedImage.Channels.Count;
920 for (int i = 0; i < rgbBoxes.Length; i++)
921 rgbBoxes[i].SelectedIndex = count == 0 || (sameImage && !previousEnabled[i]) ? 0 :
922 (sameImage ? Math.Clamp(previousChannels[i], 0, count - 1) : (i < count ? i : 0)) + 1;
923 initializingRgbSelectors = false;
924 zBar.Value = Math.Clamp(coordinate.Z, zBar.Minimum, zBar.Maximum);
925 cBar.Value = Math.Clamp(coordinate.C, cBar.Minimum, cBar.Maximum);
926 tBar.Value = Math.Clamp(coordinate.T, tBar.Minimum, tBar.Maximum);
927 SelectedImage.Coordinate = new ZCT(zBar.Value, cBar.Value, tBar.Value);
928 initializingCoordinates = false;
930
931 init = true;
932 }

◆ MoveStageToImage() [1/2]

void BioImager.ImageView.MoveStageToImage ( )

Move the stage to the location of the selected image

Returns
The method is returning the value of the SelectedImage property.

Definition at line 4088 of file ImageView.cs.

4089 {
4090 if (SelectedImage == null)
4091 return;
4092 Microscope.Stage.SetPosition(SelectedImage.Volume.Location.X, SelectedImage.Volume.Location.Y);
4093 update = true;
4094 UpdateView();
4095 }
static Stage Stage
void SetPosition(double px, double py)
Definition Microscope.cs:69

◆ MoveStageToImage() [2/2]

void BioImager.ImageView.MoveStageToImage ( int i)

Move the stage to the location of the image at index i

Parameters
ithe index of the image in the list of images

Definition at line 4099 of file ImageView.cs.

4100 {
4101 update = true;
4102 Microscope.Stage.SetPosition(Images[i].Volume.Location.X, Images[i].Volume.Location.Y);
4103 UpdateView();
4104 }

◆ OnLayout()

override void BioImager.ImageView.OnLayout ( LayoutEventArgs e)
protected

Definition at line 16 of file ImageView.Layout.cs.

17 {
18 base.OnLayout(e);
19 if (viewpanel == null || statusPanel == null || trackBarPanel == null ||
20 hScrollBar == null || vScrollBar == null)
21 return;
22
23 int top = showStatus ? statusPanel.Bottom : 0;
24 int bottom = showControls ? trackBarPanel.Top : ClientSize.Height;
25 bool pyramidal = SelectedIndex >= 0 && SelectedIndex < Images.Count && UsesSlideRenderer(Images[SelectedIndex]);
26 int width = Math.Max(0, ClientSize.Width - (pyramidal ? vScrollBar.Width : 0));
27 int height = Math.Max(0, bottom - top - (pyramidal ? hScrollBar.Height : 0));
28 viewpanel.Bounds = new System.Drawing.Rectangle(0, top, width, height);
29 hScrollBar.SetBounds(0, top + height, width, hScrollBar.Height);
30 vScrollBar.SetBounds(width, top, vScrollBar.Width, height);
31 UpdateScrollBars();
32 }

◆ PasteSelection()

void BioImager.ImageView.PasteSelection ( )

We get the text from the clipboard, split it into lines, and then for each line, if it's longer than 8 characters, we convert it to an ROI and add it to the image

Definition at line 3203 of file ImageView.cs.

3204 {
3205 string[] sts = System.Windows.Forms.Clipboard.GetText().Split(BioImage.NewLine);
3206 foreach (string line in sts)
3207 {
3208 if (line.Length > 8)
3209 {
3210 ROI an = BioImage.StringToROI(line);
3211 //We set the coordinates of the ROI's we are pasting
3212 an.coord = GetCoordinate();
3213 SelectedImage.Annotations.Add(an);
3214 }
3215 }
3216 UpdateOverlay();
3217 }

◆ ProcessCmdKey()

override bool BioImager.ImageView.ProcessCmdKey ( ref Message msg,
Keys keyData )
protected

Definition at line 150 of file ImageView.cs.

151 {
152 const int WM_KEYDOWN = 0x0100;
153 const int WM_KEYUP = 0x0101;
154 const int WM_CHAR = 0x0102;
155
156 switch (msg.Msg)
157 {
158 case WM_KEYDOWN:
159 ImageView_KeyDown(this, new KeyEventArgs(keyData));
160 break;
161
162 case WM_KEYUP:
163 ImageView_KeyUp(this, new KeyEventArgs(keyData));
164 break;
165
166 case WM_CHAR:
167 char ch = (char)msg.WParam;
168 ImageView_KeyPress(this, new System.Windows.Forms.KeyPressEventArgs(ch));
169 break;
170 }
171
172 return base.ProcessCmdKey(ref msg, keyData);
173 }

◆ RemoveImage()

void BioImager.ImageView.RemoveImage ( int i)

Definition at line 1601 of file ImageView.cs.

1602 {
1603 do
1604 {
1605 System.Threading.Thread.Sleep(50);
1606 Application.DoEvents();
1607 } while (drawing || updating);
1608 Images[i].Dispose();
1609 Images.RemoveAt(i);
1610 UpdateImages();
1611 }
System.Windows.Forms.Application Application
Definition ImageView.cs:14

◆ RemoveImages()

void BioImager.ImageView.RemoveImages ( )

Definition at line 1612 of file ImageView.cs.

1613 {
1614 do
1615 {
1616 Thread.Sleep(50);
1617 Application.DoEvents();
1618 } while (drawing || updating);
1619 for (int i = 0; i < Images.Count; i++)
1620 {
1621 Images[i].Dispose();
1622 }
1623 Images.Clear();
1624 UpdateImages();
1625 }

◆ SetCoordinate()

void BioImager.ImageView.SetCoordinate ( int z,
int c,
int t )

Definition at line 431 of file ImageView.cs.

432 {
433 if (IsDisposed)
434 return;
435
436 if (InvokeRequired)
437 {
438 BeginInvoke(new MethodInvoker(() => SetCoordinate(z, c, t)));
439 return;
440 }
441
442 if (SelectedImage == null)
443 return;
444
445 int targetZ = Math.Clamp(z, zBar.Minimum, zBar.Maximum);
446 int targetC = Math.Clamp(c, cBar.Minimum, cBar.Maximum);
447 int targetT = Math.Clamp(t, tBar.Minimum, tBar.Maximum);
448
449 initializingCoordinates = true;
450 if (zBar.Value != targetZ)
451 zBar.Value = targetZ;
452 if (cBar.Value != targetC)
453 cBar.Value = targetC;
454 if (tBar.Value != targetT)
455 tBar.Value = targetT;
456 initializingCoordinates = false;
457 SelectedImage.Coordinate = new ZCT(targetZ, targetC, targetT);
458 UpdateView();
459 }

◆ ToScreenH()

float BioImager.ImageView.ToScreenH ( double y)

‍Convert a value in microns to a value in pixels

Parameters
ythe y coordinate of the point to be converted
Returns
The return value is a float.

Definition at line 3640 of file ImageView.cs.

3641 {
3642 return (float)(y * PxHmicron);
3643 }
double PxHmicron
Only used when opening stacks.
Definition ImageView.cs:588

◆ ToScreenRect()

RectangleD BioImager.ImageView.ToScreenRect ( double x,
double y,
double w,
double h )

It converts a rectangle in microns to a rectangle in pixels

Parameters
xThe x coordinate of the rectangle
y-0.0015
wwidth of the image in microns
hheight of the rectangle
Returns
A RectangleF object.

Definition at line 3529 of file ImageView.cs.

3530 {
3531 if (SelectedImage == null)
3532 {
3533 PointD pf;
3534 pf = ToScreenSpace(x, y);
3535 return new RectangleD(pf.X, pf.Y, ToScreenScaleW(w), ToScreenScaleH(h));
3536 }
3537 if (SelectedImage.isPyramidal)
3538 {
3539 PointD d = ToScreenSpace(x, y);
3540 double dw = ToViewSizeW(w);
3541 double dh = ToViewSizeH(h);
3542 return new RectangleD(d.X, d.Y, dw, dh);
3543 }
3544 else
3545 {
3546 PointD pf = ToScreenSpace(x, y);
3547 return new RectangleD(pf.X, pf.Y, ToScreenScaleW(w), ToScreenScaleH(h));
3548 }
3549 }
double ToViewSizeH(double d)

◆ ToScreenScale()

PointF BioImager.ImageView.ToScreenScale ( PointD p)

‍Convert a point in the world coordinate system to a point in the screen coordinate system

Parameters
PointD
Returns
A PointF object.

Definition at line 3515 of file ImageView.cs.

3516 {
3517 float x = ToScreenScaleW((float)p.X);
3518 float y = ToScreenScaleH((float)p.Y);
3519 return new PointF(x, y);
3520 }
AForge.PointF PointF

◆ ToScreenScaleH()

float BioImager.ImageView.ToScreenScaleH ( double y)

‍Convert a value in microns to a value in pixels

Parameters
ythe y coordinate of the point to be converted
Returns
The return value is a float.

Definition at line 3506 of file ImageView.cs.

3507 {
3508 return (float)(y * PxHmicron);
3509 }

◆ ToScreenScaleW()

float BioImager.ImageView.ToScreenScaleW ( double x)

ToScreenScaleW() returns the number of pixels that correspond to the given number of microns

Parameters
xthe x coordinate of the point to be converted
Returns
The return value is a float.

Definition at line 3497 of file ImageView.cs.

3498 {
3499 return (float)(x * PxWmicron);
3500 }
double PxWmicron
Only used when opening stacks.
Definition ImageView.cs:573

◆ ToScreenSpace() [1/10]

PointD BioImager.ImageView.ToScreenSpace ( double x,
double y )

‍It converts a point in world space to a point in screen space

Parameters
xThe x coordinate of the point to convert.
yThe y coordinate of the point to transform.
Returns
A PointD object.

Definition at line 3405 of file ImageView.cs.

3406 {
3407 if (SelectedImage != null && SelectedImage.isPyramidal)
3408 {
3409 return new PointD((x - PyramidalOrigin.X) / Resolution, (y - PyramidalOrigin.Y) / Resolution);
3410 }
3411 double fx = ToScreenScaleW(Origin.X + x);
3412 double fy = ToScreenScaleH(Origin.Y + y);
3413 return new PointD(fx, fy);
3414 }

◆ ToScreenSpace() [2/10]

PointF BioImager.ImageView.ToScreenSpace ( Point3D p)

‍It converts a 3D point to a 2D point

Parameters
Point3D
Returns
A PointF object.

Definition at line 3487 of file ImageView.cs.

3488 {
3489 PointD pd = ToScreenSpace(p.X, p.Y);
3490 return new PointF((float)pd.X, (float)pd.Y);
3491 }

◆ ToScreenSpace() [3/10]

PointD BioImager.ImageView.ToScreenSpace ( PointD p)

‍Converts a point from world space to screen space

Parameters
PointDA class that contains an X and Y value.
Returns
A PointD object.

Definition at line 3420 of file ImageView.cs.

3421 {
3422 return ToScreenSpace(p.X, p.Y);
3423 }

◆ ToScreenSpace() [4/10]

PointF[] BioImager.ImageView.ToScreenSpace ( PointD[] p)

‍Convert a list of points from world space to screen space

Parameters
pThe point to convert
Returns
A PointF[] array of points.

Definition at line 3616 of file ImageView.cs.

3617 {
3618 PointF[] rs = new PointF[p.Length];
3619 for (int i = 0; i < p.Length; i++)
3620 {
3621 PointD pd = ToScreenSpace(p[i]);
3622 rs[i] = new PointF((float)pd.X, (float)pd.Y);
3623 }
3624 return rs;
3625 }

◆ ToScreenSpace() [5/10]

PointF BioImager.ImageView.ToScreenSpace ( PointF p)

Convert a point in the world coordinate system to the screen coordinate system

Parameters
PointFThe point you want to convert to screen space.
Returns
A PointD object.

Definition at line 3429 of file ImageView.cs.

3430 {
3431 PointD pd = ToScreenSpace(p.X, p.Y);
3432 return new PointF((float)pd.X, (float)pd.Y);
3433 }

◆ ToScreenSpace() [6/10]

PointF[] BioImager.ImageView.ToScreenSpace ( PointF[] p)

‍It takes an array of points and returns an array of points

Parameters
pThe point to convert
Returns
A PointF array.

Definition at line 3439 of file ImageView.cs.

3440 {
3441 PointF[] pf = new PointF[p.Length];
3442 for (int i = 0; i < p.Length; i++)
3443 {
3444 pf[i] = ToScreenSpace(p[i]);
3445 }
3446 return pf;
3447 }

◆ ToScreenSpace() [7/10]

RectangleD BioImager.ImageView.ToScreenSpace ( RectangleD p)

‍It converts a rectangle from world space to screen space

Parameters
RectangleDThe rectangle to convert.
Returns
A RectangleF object.

Definition at line 3570 of file ImageView.cs.

3571 {
3572 return ToScreenRect(p.X, p.Y, p.W, p.H);
3573 }

◆ ToScreenSpace() [8/10]

RectangleD[] BioImager.ImageView.ToScreenSpace ( RectangleD[] p)

It takes an array of RectangleD objects and returns an array of RectangleF objects

Parameters
pThe rectangle to convert
Returns
A RectangleF[]

Definition at line 3588 of file ImageView.cs.

3589 {
3590 RectangleD[] rs = new RectangleD[p.Length];
3591 for (int i = 0; i < p.Length; i++)
3592 {
3593 rs[i] = ToScreenSpace(p[i]);
3594 }
3595 return rs;
3596 }

◆ ToScreenSpace() [9/10]

RectangleD BioImager.ImageView.ToScreenSpace ( RectangleF p)

‍It converts a rectangle from world space to screen space

Parameters
RectangleFThe rectangle to convert.
Returns
A RectangleF object.

Definition at line 3579 of file ImageView.cs.

3580 {
3581 return ToScreenRect(p.X, p.Y, p.Width, p.Height);
3582 }

◆ ToScreenSpace() [10/10]

RectangleF[] BioImager.ImageView.ToScreenSpace ( RectangleF[] p)

It takes an array of RectangleF objects and returns an array of RectangleF objects

Parameters
pThe rectangle to convert
Returns
A RectangleF[]

Definition at line 3602 of file ImageView.cs.

3603 {
3604 RectangleF[] rs = new RectangleF[p.Length];
3605 for (int i = 0; i < p.Length; i++)
3606 {
3607 rs[i] = ToScreenSpace(p[i]).ToRectangleF();
3608 }
3609 return rs;
3610 }

◆ ToScreenW()

float BioImager.ImageView.ToScreenW ( double x)

ToScreenW(x) = x * PxWmicron

Parameters
xthe x coordinate of the point to be converted
Returns
The return value is a float.

Definition at line 3631 of file ImageView.cs.

3632 {
3633 return (float)(x * PxWmicron);
3634 }

◆ ToSKRect()

SKRect BioImager.ImageView.ToSKRect ( double x,
double y,
double w,
double h )

‍It takes a rectangle in the coordinate system of the stage and returns a rectangle in the coordinate system of the picturebox

Parameters
xThe x coordinate of the upper-left corner of the rectangle.
yThe y-coordinate of the upper-left corner of the rectangle.
wwidth of the rectangle
hheight of the rectangle
Returns
A SKRect object.

Definition at line 3559 of file ImageView.cs.

3560 {
3561 double xd = gl.Width / 2;
3562 double yd = gl.Height / 2;
3563 return new SKRect((float)(xd - x), (float)(yd - y), (float)(xd - (x + w)), (float)(yd - (y + h)));
3564 }

◆ ToViewH()

double BioImager.ImageView.ToViewH ( double d)

‍Convert a distance in microns to a distance in pixels

Parameters
dthe distance in microns
Returns
The return value is the y-coordinate of the point in the view.

Definition at line 3394 of file ImageView.cs.

3395 {
3396 double y = (double)(d / PxHmicron) / scale.Height;
3397 return y;
3398 }

◆ ToViewSizeH()

double BioImager.ImageView.ToViewSizeH ( double d)

‍Convert a value in microns to a value in pixels

Parameters
dthe size in microns
Returns
The return value is the size of the object in pixels.

Definition at line 3369 of file ImageView.cs.

3370 {
3371 if (SelectedImage != null)
3372 if (SelectedImage.isPyramidal)
3373 {
3374 return d / Resolution;
3375 }
3376 double y = (double)(d / PxHmicron);
3377 return y;
3378 }

◆ ToViewSpace() [1/3]

PointD BioImager.ImageView.ToViewSpace ( double x,
double y )

‍ToViewSpace(x, y) = (ToViewSizeW(x - (ViewWidth / 2)) / Scale.Width) - Origin.X;

Parameters
xThe x coordinate of the point to convert
yThe y coordinate of the point to convert.
Returns
A PointD object.

Definition at line 3337 of file ImageView.cs.

3338 {
3339 if (SelectedImage != null)
3340 if (SelectedImage.isPyramidal)
3341 {
3342 return new PointD((x - PyramidalOrigin.X) / Resolution, (y - PyramidalOrigin.Y) / Resolution);
3343 }
3344 double dx, dy;
3345 dx = (ToViewSizeW(x - (ViewWidth / 2)) / Scale.Width) - Origin.X;
3346 dy = (ToViewSizeH(y - (ViewHeight / 2)) / Scale.Height) - Origin.Y;
3347 return new PointD(dx, dy);
3348 }

◆ ToViewSpace() [2/3]

PointD BioImager.ImageView.ToViewSpace ( PointD p)

‍Converts a point from world space to view space

Parameters
PointDA class that contains an X and Y value.
Returns
A PointD object.

Definition at line 3327 of file ImageView.cs.

3328 {
3329 return ToViewSpace(p.X, p.Y); ;
3330 }

◆ ToViewSpace() [3/3]

PointF BioImager.ImageView.ToViewSpace ( PointF p)

Convert a point from world space to view space

Parameters
PointFThe point to convert
Returns
A PointD object.

Definition at line 3317 of file ImageView.cs.

3318 {
3319 PointD d = ToViewSpace(p.X, p.Y);
3320 return new PointF((float)d.X, (float)d.Y);
3321 }

◆ ToViewW()

double BioImager.ImageView.ToViewW ( double d)

Convert a distance in microns to a distance in pixels on the screen

Parameters
dthe distance in microns
Returns
The width of the image in pixels.

Definition at line 3384 of file ImageView.cs.

3385 {
3386 double x = (double)(d / PxWmicron) / scale.Width;
3387 return x;
3388 }

◆ UpdateImage()

void BioImager.ImageView.UpdateImage ( )

It takes a 16-bit image, converts it to 8-bit, and then converts it to a DirectX texture

Returns
A bitmap

Definition at line 1630 of file ImageView.cs.

1631 {
1632 UpdateImages();
1633 }

◆ UpdateImages()

async void BioImager.ImageView.UpdateImages ( bool updatePyramidal = true)

Definition at line 1377 of file ImageView.cs.

1378 {
1379 if (SelectedImage == null)
1380 return;
1382 UpdateRenderSurfaceMode();
1383 if (UsesSlideRenderer(SelectedImage))
1384 {
1385 InitPreview();
1386 if (!updatePyramidal || gl.Width <= 1 || gl.Height <= 1)
1387 return;
1388 SelectedImage.PyramidalOrigin = PyramidalOrigin;
1389 SelectedImage.PyramidalSize = new AForge.Size(gl.Width, gl.Height);
1390
1391 // Use the new renderer - no more ReadPixels!
1392 BindSlideRendererSource(SelectedImage);
1393 try
1394 {
1395 BioImage? directZarr = null;
1396 int[]? directZarrChannels = null;
1397 if (SelectedImage.IsZarrSource)
1398 {
1399 if (Mode == ViewMode.RGBImage)
1400 {
1401 directZarr = SelectedImage;
1402 directZarrChannels = SelectedRgbChannels(SelectedImage);
1403 }
1404 else if (Mode == ViewMode.Filtered)
1405 {
1406 // Use the same direct, coordinate-aware Zarr reader as
1407 // RGB mode. Repeating the selected channel produces the
1408 // expected grayscale Filtered view and avoids the legacy
1409 // buffered plane path that could remain stuck on Z=0.
1410 int channel = Math.Clamp(GetCoordinate().C, 0,
1411 Math.Max(0, SelectedImage.SizeC - 1));
1412 directZarr = SelectedImage;
1413 directZarrChannels = new[] { channel, channel, channel };
1414 }
1415 }
1416
1417 await slideRenderer.UpdateViewAsync(
1419 gl.Width,
1420 gl.Height,
1421 Resolution,
1422 GetCoordinate(),
1423 directZarr,
1424 Mode == ViewMode.RGBImage ? SelectedRgbChannels(SelectedImage) : directZarrChannels
1425 );
1426 }
1427 catch (Exception ex)
1428 {
1429 System.Diagnostics.Trace.WriteLine($"Could not update slide view: {ex}");
1430 }
1431 RefreshPyramidalOverlayTexture();
1432 UpdateScrollBars();
1433 // Pyramidal images are drawn from tiles, not the full-plane buffers below.
1434 return;
1435 }
1436
1437 if (SelectedImage.IsZarrSource &&
1438 (Mode == ViewMode.RGBImage || Mode == ViewMode.Filtered) &&
1439 Images.Count == 1 && SelectedImage.levels?.Count > 0)
1440 {
1441 var image = SelectedImage;
1442 var requestedMode = Mode;
1443 int request = ++zarrRgbRequest;
1444 int width = image.Buffers[0].SizeX, height = image.Buffers[0].SizeY;
1445 try
1446 {
1447 int[] channels;
1448 if (requestedMode == ViewMode.RGBImage)
1449 {
1450 channels = SelectedRgbChannels(image);
1451 }
1452 else
1453 {
1454 int channel = Math.Clamp(GetCoordinate().C, 0,
1455 Math.Max(0, image.SizeC - 1));
1456 channels = new[] { channel, channel, channel };
1457 }
1458
1459 byte[] rgba = await ZarrChannelView.ReadRgbTileAsync(image, 0, 0, 0, width, height,
1460 GetCoordinate(), channels);
1461 if (request != zarrRgbRequest || SelectedImage != image || Mode != requestedMode)
1462 return;
1463 var frame = new System.Drawing.Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
1464 var data = frame.LockBits(new System.Drawing.Rectangle(0, 0, width, height),
1465 System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
1466 try
1467 {
1468 for (int i = 0; i < rgba.Length; i += 4)
1469 (rgba[i], rgba[i + 2]) = (rgba[i + 2], rgba[i]);
1470 for (int row = 0; row < height; row++)
1471 Marshal.Copy(rgba, row * width * 4, IntPtr.Add(data.Scan0, row * data.Stride), width * 4);
1472 }
1473 finally { frame.UnlockBits(data); }
1474 foreach (var old in Bitmaps) old?.Dispose();
1475 Bitmaps.Clear();
1476 Bitmaps.Add(frame);
1477 update = true;
1478 UpdateRegularOverview();
1479 InvalidateView();
1480 }
1481 catch (Exception ex)
1482 {
1483 System.Diagnostics.Trace.WriteLine($"Could not render Zarr RGB channels: {ex.Message}");
1484 }
1485 return;
1486 }
1487
1488 // AForge's filters copy from unmanaged pixel pointers. Missing or disposed
1489 // buffers have a null pointer, so keep the last frame until pixels are available.
1490 foreach (BioImage image in Images)
1491 {
1492 int index = image.GetFrameIndex(zBar.Value, cBar.Value, tBar.Value);
1493 bool unavailable = index < 0 || index >= image.Buffers.Count;
1494 if (!unavailable)
1495 {
1496 var buffers = Mode == ViewMode.Filtered || Mode == ViewMode.Raw
1497 ? new[] { image.Buffers[index] }
1498 : image.Buffers.AsEnumerable();
1499 unavailable = buffers.Any(buffer =>
1500 buffer == null || buffer.Bytes == null || buffer.Bytes.Length == 0);
1501 }
1502 if (unavailable)
1503 {
1504 System.Diagnostics.Trace.WriteLine($"Image pixels are unavailable: {image.ID}");
1505 return;
1506 }
1507 }
1508 for (int i = 0; i < Bitmaps.Count; i++)
1509 {
1510 Bitmaps[i].Dispose();
1511 Bitmaps[i] = null;
1512 }
1513 Bitmaps.Clear();
1514 if (zBar.Maximum != SelectedImage.SizeZ - 1 || tBar.Maximum != SelectedImage.SizeT - 1)
1515 {
1516 InitGUI();
1517 }
1518
1519 int bi = 0;
1520 foreach (BioImage b in Images)
1521 {
1522 if (b.isPyramidal)
1523 b.PyramidalOrigin = PyramidalOrigin;
1524 b.PyramidalSize = new AForge.Size(gl.Width, gl.Height);
1525 ZCT coords = new ZCT(zBar.Value, cBar.Value, tBar.Value);
1526 Bitmap bitmap = null;
1527
1528 int index = b.Coords[zBar.Value, cBar.Value, tBar.Value];
1529 if (Mode == ViewMode.Filtered)
1530 {
1531 bitmap = b.GetFiltered(coords, b.RChannel.RangeR, b.GChannel.RangeG, b.BChannel.RangeB);
1532 }
1533 else if (Mode == ViewMode.RGBImage)
1534 {
1535 if (b.Buffers[0].RGBChannelsCount == 1)
1536 {
1537 var planes = new Bitmap[3];
1538 for (int color = 0; color < 3; color++)
1539 {
1540 int channel = Math.Clamp(b.rgbChannels[color], 0, b.SizeC - 1);
1541 planes[2 - color] = b.Buffers[b.GetFrameIndex(coords.Z, channel, coords.T)];
1542 }
1543 bitmap = Bitmap.GetRGBBitmap(planes, b.RChannel.RangeR, b.GChannel.RangeG, b.BChannel.RangeB);
1544 }
1545 else
1546 bitmap = b.GetRGBBitmap(coords, b.RChannel.RangeR, b.GChannel.RangeG, b.BChannel.RangeB);
1547 }
1548 else if (Mode == ViewMode.Raw)
1549 {
1550 bitmap = (Bitmap)b.Buffers[index].GetImageRGBA();
1551 }
1552 else
1553 {
1554 bitmap = b.GetEmission(coords, b.RChannel.RangeR, b.GChannel.RangeG, b.BChannel.RangeB);
1555 }
1556 var display = ToSysBitmap(bitmap);
1557 if (Mode == ViewMode.RGBImage)
1558 MaskRgbComponents(display, rgbEnabled);
1559 Bitmaps.Add(display);
1560 bi++;
1561 }
1562 UpdateRegularOverview();
1563 update = true;
1564 InvalidateView();
1565 }
AForge.Bitmap Bitmap
static ChannelsTool channelsTool
Definition App.cs:15
async Task UpdateViewAsync(PointD pyramidalOrigin, int viewportWidth, int viewportHeight, double resolution, ZCT coordinate, BioImage? rgbZarr=null, int[]? rgbSelection=null)

◆ UpdateOverlay()

void BioImager.ImageView.UpdateOverlay ( )

If hardware acceleration is enabled, render the frame. Otherwise, set a flag to update the overlay and invalidate the overlay picture box

Returns
The return value is the value of the last expression evaluated in the method.

Definition at line 982 of file ImageView.cs.

983 {
984 UpdateToolSelectBoxSize();
985 if (SelectedImage != null && UsesSlideRenderer(SelectedImage))
986 {
987 RefreshPyramidalOverlayTexture();
988 gl.Invalidate();
989 overviewPanel.Invalidate();
990 }
991 else
992 viewpanel.Invalidate();
993 }

◆ UpdateRGBChannels()

void BioImager.ImageView.UpdateRGBChannels ( )

Definition at line 811 of file ImageView.cs.

812 {
813 if (SelectedImage == null) return;
814 System.Windows.Forms.ComboBox[] boxes = { channelBoxR, channelBoxG, channelBoxB };
815 for (int i = 0; i < boxes.Length; i++)
816 {
817 rgbEnabled[i] = boxes[i].SelectedIndex > 0;
818 if (rgbEnabled[i]) SelectedImage.rgbChannels[i] = boxes[i].SelectedIndex - 1;
819 }
820 }

◆ UpdateSelectBoxSize()

void BioImager.ImageView.UpdateSelectBoxSize ( float size)

This function is called from the Unity Editor when the user changes the size of the select box

Parameters
sizeThe size of the box that will be drawn around the ROI.

Definition at line 937 of file ImageView.cs.

938 {
939 ROI.selectBoxSize = size;
940 UpdateToolSelectBoxSize();
941 }

◆ UpdateStatus()

void BioImager.ImageView.UpdateStatus ( )

It updates the status bar of the image viewer

Returns
The statusLabel.Text is being returned.

Definition at line 997 of file ImageView.cs.

998 {
999 BioImage image = OverviewSelectedImage;
1000 if (image == null)
1001 return;
1002 string res = image.Type == BioImage.ImageType.well
1003 ? $"Well:{image.Level}"
1004 : image.isPyramidal ? $"Res.:{image.Resolution:G4} Level:{image.Level}" : "";
1005 string pixelFormat = image.Buffers.Count > 0
1006 ? image.Buffers[0].PixelFormat.ToString()
1007 : image.Resolutions.Count > 0
1008 ? image.Resolutions[Math.Clamp(image.Level, 0, image.Resolutions.Count - 1)].PixelFormat.ToString()
1009 : "";
1010 string position = image.isPyramidal
1011 ? $"({image.PyramidalOrigin.X:0.##}, {image.PyramidalOrigin.Y:0.##})"
1012 : $"({-Origin.X:0.##}, {-Origin.Y:0.##})";
1013 string location = $"({image.Volume.Location.X:0.##}, {image.Volume.Location.Y:0.##})";
1014 string plane = $"{zBar.Value + 1}/{zBar.Maximum + 1}";
1015 if (Mode != ViewMode.RGBImage)
1016 plane += $", {cBar.Value + 1}/{cBar.Maximum + 1}";
1017 if (timeEnabled)
1018 plane += $", {tBar.Value + 1}/{tBar.Maximum + 1}";
1019 statusLabel.Text = $"{plane}, {mousePoint}{mouseColor}, {pixelFormat}, Origin: {position}, {location} {res}";
1020 }

◆ UpdateView()

void BioImager.ImageView.UpdateView ( bool refreshImages = true)

If hardware acceleration is enabled, render the frame. Otherwise, invalidate the picture box.

Returns
The method is returning void.

Definition at line 1025 of file ImageView.cs.

1026 {
1027 UpdateStatus();
1028 update = true;
1029 UpdateToolSelectBoxSize();
1030 if (refreshImages)
1031 UpdateImages();
1032 UpdateRenderSurfaceMode();
1033 UpdateScrollBars();
1034 overviewPanel.Invalidate();
1035 if (SelectedImage != null && UsesSlideRenderer(SelectedImage))
1036 {
1037 RefreshPyramidalOverlayTexture();
1038 gl.Invalidate();
1039 overviewPanel.Invalidate();
1040 }
1041 else
1042 viewpanel.Invalidate();
1043 }

◆ UpdateViewLegacy()

void BioImager.ImageView.UpdateViewLegacy ( bool refresh)

It draws the images and annotations to the screen

Returns
A Bitmap

‍Update the status of the application and then render the frame

Parameters
refreshboolean

Definition at line 1361 of file ImageView.cs.

1362 {
1363 UpdateStatus();
1364 update = refresh;
1365 if (update)
1366 {
1367 gl.Invalidate();
1368 overviewPanel.Invalidate();
1369 }
1370 }

Member Data Documentation

◆ Buf

Image BioImager.ImageView.Buf = null

Definition at line 320 of file ImageView.cs.

◆ down

bool BioImager.ImageView.down
static

Definition at line 303 of file ImageView.cs.

◆ filepath

string BioImager.ImageView.filepath = ""

Definition at line 406 of file ImageView.cs.

◆ Images

List<BioImage> BioImager.ImageView.Images = new List<BioImage>()

Definition at line 323 of file ImageView.cs.

◆ init

bool BioImager.ImageView.init = false

Definition at line 321 of file ImageView.cs.

◆ Layers

List<Layer> BioImager.ImageView.Layers = new List<Layer>()

Definition at line 254 of file ImageView.cs.

◆ loopC

bool BioImager.ImageView.loopC = true

Definition at line 412 of file ImageView.cs.

◆ loopT

bool BioImager.ImageView.loopT = true

Definition at line 411 of file ImageView.cs.

◆ loopZ

bool BioImager.ImageView.loopZ = true

Definition at line 410 of file ImageView.cs.

◆ minSizeX

int BioImager.ImageView.minSizeX = 50

Definition at line 408 of file ImageView.cs.

◆ minSizeY

int BioImager.ImageView.minSizeY = 20

Definition at line 409 of file ImageView.cs.

◆ mouseDown

PointD BioImager.ImageView.mouseDown
static

Definition at line 302 of file ImageView.cs.

◆ mouseDownButtons

MouseButtons BioImager.ImageView.mouseDownButtons
static

Definition at line 316 of file ImageView.cs.

◆ mouseUp

PointD BioImager.ImageView.mouseUp
static

Definition at line 304 of file ImageView.cs.

◆ mouseUpButtons

MouseButtons BioImager.ImageView.mouseUpButtons
static

Definition at line 315 of file ImageView.cs.

◆ overviewImage

Drawing.Bitmap BioImager.ImageView.overviewImage

Definition at line 11 of file ImageView.Overview.cs.

◆ selectedAnnotations

List<ROI> BioImager.ImageView.selectedAnnotations = new List<ROI>()
static

Definition at line 267 of file ImageView.cs.

◆ serie

int BioImager.ImageView.serie = 0

Definition at line 407 of file ImageView.cs.

◆ showBounds

bool BioImager.ImageView.showBounds = true
static

Definition at line 318 of file ImageView.cs.

◆ showBROIs

bool BioImager.ImageView.showBROIs = true

Definition at line 2172 of file ImageView.cs.

◆ showGROIs

bool BioImager.ImageView.showGROIs = true

Definition at line 2171 of file ImageView.cs.

◆ showRROIs

bool BioImager.ImageView.showRROIs = true

Definition at line 2170 of file ImageView.cs.

◆ showText

bool BioImager.ImageView.showText = true
static

Definition at line 319 of file ImageView.cs.

◆ up

bool BioImager.ImageView.up
static

Definition at line 305 of file ImageView.cs.

Property Documentation

◆ AnnotationsB

List<ROI> BioImager.ImageView.AnnotationsB
get

Definition at line 2203 of file ImageView.cs.

2204 {
2205 get
2206 {
2207 if (SelectedImage == null)
2208 return new List<ROI>();
2209 return SelectedImage.Annotations.Where(an =>
2210 an != null &&
2211 an.coord.Z == SelectedImage.Coordinate.Z &&
2212 an.coord.T == SelectedImage.Coordinate.T &&
2213 (an.type == ROI.Type.Polygon || an.type == ROI.Type.Freeform || an.type == ROI.Type.Polyline || an.coord.C == BChannel.Index)).ToList();
2214 }
2215 }
Channel BChannel
Getting the B channel of the image. *‍/.
Definition ImageView.cs:683

◆ AnnotationsG

List<ROI> BioImager.ImageView.AnnotationsG
get

Definition at line 2189 of file ImageView.cs.

2190 {
2191 get
2192 {
2193 if (SelectedImage == null)
2194 return new List<ROI>();
2195 return SelectedImage.Annotations.Where(an =>
2196 an != null &&
2197 an.coord.Z == SelectedImage.Coordinate.Z &&
2198 an.coord.T == SelectedImage.Coordinate.T &&
2199 (an.type == ROI.Type.Polygon || an.type == ROI.Type.Freeform || an.type == ROI.Type.Polyline || an.coord.C == GChannel.Index)).ToList();
2200 }
2201 }
Channel GChannel
A property that returns the G channel of the image. *‍/.
Definition ImageView.cs:675

◆ AnnotationsR

List<ROI> BioImager.ImageView.AnnotationsR
get

Definition at line 2175 of file ImageView.cs.

2176 {
2177 get
2178 {
2179 if (SelectedImage == null)
2180 return new List<ROI>();
2181 return SelectedImage.Annotations.Where(an =>
2182 an != null &&
2183 an.coord.Z == SelectedImage.Coordinate.Z &&
2184 an.coord.T == SelectedImage.Coordinate.T &&
2185 (an.type == ROI.Type.Polygon || an.type == ROI.Type.Freeform || an.type == ROI.Type.Polyline || an.coord.C == RChannel.Index)).ToList();
2186 }
2187 }
Channel RChannel
A property that returns the R channel of the selected image. *‍/.
Definition ImageView.cs:667

◆ AnnotationsRGB

List<ROI> BioImager.ImageView.AnnotationsRGB
get

Definition at line 2216 of file ImageView.cs.

2217 {
2218 get
2219 {
2220 if (SelectedImage == null)
2221 return null;
2222 List<ROI> ans = new List<ROI>();
2223 if (Mode == ViewMode.RGBImage)
2224 {
2225 if (showRROIs)
2226 ans.AddRange(AnnotationsR);
2227 if (showGROIs)
2228 ans.AddRange(AnnotationsG);
2229 if (showBROIs)
2230 ans.AddRange(AnnotationsB);
2231 }
2232 else
2233 {
2234 ans.AddRange(SelectedImage.Annotations.Where(an =>
2235 an != null &&
2236 an.coord.Z == SelectedImage.Coordinate.Z &&
2237 an.coord.T == SelectedImage.Coordinate.T &&
2238 (an.type == ROI.Type.Polygon || an.type == ROI.Type.Freeform || an.type == ROI.Type.Polyline || an.coord.C == SelectedImage.Coordinate.C)));
2239 }
2240 return ans;
2241 }
2242 }
List< ROI > AnnotationsG
List< ROI > AnnotationsR
List< ROI > AnnotationsB

◆ BChannel

Channel BioImager.ImageView.BChannel
get

Getting the B channel of the image. *‍/.

Definition at line 682 of file ImageView.cs.

683 {
684 get
685 {
686 return SelectedImage.Channels[SelectedImage.rgbChannels[2]];
687 }
688 }

◆ CFps

int BioImager.ImageView.CFps
getset

Setting the interval of the timer to the inverse of the fps. *‍/.

Definition at line 858 of file ImageView.cs.

859 {
860 get
861 {
862 return cfps;
863 }
864 set
865 {
866 cfps = value;
867 float f = value;
868 cTimer.Interval = (int)Math.Floor(1000 / f);
869 }
870 }

◆ Ctrl

bool BioImager.ImageView.Ctrl
staticget

Definition at line 306 of file ImageView.cs.

307 {
308 get
309 {
310 return Win32.GetKeyState(Keys.LControlKey);
311 }
312 }
static bool GetKeyState(System.Windows.Forms.Keys vKey)
Definition Win32.cs:24

◆ GChannel

Channel BioImager.ImageView.GChannel
get

A property that returns the G channel of the image. *‍/.

Definition at line 674 of file ImageView.cs.

675 {
676 get
677 {
678 return SelectedImage.Channels[SelectedImage.rgbChannels[1]];
679 }
680 }

◆ LabelResolution

int? BioImager.ImageView.LabelResolution
get

Definition at line 696 of file ImageView.cs.

696{ get { return SelectedImage.LabelResolution; } }

◆ Level

int BioImager.ImageView.Level
get

Current level when viewing whole-slide and pyramidal images.

Definition at line 764 of file ImageView.cs.

765 {
766 get
767 {
768 if (SelectedImage != null)
769 return SelectedImage.Level;
770 else
771 return 0;
772 }
773 }

◆ MacroResolution

int? BioImager.ImageView.MacroResolution
get

Definition at line 695 of file ImageView.cs.

695{ get { return SelectedImage.MacroResolution; } }

◆ Mode

ViewMode BioImager.ImageView.Mode
getset

Setting the view mode of the application. *‍/.

Definition at line 608 of file ImageView.cs.

609 {
610 get
611 {
612 return viewMode;
613 }
614 set
615 {
616 viewMode = value;
617 //If view mode is changed we update.
618 update = true;
619 UpdateImages();
620 App.tabsView.UpdateViewMode(viewMode);
621 UpdateView();
623 if (viewMode == ViewMode.RGBImage)
624 {
625 cBar.Value = 0;
626 rgbBoxsPanel.BringToFront();
627 cBar.SendToBack();
628 cLabel.SendToBack();
629 BringRenderSurfacesToFront();
630 }
631 else
632 if (viewMode == ViewMode.Filtered)
633 {
634 rgbBoxsPanel.SendToBack();
635 cBar.BringToFront();
636 cLabel.BringToFront();
637 BringRenderSurfacesToFront();
638 }
639 else
640 if (viewMode == ViewMode.Raw)
641 {
642 rgbBoxsPanel.SendToBack();
643 cBar.BringToFront();
644 cLabel.BringToFront();
645 BringRenderSurfacesToFront();
646 }
647 else
648 {
649 cBar.Value = 0;
650 rgbBoxsPanel.BringToFront();
651 cBar.SendToBack();
652 cLabel.SendToBack();
653 BringRenderSurfacesToFront();
654 }
655 }
656 }

◆ MouseDownInt

PointD BioImager.ImageView.MouseDownInt
getset

Definition at line 3744 of file ImageView.cs.

3745 {
3746 get { return mouseDownInt; }
3747 set { mouseDownInt = value; }
3748 }

◆ MouseMoveInt

PointD BioImager.ImageView.MouseMoveInt
getset

Definition at line 3756 of file ImageView.cs.

3757 {
3758 get { return mouseMoveInt; }
3759 set { mouseMoveInt = value; }
3760 }

◆ MouseUpInt

PointD BioImager.ImageView.MouseUpInt
getset

Definition at line 3750 of file ImageView.cs.

3751 {
3752 get { return mouseUpInt; }
3753 set { mouseUpInt = value; }
3754 }

◆ OpenSlide

bool BioImager.ImageView.OpenSlide
get

Definition at line 691 of file ImageView.cs.

692 {
693 get { if (SelectedImage.SlideBase == null) return true; else return false; }
694 }

◆ Origin

PointD BioImager.ImageView.Origin
getset

A property of the class PointD. *‍/.

Definition at line 717 of file ImageView.cs.

718 {
719 get { return origin; }
720 set
721 {
722 origin = value;
723 update = true;
724 UpdateView();
725 }
726 }

◆ OverView

Rectangle BioImager.ImageView.OverView
get

Definition at line 414 of file ImageView.cs.

415 {
416 get { return overview; }
417 }

◆ Path

string BioImager.ImageView.Path
get

A property that returns the filepath. *‍/.

Definition at line 658 of file ImageView.cs.

659 {
660 get
661 {
662 return filepath;
663 }
664 }

◆ PxHmicron

double BioImager.ImageView.PxHmicron
getset

Only used when opening stacks.

Definition at line 587 of file ImageView.cs.

588 {
589 get
590 {
591 return pxHmicron;
592 }
593 set
594 {
595 pxHmicron = value;
596 }
597 }

◆ PxWmicron

double BioImager.ImageView.PxWmicron
getset

Only used when opening stacks.

Definition at line 572 of file ImageView.cs.

573 {
574 get
575 {
576 return pxWmicron;
577 }
578 set
579 {
580 pxWmicron = value;
581 }
582 }

◆ PyramidalOrigin

PointD BioImager.ImageView.PyramidalOrigin
getset

Setting the value of the pyramidalOrigin variable. *‍/.

Definition at line 729 of file ImageView.cs.

730 {
731 get
732 {
733 if (SelectedImage != null)
734 return SelectedImage.PyramidalOrigin;
735 else
736 return new PointD(0, 0);
737 }
738 set
739 {
740 SelectedImage.PyramidalOrigin = value;
741 }
742 }

◆ PyramidalOriginTransformed

PointD BioImager.ImageView.PyramidalOriginTransformed
getset

Definition at line 3733 of file ImageView.cs.

3734 {
3735 get { return new PointD(PyramidalOrigin.X * Resolution, PyramidalOrigin.Y * Resolution); }
3736 set { PyramidalOrigin = new PointD(value.X / Resolution, value.Y / Resolution); }
3737 }

◆ RChannel

Channel BioImager.ImageView.RChannel
get

A property that returns the R channel of the selected image. *‍/.

Definition at line 666 of file ImageView.cs.

667 {
668 get
669 {
670 return SelectedImage.Channels[SelectedImage.rgbChannels[0]];
671 }
672 }

◆ Resolution

double BioImager.ImageView.Resolution
getset

A property of the class ImageViewer. It is a getter and setter for the resolution of the image.

Definition at line 745 of file ImageView.cs.

746 {
747 get
748 {
749 if (SelectedImage == null)
750 return 1;
751 return SelectedImage.Resolution;
752 }
753 set
754 {
755 SelectedImage.Resolution = value;
756 if (SelectedImage.Type == BioImage.ImageType.well)
757 SelectedImage.Level = (int)value;
758 }
759 }

◆ Scale

new AForge.SizeF BioImager.ImageView.Scale
getset

Scale when opening image stacks.

Definition at line 778 of file ImageView.cs.

779 {
780 get
781 {
782 return scale;
783 }
784 set
785 {
786 scale = value;
787 update = true;
788 UpdateView();
789 Tools.selectBoxSize = GetSelectBoxSize();
790 }
791 }

◆ SelectedBuffer

Bitmap BioImager.ImageView.SelectedBuffer
staticget

Definition at line 294 of file ImageView.cs.

295 {
296 get
297 {
298 int ind = SelectedImage.Coords[SelectedImage.Coordinate.Z, SelectedImage.Coordinate.C, SelectedImage.Coordinate.T];
299 return SelectedImage.Buffers[ind];
300 }
301 }

◆ SelectedImage

BioImage BioImager.ImageView.SelectedImage
staticgetset

Definition at line 269 of file ImageView.cs.

270 {
271 get
272 {
273 if (App.viewer != null)
274 {
275 if (App.viewer.Images.Count > 0)
276 return App.viewer.Images[selectedIndex];
277 else
278 return null;
279 }
280 else
281 return null;
282 }
283 set
284 {
285 if (App.viewer != null)
286 {
287 if (App.viewer.Images.Count > 0)
288 App.viewer.Images[selectedIndex] = value;
289 else
290 App.viewer.AddImage(value);
291 }
292 }
293 }
static ImageView viewer
Definition App.cs:23

◆ SelectedIndex

int BioImager.ImageView.SelectedIndex = 0
getset

A property that is used to set the selected index of the image. *‍/.

Definition at line 389 of file ImageView.cs.

390 {
391 get;
392 set
393 {
394 if (value >= 0 && value < Images.Count)
395 {
396 App.viewer = this;
397 field = value;
398 selectedIndex = field;
399 InitGUI();
400 if (UsesSlideRenderer(Images[field]))
401 BindSlideRendererSource(Images[field]);
402 }
403 }
404 } = 0;

◆ ShowControls

bool BioImager.ImageView.ShowControls
getset

Setting the visibility of the trackBarPanel. *‍/.

Definition at line 538 of file ImageView.cs.

539 {
540 get => showControls;
541 set
542 {
543 showControls = value;
544 trackBarPanel.Visible = value;
545 hideControlsToolStripMenuItem1.Text = value ? "Hide Controls" : "Show Controls";
546 showControlsToolStripMenuItem.Text = value ? "Hide Controls" : "Show Controls";
547 PerformLayout();
548 UpdateView();
549 }
550 }

◆ ShowMasks

bool BioImager.ImageView.ShowMasks = true
getset

Definition at line 3763 of file ImageView.cs.

3763{ get; set; } = true;

◆ ShowOverview

bool BioImager.ImageView.ShowOverview
getset

Definition at line 21 of file ImageView.Overview.cs.

22 {
23 get => showOverview;
24 set
25 {
26 showOverview = value;
27 UpdateOverviewVisibility();
28 }
29 }

◆ ShowStage

bool BioImager.ImageView.ShowStage
getset

Definition at line 419 of file ImageView.cs.

419{ get; set; }

◆ ShowStatus

bool BioImager.ImageView.ShowStatus
getset

Setting the value of the property ShowStatus. *‍/.

Definition at line 555 of file ImageView.cs.

556 {
557 get => showStatus;
558 set
559 {
560 showStatus = value;
561 statusPanel.Visible = value;
562 hideControlsToolStripMenuItem.Text = value ? "Hide Status" : "Show Status";
563 PerformLayout();
564 UpdateView();
565 }
566 }

◆ TimeFps

int BioImager.ImageView.TimeFps
getset

Setting the interval of the timer to the value of the timefps variable. *‍/.

Definition at line 842 of file ImageView.cs.

843 {
844 get
845 {
846 return timefps;
847 }
848 set
849 {
850 timefps = value;
851 float f = value;
852 timelineTimer.Interval = (int)Math.Floor(1000 / f);
853 }
854 }

◆ tools

Tools BioImager.ImageView.tools
get

Definition at line 405 of file ImageView.cs.

405{ get { return App.tools; } }
static Tools tools
Definition App.cs:21

◆ ViewContextMenu

ContextMenuStrip BioImager.ImageView.ViewContextMenu
get

A property that returns a ContextMenuStrip object. *‍/.

Definition at line 793 of file ImageView.cs.

794 {
795 get
796 {
797 return contextMenuStrip;
798 }
799 }

◆ ViewHeight

int BioImager.ImageView.ViewHeight
get

Definition at line 706 of file ImageView.cs.

707 {
708 get
709 {
710 if (SelectedImage != null && !SelectedImage.isPyramidal && viewpanel != null && viewpanel.ClientSize.Height > 1)
711 return viewpanel.ClientSize.Height;
712 return gl.Height;
713 }
714 }

◆ ViewWidth

int BioImager.ImageView.ViewWidth
get

Definition at line 697 of file ImageView.cs.

698 {
699 get
700 {
701 if (SelectedImage != null && !SelectedImage.isPyramidal && viewpanel != null && viewpanel.ClientSize.Width > 1)
702 return viewpanel.ClientSize.Width;
703 return gl.Width;
704 }
705 }

◆ ZFps

int BioImager.ImageView.ZFps
getset

Setting the interval of the timer to the value of the fps. *‍/.

Definition at line 826 of file ImageView.cs.

827 {
828 get
829 {
830 return zfps;
831 }
832 set
833 {
834 zfps = value;
835 float f = value;
836 zTimer.Interval = (int)Math.Floor(1000 / f);
837 }
838 }

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