BioCore  5.0.0
A Windows .NET microscopy library and application for viewing, editing, and annotating images.
Loading...
Searching...
No Matches
BioCore.ImageView Class Reference

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

Inheritance diagram for BioCore.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 ()
 
void UpdateView (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 ()
 
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 ImageView_KeyUp (object sender, KeyEventArgs e)
 
void ImageView_KeyPress (object sender, System.Windows.Forms.KeyPressEventArgs e)
 
void GoToImage ()
 
void GoToImage (int i)
 
new void Dispose ()
 
void MoveStageToImage ()
 
void MoveStageToImage (int i)
 

Public Attributes

List< Layer > Layers = new List<Layer>()
 
Image Buf = null
 
bool init = false
 
System.Drawing.Bitmap overviewImage = null
 
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
 

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 void OnLayout (LayoutEventArgs e)
 
override bool ProcessCmdKey (ref Message msg, Keys keyData)
 
override void Dispose (bool disposing)
 Clean up any resources being used.
 

Properties

static BioImage SelectedImage [get, set]
 
static Bitmap SelectedBuffer [get]
 
static bool Ctrl [get]
 
List< BioImage > Images [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 5 of file ImageView.ScrollBars.cs.

Member Enumeration Documentation

◆ ViewMode

Enumerator
Raw 
Filtered 
RGBImage 
Emission 

Definition at line 624 of file ImageView.cs.

Constructor & Destructor Documentation

◆ ImageView() [1/2]

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

Initializing the image viewer. *‍/.

Definition at line 32 of file ImageView.cs.

33 {
34 string file = im.ID.Replace("\\", "/");
35 InitializeComponent();
36 InitializeViewport();
37
38 if (im.isPyramidal)
39 {
40 gl.Size = new System.Drawing.Size(800, 600);
41 if (im.openSlideImage != null && OpenWithOpenSlide)
42 {
43 openSlide = true;
44 Initialize(im.file, im);
45 }
46 else
47 Initialize(im.file, im);
48 hScrollBar.Visible = true;
49 vScrollBar.Visible = true;
50 }
51 else
52 {
53 hScrollBar.Visible = false;
54 vScrollBar.Visible = false;
55 gl.Width += 18;
56 gl.Height += 18;
57 Tools.selectBoxSize = ROI.selectBoxSize;
58 }
59 App.viewer = this;
60 if (im.SlideBase != null && im.isPyramidal && OpenSlide)
61 openSlide = true;
62 serie = im.series;
63 Dock = DockStyle.Fill;
64 AddImage(im);
65 App.viewer = this;
66 if (file == "" || file == null)
67 return;
68 InitGUI();
69 // Preserve a loader-selected initial plane (for example the middle
70 // slice of an NGFF scene). SetCoordinate is asynchronous and raced
71 // construction here, so initialise the controls synchronously.
72 zBar.Value = Math.Clamp(im.Coordinate.Z, zBar.Minimum, zBar.Maximum);
73 cBar.Value = Math.Clamp(im.Coordinate.C, cBar.Minimum, cBar.Maximum);
74 tBar.Value = Math.Clamp(im.Coordinate.T, tBar.Minimum, tBar.Maximum);
75 gl.Paint += Gl_Paint;
76 MouseWheel += new System.Windows.Forms.MouseEventHandler(ImageView_MouseWheel);
77 zBar.MouseWheel += new System.Windows.Forms.MouseEventHandler(ZTrackBar_MouseWheel);
78 cBar.MouseWheel += new System.Windows.Forms.MouseEventHandler(CTrackBar_MouseWheel);
79 tBar.MouseWheel += new System.Windows.Forms.MouseEventHandler(TimeTrackBar_MouseWheel);
80 //We set the trackbar event to handled so that it only scrolls one tick not the default multiple.
81 zBar.MouseWheel += (sender, e) => ((HandledMouseEventArgs)e).Handled = true;
82 tBar.MouseWheel += (sender, e) => ((HandledMouseEventArgs)e).Handled = true;
83 cBar.MouseWheel += (sender, e) => ((HandledMouseEventArgs)e).Handled = true;
84 this.SizeChanged += ImageView_SizeChanged;
85 this.KeyDown += ImageView_KeyDown;
86 this.KeyPress += ImageView_KeyPress;
87 this.KeyUp += ImageView_KeyUp;
88 TimeFps = 60;
89 ZFps = 60;
90 CFps = 1;
91 resolutions = im.Resolutions;
92 if (im.isPyramidal)
93 {
94 // Set the source based on image type
95 if (im.OpenSlideBase != null)
96 {
97 slideRenderer.SetSource(im.OpenSlideBase);
98 }
99 else if (im.SlideBase != null)
100 {
101 slideRenderer.SetSource(im.SlideBase);
102 }
103 }
104 InitGL();
105 update = true;
106 InitPreview();
107 GoToImage();
108 UpdateImages();
109 Mode = ViewMode.Filtered;
110 UpdateView();
111 Initialize(im.ID, im);
112 }
int CFps
Setting the interval of the timer to the inverse of the fps. *‍/.
Definition ImageView.cs:890
void ImageView_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
void ImageView_KeyUp(object sender, KeyEventArgs e)
void AddImage(BioImage im)
Definition ImageView.cs:485
int ZFps
Setting the interval of the timer to the value of the fps. *‍/.
Definition ImageView.cs:858
void ImageView_KeyDown(object sender, KeyEventArgs e)
ViewMode Mode
Setting the view mode of the application. *‍/.
Definition ImageView.cs:635
int TimeFps
Setting the interval of the timer to the value of the timefps variable. *‍/.
Definition ImageView.cs:874
async void UpdateImages(bool updatePyramidal=true)
void SetSource(OpenSlideBase source)

◆ ImageView() [2/2]

BioCore.ImageView.ImageView ( )

Initializing the ImageView class. *‍/.

Definition at line 114 of file ImageView.cs.

115 {
116 InitializeComponent();
117 InitializeViewport();
118 InitGL();
119 Dock = DockStyle.Fill;
120 App.viewer = this;
121 SetCoordinate(0, 0, 0);
122 InitGUI();
123 gl.Paint += Gl_Paint;
124 //Buf = image.GetBufByCoord(GetCoordinate());
125 MouseWheel += new System.Windows.Forms.MouseEventHandler(ImageView_MouseWheel);
126 zBar.MouseWheel += new System.Windows.Forms.MouseEventHandler(ZTrackBar_MouseWheel);
127 cBar.MouseWheel += new System.Windows.Forms.MouseEventHandler(CTrackBar_MouseWheel);
128 tBar.MouseWheel += new System.Windows.Forms.MouseEventHandler(TimeTrackBar_MouseWheel);
129 this.SizeChanged += ImageView_SizeChanged;
130 //We set the trackbar event to handled so that it only scrolls one tick not the default multiple.
131 zBar.MouseWheel += (sender, e) => ((HandledMouseEventArgs)e).Handled = true;
132 tBar.MouseWheel += (sender, e) => ((HandledMouseEventArgs)e).Handled = true;
133 cBar.MouseWheel += (sender, e) => ((HandledMouseEventArgs)e).Handled = true;
134 TimeFps = 60;
135 ZFps = 60;
136 CFps = 1;
137 update = true;
138 UpdateImages();
139 GoToImage();
140 UpdateView();
141 }
void SetCoordinate(int z, int c, int t)
Definition ImageView.cs:443

Member Function Documentation

◆ AddImage()

void BioCore.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 485 of file ImageView.cs.

486 {
487 ZarrChannelView.InitializeChannels(im);
488 if (Images.Contains(im))
489 return;
490 else
491 Images.Add(im);
492 SelectedIndex = Images.Count - 1;
493 bool c = false;
494 foreach (var item in Layers)
495 {
496 if (item.Resolution == im.PhysicalSizeX)
497 c = true;
498 }
499 if (!c)
500 Layers.Add(new Layer(im.PhysicalSizeX));
501 if (im.isPyramidal)
502 {
503 hScrollBar.Visible = true;
504 vScrollBar.Visible = true;
505 InitPreview();
506 }
507 else
508 {
509 hScrollBar.Visible = false;
510 vScrollBar.Visible = false;
511 gl.Width += 18;
512 gl.Height += 18;
513 Tools.selectBoxSize = ROI.selectBoxSize;
514 }
515 Initialize(im.ID, im);
516 InitGUI();
517 UpdateImages();
518 GoToImage(Images.Count - 1);
519 }
List< Layer > Layers
Definition ImageView.cs:290
List< BioImage > Images
Definition ImageView.cs:359
int SelectedIndex
A property that is used to set the selected index of the image. *‍/.
Definition ImageView.cs:406

◆ CopySelection()

void BioCore.ImageView.CopySelection ( )

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

Definition at line 2838 of file ImageView.cs.

2839 {
2840 copys.Clear();
2841 string s = "";
2842 foreach (ROI item in AnnotationsRGB)
2843 {
2844 if (item.Selected)
2845 {
2846 copys.Add(item);
2847 s += BioImage.ROIToString(item);
2848 }
2849 }
2850 System.Windows.Forms.Clipboard.SetText(s);
2851 }
List< ROI > AnnotationsRGB

◆ Dispose() [1/2]

new void BioCore.ImageView.Dispose ( )

Definition at line 3474 of file ImageView.cs.

3475 {
3476 for (int i = 0; i < Bitmaps.Count; i++)
3477 {
3478 if (Bitmaps[i] != null)
3479 Bitmaps[i].Dispose();
3480 }
3481 for (int i = 0; i < Bitmaps.Count; i++)
3482 {
3483 if (Bitmaps[i] != null)
3484 Bitmaps[i].Dispose();
3485 }
3486 }

◆ Dispose() [2/2]

override void BioCore.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 BioCore.ImageView.DrawView ( System.Drawing.Graphics g)

Draws the viewport when Hardware Acceleration is off.

Parameters
g

Definition at line 2354 of file ImageView.cs.

2355 {
2356 try
2357 {
2358 drawing = true;
2359 if (SelectedImage == null)
2360 return;
2361 if (SelectedImage.isPyramidal)
2362 {
2363 UpdateImages(true);
2364 updatePyr = false;
2365 return;
2366 }
2367 g.TranslateTransform(ViewWidth / 2, ViewHeight / 2);
2368 if (Scale.Width == 0 || float.IsInfinity(Scale.Width))
2369 Scale = new SizeF(1, 1);
2370 g.ScaleTransform(Scale.Width, Scale.Height);
2371 if (Bitmaps.Count == 0)
2372 return;
2373 System.Drawing.RectangleF[] rf = new System.Drawing.RectangleF[1];
2374 using System.Drawing.Pen blue = new System.Drawing.Pen(Brushes.Blue, 1 / Scale.Width);
2375 for (int i = 0; i < Images.Count && i < Bitmaps.Count; i++)
2376 {
2377 BioImage im = Images[i];
2378 if (!IsLayerEnabled(im.PhysicalSizeX) && !im.isPyramidal)
2379 continue;
2380 RectangleD r = ToScreenRect(im.Volume.Location.X, im.Volume.Location.Y, im.Volume.Width, im.Volume.Height);
2381 double w = ToViewW(ViewWidth);
2382 double h = ToViewH(ViewHeight);
2383 RectangleF rg = new RectangleF((float)((-Origin.X) - (w / 2)), (float)((-Origin.Y) - (h / 2)), (float)(w), (float)(h));
2384 RectangleF rec = new RectangleF((float)im.Volume.Location.X, (float)im.Volume.Location.Y, (float)im.Volume.Width, (float)im.Volume.Height);
2385 if (SelectedImage.isPyramidal)
2386 {
2387 var tr = g.Transform;
2388 g.ResetTransform();
2389 g.DrawImage(Bitmaps[i], 0, 0);
2390 g.Transform = tr;
2391 }
2392 else
2393 if (rg.IntersectsWith(rec))
2394 {
2395 g.DrawImage(Bitmaps[i], (float)r.X, (float)r.Y, (float)r.W, (float)r.H);
2396 }
2397 if (i == SelectedIndex && !SelectedImage.isPyramidal)
2398 {
2399 rf[0] = new System.Drawing.RectangleF((float)r.X, (float)r.Y, (float)r.W, (float)r.H);
2400 g.DrawRectangles(blue, rf);
2401 }
2402 }
2403 update = false;
2404 }
2405 catch (Exception e)
2406 {
2407 Console.WriteLine(e.Message);
2408 }
2409 finally
2410 {
2411 drawing = false;
2412 }
2413 }
AForge.RectangleD RectangleD
Definition ImageView.cs:17
AForge.SizeF SizeF
Definition ImageView.cs:18
double ToViewW(double d)
RectangleD ToScreenRect(double x, double y, double w, double h)
new AForge.SizeF Scale
Scale when opening image stacks.
Definition ImageView.cs:805
static BioImage SelectedImage
Definition ImageView.cs:306
PointD Origin
A property of the class PointD. *‍/.
Definition ImageView.cs:743
double ToViewH(double d)

◆ GetCoordinate()

ZCT BioCore.ImageView.GetCoordinate ( )

It returns the coordinate of the selected image

Returns
The Coordinate property of the SelectedImage object.

Definition at line 474 of file ImageView.cs.

475 {
476 if (SelectedImage == null)
477 return new ZCT();
478 return SelectedImage.Coordinate;
479 }

◆ GetRange()

void BioCore.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 1793 of file ImageView.cs.

1794 {
1795 RangeTool t;
1796 if (Mode == ViewMode.Filtered)
1797 t = new RangeTool(timeEnabled, true, zBar.Minimum, zBar.Maximum, tBar.Minimum, tBar.Maximum, cBar.Minimum, cBar.Maximum);
1798 else
1799 t = new RangeTool(timeEnabled, false, zBar.Minimum, zBar.Maximum, tBar.Minimum, tBar.Maximum, cBar.Minimum, cBar.Maximum);
1800 if (t.ShowDialog() != DialogResult.OK)
1801 return;
1802 zBar.Minimum = t.ZMin;
1803 zBar.Maximum = t.ZMax;
1804 tBar.Minimum = t.TimeMin;
1805 tBar.Maximum = t.TimeMax;
1806 cBar.Minimum = t.CMin;
1807 cBar.Maximum = t.CMax;
1808 }

◆ GetScale()

double BioCore.ImageView.GetScale ( )

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

Returns
The scale of the image.

Definition at line 2438 of file ImageView.cs.

2439 {
2440 return ToViewSizeW(ROI.selectBoxSize / Scale.Width);
2441 }

◆ GoToImage() [1/2]

void BioCore.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 3341 of file ImageView.cs.

3342 {
3344 }

◆ GoToImage() [2/2]

void BioCore.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 3383 of file ImageView.cs.

3384 {
3385 if (i < 0 || Images.Count <= i || ViewWidth <= 0 || ViewHeight <= 0)
3386 return;
3387 App.viewer = this;
3388 if (SelectedIndex != i)
3389 SelectedIndex = i;
3390 else
3391 selectedIndex = i;
3392 BioImage image = Images[i];
3393 if (image.isPyramidal)
3394 {
3395 // The schema extent uses the same world coordinates as the slide
3396 // renderer. BioImage.Volume may only describe its initial Zarr tile.
3397 RectangleD bounds = OverviewWorldBounds(image);
3398 if (bounds.W <= 0 || bounds.H <= 0 || !double.IsFinite(bounds.W) || !double.IsFinite(bounds.H))
3399 return;
3400 double fit = Math.Max(bounds.W / ViewWidth, bounds.H / ViewHeight);
3401 if (!double.IsFinite(fit) || fit <= 0)
3402 return;
3403 Resolution = fit;
3404 PyramidalOrigin = new PointD((bounds.X + bounds.W / 2) / fit - ViewWidth / 2.0,
3405 (bounds.Y + bounds.H / 2) / fit - ViewHeight / 2.0);
3406 UpdateView();
3407 return;
3408 }
3409 double dx = image.Volume.Width / 2;
3410 double dy = image.Volume.Height / 2;
3411 Origin = new PointD(-(image.Volume.Location.X + dx), -(image.Volume.Location.Y + dy));
3412 double wx, wy;
3413 wx = ViewWidth / ToScreenScaleW(image.Volume.Width);
3414 wy = ViewHeight / ToScreenScaleH(image.Volume.Height);
3415 double fitScale = Math.Min(wx, wy);
3416 if (double.IsFinite(fitScale) && fitScale > 0)
3417 Scale = new SizeF((float)fitScale, (float)fitScale);
3418 UpdateView();
3419 }
float ToScreenScaleW(double x)
PointD PyramidalOrigin
Setting the value of the pyramidalOrigin variable. *‍/.
Definition ImageView.cs:755
double Resolution
A property of the class ImageViewer. It is a getter and setter for the resolution of the image.
Definition ImageView.cs:770
float ToScreenScaleH(double y)

◆ ImageToViewSpace()

PointD BioCore.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 2952 of file ImageView.cs.

2953 {
2954 if (SelectedImage == null)
2955 return ToViewSpace(x, y);
2956 if (SelectedImage.isPyramidal)
2957 {
2958 return new PointD((PyramidalOrigin.X + x) * Resolution, (PyramidalOrigin.Y + y) * Resolution);
2959 }
2960 else
2961 return ToViewSpace(x, y);
2962 }
PointF ToViewSpace(PointF p)

◆ ImageView_KeyDown()

void BioCore.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 3266 of file ImageView.cs.

3267 {
3268 double moveAmount = 5 * Scale.Width;
3269 Plugins.KeyDownEvent(sender, e);
3270 if (e.KeyCode == Keys.C && e.Control)
3271 {
3272 CopySelection();
3273 return;
3274 }
3275 if (e.KeyCode == Keys.V && e.Control)
3276 {
3278 return;
3279 }
3280 if (e.KeyCode == Keys.Subtract || e.KeyCode == Keys.NumPad7)
3281 {
3282 if (SelectedImage.isPyramidal)
3283 Resolution *= 0.9f;
3284 else
3285 Scale = new SizeF(Scale.Width - 0.1f, Scale.Height - 0.1f);
3286 UpdateView();
3287 }
3288 if (e.KeyCode == Keys.Add || e.KeyCode == Keys.NumPad9)
3289 {
3290 if (SelectedImage.isPyramidal)
3291 Resolution *= 1.1f;
3292 else
3293 Scale = new SizeF(Scale.Width + 0.1f, Scale.Height + 0.1f);
3294 UpdateView();
3295 }
3296 if (e.KeyCode == Keys.W || e.KeyCode == Keys.NumPad8)
3297 {
3298 if (SelectedImage.isPyramidal)
3299 PyramidalOrigin = new PointD(PyramidalOrigin.X, PyramidalOrigin.Y - moveAmount);
3300 else
3301 Origin = new PointD(Origin.X, Origin.Y + moveAmount);
3302 UpdateView();
3303 }
3304 if (e.KeyCode == Keys.S || e.KeyCode == Keys.NumPad2)
3305 {
3306 if (SelectedImage.isPyramidal)
3307 PyramidalOrigin = new PointD(PyramidalOrigin.X, PyramidalOrigin.Y + moveAmount);
3308 else
3309 Origin = new PointD(Origin.X, Origin.Y - moveAmount);
3310 UpdateView();
3311 }
3312 if (e.KeyCode == Keys.A || e.KeyCode == Keys.NumPad4)
3313 {
3314 if (SelectedImage.isPyramidal)
3315 PyramidalOrigin = new PointD(PyramidalOrigin.X - moveAmount, PyramidalOrigin.Y);
3316 else
3317 Origin = new PointD(Origin.X + moveAmount, Origin.Y);
3318 UpdateView();
3319 }
3320 if (e.KeyCode == Keys.D || e.KeyCode == Keys.NumPad6)
3321 {
3322 if (SelectedImage.isPyramidal)
3323 PyramidalOrigin = new PointD(PyramidalOrigin.X + moveAmount, PyramidalOrigin.Y);
3324 else
3325 Origin = new PointD(Origin.X - moveAmount, Origin.Y);
3326 UpdateView();
3327 }
3328 }
System.Windows.Forms.Keys Keys
Definition ImageView.cs:16
void CopySelection()
It takes the selected ROIs and copies them to the clipboard.
static void KeyDownEvent(object o, KeyEventArgs e)
Definition Plugin.cs:72

◆ ImageView_KeyPress()

void BioCore.ImageView.ImageView_KeyPress ( object sender,
System.Windows.Forms.KeyPressEventArgs e )

Definition at line 3333 of file ImageView.cs.

3334 {
3335 Plugins.KeyPressEvent(sender, e);
3336 }
static void KeyPressEvent(object o, KeyPressEventArgs e)
Definition Plugin.cs:79

◆ ImageView_KeyUp()

void BioCore.ImageView.ImageView_KeyUp ( object sender,
KeyEventArgs e )

Definition at line 3329 of file ImageView.cs.

3330 {
3331 Plugins.KeyUpEvent(sender, e);
3332 }
static void KeyUpEvent(object o, KeyEventArgs e)
Definition Plugin.cs:65

◆ InitGUI()

void BioCore.ImageView.InitGUI ( )

It initializes the GUI

Returns
The image is being returned.

Definition at line 905 of file ImageView.cs.

906 {
907 if (SelectedImage == null)
908 return;
909 zBar.Maximum = SelectedImage.SizeZ - 1;
910 if (!SelectedImage.IsZarrSource && SelectedImage.Buffers[0].RGBChannelsCount == 3)
911 cBar.Maximum = 0;
912 else
913 cBar.Maximum = SelectedImage.SizeC - 1;
914 if (SelectedImage.SizeT > 1)
915 {
916 tBar.Maximum = SelectedImage.SizeT - 1;
917 timeEnabled = true;
918 }
919 else
920 {
921 tBar.Enabled = false;
922 timeEnabled = false;
923 tBar.Maximum = SelectedImage.SizeT - 1;
924 }
925 //rgbPictureBox.Image = image.plane.GetBitmap();
926 //we clear the channel comboboxes incase we have channels from previous loaded image.
927 bool sameImage = ReferenceEquals(rgbSelectorImage, SelectedImage);
928 rgbSelectorImage = SelectedImage;
929 bool[] previousEnabled = (bool[])rgbEnabled.Clone();
930 int[] previousChannels = (int[])SelectedImage.rgbChannels.Clone();
931 initializingRgbSelectors = true;
932 channelBoxR.Items.Clear();
933 channelBoxG.Items.Clear();
934 channelBoxB.Items.Clear();
935
936 channelBoxR.Items.Add("");
937 channelBoxG.Items.Add("");
938 channelBoxB.Items.Add("");
939 foreach (Channel ch in SelectedImage.Channels)
940 {
941 channelBoxR.Items.Add(ch);
942 channelBoxG.Items.Add(ch);
943 channelBoxB.Items.Add(ch);
944 }
945 System.Windows.Forms.ComboBox[] rgbBoxes = { channelBoxR, channelBoxG, channelBoxB };
946 int count = SelectedImage.Channels.Count;
947 for (int i = 0; i < rgbBoxes.Length; i++)
948 rgbBoxes[i].SelectedIndex = count == 0 || (sameImage && !previousEnabled[i]) ? 0 :
949 (sameImage ? Math.Clamp(previousChannels[i], 0, count - 1) : (i < count ? i : 0)) + 1;
950 initializingRgbSelectors = false;
952
953 init = true;
954 }
void UpdateRGBChannels()
Definition ImageView.cs:843

◆ MoveStageToImage() [1/2]

void BioCore.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 3591 of file ImageView.cs.

3592 {
3593 if (SelectedImage == null)
3594 return;
3595 Microscope.Stage.SetPosition(SelectedImage.Volume.Location.X, SelectedImage.Volume.Location.Y);
3596 update = true;
3597 UpdateView();
3598 }
static Stage Stage
void SetPosition(double px, double py)
Definition Microscope.cs:50

◆ MoveStageToImage() [2/2]

void BioCore.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 3602 of file ImageView.cs.

3603 {
3604 update = true;
3605 Microscope.Stage.SetPosition(Images[i].Volume.Location.X, Images[i].Volume.Location.Y);
3606 UpdateView();
3607 }

◆ OnLayout()

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

Definition at line 186 of file ImageView.cs.

187 {
188 base.OnLayout(e);
189 if (viewport == null || statusPanel == null || trackBarPanel == null ||
190 hScrollBar == null || vScrollBar == null)
191 return;
192
193 int top = statusPanel.Visible ? statusPanel.Bottom : 0;
194 int bottom = trackBarPanel.Visible ? trackBarPanel.Top : ClientSize.Height;
195 int width = Math.Max(0, ClientSize.Width - (vScrollBar.Visible ? vScrollBar.Width : 0));
196 int height = Math.Max(0, bottom - top - (hScrollBar.Visible ? hScrollBar.Height : 0));
197
198 // Hidden scrollbars must not leave unused strips around the image surface.
199 viewport.Bounds = new System.Drawing.Rectangle(0, top, width, height);
200 hScrollBar.SetBounds(0, top + height, width, hScrollBar.Height);
201 vScrollBar.SetBounds(width, top, vScrollBar.Width, height);
202 UpdateScrollBars();
203 }

◆ PasteSelection()

void BioCore.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 2854 of file ImageView.cs.

2855 {
2856 string[] sts = System.Windows.Forms.Clipboard.GetText().Split(BioImage.NewLine);
2857 foreach (string line in sts)
2858 {
2859 if (line.Length > 8)
2860 {
2861 ROI an = BioImage.StringToROI(line);
2862 //We set the coordinates of the ROI's we are pasting
2863 an.coord = GetCoordinate();
2864 SelectedImage.Annotations.Add(an);
2865 }
2866 }
2867 UpdateOverlay();
2868 }

◆ ProcessCmdKey()

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

Definition at line 205 of file ImageView.cs.

206 {
207 const int WM_KEYDOWN = 0x0100;
208 const int WM_KEYUP = 0x0101;
209 const int WM_CHAR = 0x0102;
210
211 switch (msg.Msg)
212 {
213 case WM_KEYDOWN:
214 ImageView_KeyDown(this, new KeyEventArgs(keyData));
215 break;
216
217 case WM_KEYUP:
218 ImageView_KeyUp(this, new KeyEventArgs(keyData));
219 break;
220
221 case WM_CHAR:
222 char ch = (char)msg.WParam;
223 ImageView_KeyPress(this, new System.Windows.Forms.KeyPressEventArgs(ch));
224 break;
225 }
226
227 return base.ProcessCmdKey(ref msg, keyData);
228 }

◆ RemoveImage()

void BioCore.ImageView.RemoveImage ( int i)

Definition at line 1497 of file ImageView.cs.

1498 {
1499 do
1500 {
1501 System.Threading.Thread.Sleep(50);
1502 Application.DoEvents();
1503 } while (drawing || updating);
1504 Images[i].Dispose();
1505 Images.RemoveAt(i);
1506 UpdateImages();
1507 }
System.Windows.Forms.Application Application
Definition ImageView.cs:14

◆ RemoveImages()

void BioCore.ImageView.RemoveImages ( )

Definition at line 1508 of file ImageView.cs.

1509 {
1510 do
1511 {
1512 Thread.Sleep(50);
1513 Application.DoEvents();
1514 } while (drawing || updating);
1515 for (int i = 0; i < Images.Count; i++)
1516 {
1517 Images[i].Dispose();
1518 }
1519 Images.Clear();
1520 UpdateImages();
1521 }

◆ SetCoordinate()

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

‍Sets the coordinate of the image to the specified Z, C, and T values

Parameters
zthe z-coordinate of the image
cchannel
ttime
Returns
The method is returning the value of the zBar.Value, cBar.Value, and tBar.Value.

Definition at line 443 of file ImageView.cs.

444 {
445 System.Threading.Tasks.Task.Run(() =>
446 {
447 try
448 {
449 App.viewer.Invoke((MethodInvoker)delegate
450 {
451 if (SelectedImage == null)
452 return;
453 if (z >= SelectedImage.SizeZ)
454 zBar.Value = zBar.Maximum;
455 if (c >= SelectedImage.SizeC)
456 cBar.Value = cBar.Maximum;
457 if (t >= SelectedImage.SizeT)
458 tBar.Value = tBar.Maximum;
459 zBar.Value = z;
460 cBar.Value = c;
461 tBar.Value = t;
462 });
463 }
464 catch (Exception e)
465 {
466 Console.WriteLine(e.Message);
467 }
468
469 });
470 }
static ImageView viewer
Definition App.cs:16

◆ ToScreenH()

float BioCore.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 3255 of file ImageView.cs.

3256 {
3257 return (float)(y * PxHmicron);
3258 }
double PxHmicron
Only used when opening stacks.
Definition ImageView.cs:614

◆ ToScreenRect()

RectangleD BioCore.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 3144 of file ImageView.cs.

3145 {
3146 if (SelectedImage == null)
3147 {
3148 PointD pf;
3149 pf = ToScreenSpace(x, y);
3150 return new RectangleD(pf.X, pf.Y, ToScreenScaleW(w), ToScreenScaleH(h));
3151 }
3152 if (SelectedImage.isPyramidal)
3153 {
3154 PointD d = ToViewSpace(x, y);
3155 double dw = ToViewSizeW(w);
3156 double dh = ToViewSizeH(h);
3157 return new RectangleD((d.X - PyramidalOrigin.X), (d.Y - PyramidalOrigin.Y), dw, dh);
3158 }
3159 else
3160 {
3161 PointD pf = ToScreenSpace(x, y);
3162 return new RectangleD(pf.X, pf.Y, ToScreenScaleW(w), ToScreenScaleH(h));
3163 }
3164 }
double ToViewSizeH(double d)
PointD ToScreenSpace(double x, double y)

◆ ToScreenScale()

PointF BioCore.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 3130 of file ImageView.cs.

3131 {
3132 float x = ToScreenScaleW((float)p.X);
3133 float y = ToScreenScaleH((float)p.Y);
3134 return new PointF(x, y);
3135 }

◆ ToScreenScaleH()

float BioCore.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 3121 of file ImageView.cs.

3122 {
3123 return (float)(y * PxHmicron);
3124 }

◆ ToScreenScaleW()

float BioCore.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 3112 of file ImageView.cs.

3113 {
3114 return (float)(x * PxWmicron);
3115 }
double PxWmicron
Only used when opening stacks.
Definition ImageView.cs:599

◆ ToScreenSpace() [1/10]

PointD BioCore.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 3058 of file ImageView.cs.

3059 {
3060 double fx = ToScreenScaleW(Origin.X + x);
3061 double fy = ToScreenScaleH(Origin.Y + y);
3062 return new PointD(fx, fy);
3063 }

◆ ToScreenSpace() [2/10]

PointF BioCore.ImageView.ToScreenSpace ( Point3D p)

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

Parameters
Point3D
Returns
A PointF object.

Definition at line 3102 of file ImageView.cs.

3103 {
3104 PointD pd = ToScreenSpace(p.X, p.Y);
3105 return new PointF((float)pd.X, (float)pd.Y);
3106 }

◆ ToScreenSpace() [3/10]

PointD BioCore.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 3069 of file ImageView.cs.

3070 {
3071 return ToScreenSpace(p.X, p.Y);
3072 }

◆ ToScreenSpace() [4/10]

PointF[] BioCore.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 3231 of file ImageView.cs.

3232 {
3233 PointF[] rs = new PointF[p.Length];
3234 for (int i = 0; i < p.Length; i++)
3235 {
3236 PointD pd = ToScreenSpace(p[i]);
3237 rs[i] = new PointF((float)pd.X, (float)pd.Y);
3238 }
3239 return rs;
3240 }

◆ ToScreenSpace() [5/10]

PointF BioCore.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 3078 of file ImageView.cs.

3079 {
3080 PointD pd = ToScreenSpace(p.X, p.Y);
3081 return new PointF((float)pd.X, (float)pd.Y);
3082 }

◆ ToScreenSpace() [6/10]

PointF[] BioCore.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 3088 of file ImageView.cs.

3089 {
3090 PointF[] pf = new PointF[p.Length];
3091 for (int i = 0; i < p.Length; i++)
3092 {
3093 pf[i] = ToScreenSpace(p[i]);
3094 }
3095 return pf;
3096 }

◆ ToScreenSpace() [7/10]

RectangleD BioCore.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 3185 of file ImageView.cs.

3186 {
3187 return ToScreenRect(p.X, p.Y, p.W, p.H);
3188 }

◆ ToScreenSpace() [8/10]

RectangleD[] BioCore.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 3203 of file ImageView.cs.

3204 {
3205 RectangleD[] rs = new RectangleD[p.Length];
3206 for (int i = 0; i < p.Length; i++)
3207 {
3208 rs[i] = ToScreenSpace(p[i]);
3209 }
3210 return rs;
3211 }

◆ ToScreenSpace() [9/10]

RectangleD BioCore.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 3194 of file ImageView.cs.

3195 {
3196 return ToScreenRect(p.X, p.Y, p.Width, p.Height);
3197 }

◆ ToScreenSpace() [10/10]

RectangleF[] BioCore.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 3217 of file ImageView.cs.

3218 {
3219 RectangleF[] rs = new RectangleF[p.Length];
3220 for (int i = 0; i < p.Length; i++)
3221 {
3222 rs[i] = ToScreenSpace(p[i]).ToRectangleF();
3223 }
3224 return rs;
3225 }

◆ ToScreenW()

float BioCore.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 3246 of file ImageView.cs.

3247 {
3248 return (float)(x * PxWmicron);
3249 }

◆ ToSKRect()

SKRect BioCore.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 3174 of file ImageView.cs.

3175 {
3176 double xd = gl.Width / 2;
3177 double yd = gl.Height / 2;
3178 return new SKRect((float)(xd - x), (float)(yd - y), (float)(xd - (x + w)), (float)(yd - (y + h)));
3179 }

◆ ToViewH()

double BioCore.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 3047 of file ImageView.cs.

3048 {
3049 double y = (double)(d / PxHmicron) / scale.Height;
3050 return y;
3051 }

◆ ToViewSizeH()

double BioCore.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 3022 of file ImageView.cs.

3023 {
3024 if (SelectedImage != null)
3025 if (SelectedImage.isPyramidal)
3026 {
3027 return d / Resolution;
3028 }
3029 double y = (double)(d / PxHmicron);
3030 return y;
3031 }

◆ ToViewSpace() [1/3]

PointD BioCore.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 2988 of file ImageView.cs.

2989 {
2990 if (SelectedImage != null)
2991 if (SelectedImage.isPyramidal)
2992 {
2993 double ddx = x / Resolution;
2994 double ddy = y / Resolution;
2995 return new PointD(ddx, ddy);
2996 }
2997 double dx, dy;
2998 dx = (ToViewSizeW(x - (ViewWidth / 2)) / Scale.Width) - Origin.X;
2999 dy = (ToViewSizeH(y - (ViewHeight / 2)) / Scale.Height) - Origin.Y;
3000 return new PointD(dx, dy);
3001 }

◆ ToViewSpace() [2/3]

PointD BioCore.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 2978 of file ImageView.cs.

2979 {
2980 return ToViewSpace(p.X, p.Y); ;
2981 }

◆ ToViewSpace() [3/3]

PointF BioCore.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 2968 of file ImageView.cs.

2969 {
2970 PointD d = ToViewSpace(p.X, p.Y);
2971 return new PointF((float)d.X, (float)d.Y);
2972 }

◆ ToViewW()

double BioCore.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 3037 of file ImageView.cs.

3038 {
3039 double x = (double)(d / PxWmicron) / scale.Width;
3040 return x;
3041 }

◆ UpdateImage()

void BioCore.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 1526 of file ImageView.cs.

1527 {
1528 UpdateImages();
1529 }

◆ UpdateImages()

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

Definition at line 1305 of file ImageView.cs.

1306 {
1307 if (SelectedImage == null)
1308 return;
1310 UpdateImageSurface();
1311 if (SelectedImage.isPyramidal)
1312 {
1313 InitPreview();
1314 if (!updatePyramidal || gl.Width <= 1 || gl.Height <= 1)
1315 return;
1316 updatePyr = true;
1317 SelectedImage.PyramidalOrigin = PyramidalOrigin;
1318 SelectedImage.PyramidalSize = new AForge.Size(gl.Width, gl.Height);
1319
1320 // Use the new renderer - no more ReadPixels!
1321 if (slideRenderer == null)
1322 {
1323 slideRenderer = new SlideRenderer(gl);
1324 }
1325 try
1326 {
1327 BioImage? directZarr = null;
1328 int[]? directZarrChannels = null;
1329 if (SelectedImage.IsZarrSource)
1330 {
1331 if (Mode == ViewMode.RGBImage)
1332 {
1333 directZarr = SelectedImage;
1334 directZarrChannels = SelectedRgbChannels(SelectedImage);
1335 }
1336 else if (Mode == ViewMode.Filtered)
1337 {
1338 // Use the same direct, coordinate-aware Zarr reader as
1339 // RGB mode. Repeating the selected channel produces the
1340 // expected grayscale Filtered view and avoids the legacy
1341 // buffered plane path that could remain stuck on Z=0.
1342 int channel = Math.Clamp(GetCoordinate().C, 0,
1343 Math.Max(0, SelectedImage.SizeC - 1));
1344 directZarr = SelectedImage;
1345 directZarrChannels = new[] { channel, channel, channel };
1346 }
1347 }
1348
1349 await slideRenderer.UpdateViewAsync(
1351 gl.Width,
1352 gl.Height,
1353 Resolution,
1354 GetCoordinate(),
1355 directZarr,
1356 directZarrChannels
1357 );
1358 }
1359 catch (Exception ex)
1360 {
1361 System.Diagnostics.Trace.WriteLine($"Could not update slide view: {ex}");
1362 }
1363 // Pyramidal images are drawn from tiles, not the full-plane buffers below.
1364 return;
1365 }
1366
1367 if (SelectedImage.IsZarrSource &&
1368 (Mode == ViewMode.RGBImage || Mode == ViewMode.Filtered) &&
1369 Images.Count == 1 && SelectedImage.levels?.Count > 0)
1370 {
1371 var image = SelectedImage;
1372 var requestedMode = Mode;
1373 int request = ++zarrRgbRequest;
1374 int width = image.Buffers[0].SizeX, height = image.Buffers[0].SizeY;
1375 try
1376 {
1377 int[] channels;
1378 if (requestedMode == ViewMode.RGBImage)
1379 {
1380 channels = SelectedRgbChannels(image);
1381 }
1382 else
1383 {
1384 int channel = Math.Clamp(GetCoordinate().C, 0,
1385 Math.Max(0, image.SizeC - 1));
1386 channels = new[] { channel, channel, channel };
1387 }
1388
1389 byte[] rgba = await ZarrChannelView.ReadRgbTileAsync(image, 0, 0, 0, width, height,
1390 GetCoordinate(), channels);
1391 if (request != zarrRgbRequest || SelectedImage != image || Mode != requestedMode)
1392 return;
1393 var frame = new System.Drawing.Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
1394 var data = frame.LockBits(new System.Drawing.Rectangle(0, 0, width, height),
1395 System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
1396 try
1397 {
1398 for (int i = 0; i < rgba.Length; i += 4)
1399 (rgba[i], rgba[i + 2]) = (rgba[i + 2], rgba[i]);
1400 for (int row = 0; row < height; row++)
1401 Marshal.Copy(rgba, row * width * 4, IntPtr.Add(data.Scan0, row * data.Stride), width * 4);
1402 }
1403 finally { frame.UnlockBits(data); }
1404 foreach (var old in Bitmaps) old?.Dispose();
1405 Bitmaps.Clear();
1406 Bitmaps.Add(frame);
1407 update = true;
1408 InvalidateView();
1409 }
1410 catch (Exception ex)
1411 {
1412 System.Diagnostics.Trace.WriteLine($"Could not render Zarr RGB channels: {ex.Message}");
1413 }
1414 return;
1415 }
1416
1417 // AForge's filters copy from unmanaged pixel pointers. Missing or disposed
1418 // buffers have a null pointer, so keep the last frame until pixels are available.
1419 foreach (BioImage image in Images)
1420 {
1421 int index = image.GetFrameIndex(zBar.Value, cBar.Value, tBar.Value);
1422 bool unavailable = index < 0 || index >= image.Buffers.Count;
1423 if (!unavailable)
1424 {
1425 var buffers = Mode == ViewMode.Filtered || Mode == ViewMode.Raw
1426 ? new[] { image.Buffers[index] }
1427 : image.Buffers.AsEnumerable();
1428 unavailable = buffers.Any(buffer =>
1429 buffer == null || buffer.Bytes == null || buffer.Bytes.Length == 0);
1430 }
1431 if (unavailable)
1432 {
1433 System.Diagnostics.Trace.WriteLine($"Image pixels are unavailable: {image.ID}");
1434 return;
1435 }
1436 }
1437 for (int i = 0; i < Bitmaps.Count; i++)
1438 {
1439 Bitmaps[i].Dispose();
1440 Bitmaps[i] = null;
1441 }
1442 Bitmaps.Clear();
1443 if (zBar.Maximum != SelectedImage.SizeZ - 1 || tBar.Maximum != SelectedImage.SizeT - 1)
1444 {
1445 InitGUI();
1446 }
1447
1448 int bi = 0;
1449 foreach (BioImage b in Images)
1450 {
1451 if (b.isPyramidal)
1452 updatePyr = true;
1453 b.PyramidalOrigin = PyramidalOrigin;
1454 b.PyramidalSize = new AForge.Size(gl.Width, gl.Height);
1455 ZCT coords = new ZCT(zBar.Value, cBar.Value, tBar.Value);
1456 Bitmap bitmap = null;
1457
1458 int index = b.Coords[zBar.Value, cBar.Value, tBar.Value];
1459 if (Mode == ViewMode.Filtered)
1460 {
1461 bitmap = b.GetFiltered(coords, b.RChannel.RangeR, b.GChannel.RangeG, b.BChannel.RangeB);
1462 }
1463 else if (Mode == ViewMode.RGBImage)
1464 {
1465 if (b.Buffers[0].RGBChannelsCount == 1)
1466 {
1467 var planes = new Bitmap[3];
1468 for (int color = 0; color < 3; color++)
1469 {
1470 int channel = Math.Clamp(b.rgbChannels[color], 0, b.SizeC - 1);
1471 planes[2 - color] = b.Buffers[b.GetFrameIndex(coords.Z, channel, coords.T)];
1472 }
1473 bitmap = Bitmap.GetRGBBitmap(planes, b.RChannel.RangeR, b.GChannel.RangeG, b.BChannel.RangeB);
1474 }
1475 else
1476 bitmap = b.GetRGBBitmap(coords, b.RChannel.RangeR, b.GChannel.RangeG, b.BChannel.RangeB);
1477 }
1478 else if (Mode == ViewMode.Raw)
1479 {
1480 bitmap = (Bitmap)b.Buffers[index].GetImageRGBA();
1481 }
1482 else
1483 {
1484 bitmap = b.GetEmission(coords, b.RChannel.RangeR, b.GChannel.RangeG, b.BChannel.RangeB);
1485 }
1486 var display = ToSysBitmap(bitmap);
1487 if (Mode == ViewMode.RGBImage)
1488 MaskRgbComponents(display, rgbEnabled);
1489 Bitmaps.Add(display);
1490 bi++;
1491 }
1492 UpdateRegularOverview();
1493 update = true;
1494 InvalidateView();
1495 }
static ChannelsTool channelsTool
Definition App.cs:9
async Task UpdateViewAsync(PointD pyramidalOrigin, int viewportWidth, int viewportHeight, double resolution, ZCT coordinate, BioImage? rgbZarr=null, int[]? rgbSelection=null)

◆ UpdateOverlay()

void BioCore.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 967 of file ImageView.cs.

968 {
969 updateOverlay = true;
970 InvalidateView();
971 }

◆ UpdateRGBChannels()

void BioCore.ImageView.UpdateRGBChannels ( )

Definition at line 843 of file ImageView.cs.

844 {
845 if (SelectedImage == null) return;
846 System.Windows.Forms.ComboBox[] boxes = { channelBoxR, channelBoxG, channelBoxB };
847 for (int i = 0; i < boxes.Length; i++)
848 {
849 rgbEnabled[i] = boxes[i].SelectedIndex > 0;
850 if (rgbEnabled[i]) SelectedImage.rgbChannels[i] = boxes[i].SelectedIndex - 1;
851 }
852 }

◆ UpdateSelectBoxSize()

void BioCore.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 959 of file ImageView.cs.

960 {
961 ROI.selectBoxSize = size;
962 }

◆ UpdateStatus()

void BioCore.ImageView.UpdateStatus ( )

It updates the status bar of the image viewer

Returns
The statusLabel.Text is being returned.

Definition at line 975 of file ImageView.cs.

976 {
977 if (SelectedImage == null)
978 return;
979 string res = "";
980 if (SelectedImage.Type == BioImage.ImageType.well)
981 res = "Well:" + SelectedImage.Level;
982 else if (SelectedImage.Type == BioImage.ImageType.pyramidal)
983 {
984 res = $"Res.:{Resolution:G4} Level:{Level}";
985 }
986 string origin = $"({-Origin.X:0.##}, {-Origin.Y:0.##})";
987 string location = $"({SelectedImage.Volume.Location.X:0.##}, {SelectedImage.Volume.Location.Y:0.##})";
988 if (Mode == ViewMode.RGBImage)
989 {
990 if (timeEnabled)
991 {
992 statusLabel.Text = (zBar.Value + 1) + "/" + (zBar.Maximum + 1) + ", " + (tBar.Value + 1) + "/" + (tBar.Maximum + 1) + ", " +
993 mousePoint + mouseColor + ", " + SelectedImage.Buffers[0].PixelFormat.ToString() + ", " + origin + ", " + location + " " + res;
994 }
995 else
996 {
997 statusLabel.Text = (zBar.Value + 1) + "/" + (cBar.Maximum + 1) + ", " + mousePoint + mouseColor + ", " + SelectedImage.Buffers[0].PixelFormat.ToString()
998 + ", " + origin + ", " + location + " " + res;
999 }
1000
1001 }
1002 else
1003 {
1004 if (timeEnabled)
1005 {
1006 statusLabel.Text = (zBar.Value + 1) + "/" + (zBar.Maximum + 1) + ", " + (cBar.Value + 1) + "/" + (cBar.Maximum + 1) + ", " + (tBar.Value + 1) + "/" + (tBar.Maximum + 1) + ", " +
1007 mousePoint + mouseColor + ", " + SelectedImage.Buffers[0].PixelFormat.ToString() + ", " + origin + ", " + location + " " + res;
1008 }
1009 else
1010 {
1011 statusLabel.Text = (zBar.Value + 1) + "/" + (zBar.Maximum + 1) + ", " + (cBar.Value + 1) + "/" + (cBar.Maximum + 1) + ", " + mousePoint + mouseColor + ", " +
1012 SelectedImage.Buffers[0].PixelFormat.ToString() + ", " + origin + ", " + location + " " + res;
1013 }
1014 }
1015 }

◆ UpdateView() [1/2]

void BioCore.ImageView.UpdateView ( )

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

Returns
The method is returning void.

Definition at line 1020 of file ImageView.cs.

1021 {
1022 UpdateImageSurface();
1023 if(SelectedImage!=null)
1024 if (SelectedImage.isPyramidal)
1025 {
1026 // Set the source based on image type
1027 if (SelectedImage.OpenSlideBase != null)
1028 {
1029 slideRenderer.SetSource(SelectedImage.OpenSlideBase);
1030 }
1031 else if (SelectedImage.SlideBase != null)
1032 {
1033 slideRenderer.SetSource(SelectedImage.SlideBase);
1034 }
1035 }
1036 UpdateStatus();
1037 update = true;
1038 UpdateImages();
1039 InvalidateView();
1040 }

◆ UpdateView() [2/2]

void BioCore.ImageView.UpdateView ( 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 1290 of file ImageView.cs.

1291 {
1292 UpdateStatus();
1293 update = refresh;
1294 if (update)
1295 {
1296 InvalidateView();
1297 }
1298 }

Member Data Documentation

◆ Buf

Image BioCore.ImageView.Buf = null

Definition at line 353 of file ImageView.cs.

◆ down

bool BioCore.ImageView.down
static

Definition at line 336 of file ImageView.cs.

◆ filepath

string BioCore.ImageView.filepath = ""

Definition at line 419 of file ImageView.cs.

◆ init

bool BioCore.ImageView.init = false

Definition at line 354 of file ImageView.cs.

◆ Layers

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

Definition at line 290 of file ImageView.cs.

◆ loopC

bool BioCore.ImageView.loopC = true

Definition at line 425 of file ImageView.cs.

◆ loopT

bool BioCore.ImageView.loopT = true

Definition at line 424 of file ImageView.cs.

◆ loopZ

bool BioCore.ImageView.loopZ = true

Definition at line 423 of file ImageView.cs.

◆ minSizeX

int BioCore.ImageView.minSizeX = 50

Definition at line 421 of file ImageView.cs.

◆ minSizeY

int BioCore.ImageView.minSizeY = 20

Definition at line 422 of file ImageView.cs.

◆ mouseDown

PointD BioCore.ImageView.mouseDown
static

Definition at line 335 of file ImageView.cs.

◆ mouseDownButtons

MouseButtons BioCore.ImageView.mouseDownButtons
static

Definition at line 349 of file ImageView.cs.

◆ mouseUp

PointD BioCore.ImageView.mouseUp
static

Definition at line 337 of file ImageView.cs.

◆ mouseUpButtons

MouseButtons BioCore.ImageView.mouseUpButtons
static

Definition at line 348 of file ImageView.cs.

◆ overviewImage

System.Drawing.Bitmap BioCore.ImageView.overviewImage = null

Definition at line 365 of file ImageView.cs.

◆ selectedAnnotations

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

Definition at line 303 of file ImageView.cs.

◆ serie

int BioCore.ImageView.serie = 0

Definition at line 420 of file ImageView.cs.

◆ showBounds

bool BioCore.ImageView.showBounds = true
static

Definition at line 351 of file ImageView.cs.

◆ showBROIs

bool BioCore.ImageView.showBROIs = true

Definition at line 2052 of file ImageView.cs.

◆ showGROIs

bool BioCore.ImageView.showGROIs = true

Definition at line 2051 of file ImageView.cs.

◆ showRROIs

bool BioCore.ImageView.showRROIs = true

Definition at line 2050 of file ImageView.cs.

◆ showText

bool BioCore.ImageView.showText = true
static

Definition at line 352 of file ImageView.cs.

◆ up

bool BioCore.ImageView.up
static

Definition at line 338 of file ImageView.cs.

Property Documentation

◆ AnnotationsB

List<ROI> BioCore.ImageView.AnnotationsB
get

Definition at line 2071 of file ImageView.cs.

2072 {
2073 get
2074 {
2075 return SelectedImage.GetAnnotations(SelectedImage.Coordinate.Z, SelectedImage.BChannel.Index, SelectedImage.Coordinate.T);
2076 }
2077 }

◆ AnnotationsG

List<ROI> BioCore.ImageView.AnnotationsG
get

Definition at line 2063 of file ImageView.cs.

2064 {
2065 get
2066 {
2067 return SelectedImage.GetAnnotations(SelectedImage.Coordinate.Z, SelectedImage.GChannel.Index, SelectedImage.Coordinate.T);
2068 }
2069 }

◆ AnnotationsR

List<ROI> BioCore.ImageView.AnnotationsR
get

Definition at line 2055 of file ImageView.cs.

2056 {
2057 get
2058 {
2059 return SelectedImage.GetAnnotations(SelectedImage.Coordinate.Z, SelectedImage.RChannel.Index, SelectedImage.Coordinate.T);
2060 }
2061 }

◆ AnnotationsRGB

List<ROI> BioCore.ImageView.AnnotationsRGB
get

Definition at line 2078 of file ImageView.cs.

2079 {
2080 get
2081 {
2082 if (SelectedImage == null)
2083 return null;
2084 List<ROI> ans = new List<ROI>();
2085 if (Mode == ViewMode.RGBImage)
2086 {
2087 if (showRROIs && rgbEnabled[0])
2088 ans.AddRange(AnnotationsR);
2089 if (showGROIs && rgbEnabled[1])
2090 ans.AddRange(AnnotationsG);
2091 if (showBROIs && rgbEnabled[2])
2092 ans.AddRange(AnnotationsB);
2093 }
2094 else
2095 {
2096 ans.AddRange(SelectedImage.GetAnnotations(SelectedImage.Coordinate));
2097 }
2098 return ans;
2099 }
2100 }
List< ROI > AnnotationsG
List< ROI > AnnotationsR
List< ROI > AnnotationsB

◆ BChannel

Channel BioCore.ImageView.BChannel
get

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

Definition at line 710 of file ImageView.cs.

711 {
712 get
713 {
714 return SelectedImage.Channels[SelectedImage.rgbChannels[2]];
715 }
716 }

◆ CFps

int BioCore.ImageView.CFps
getset

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

Definition at line 889 of file ImageView.cs.

890 {
891 get
892 {
893 return cfps;
894 }
895 set
896 {
897 cfps = value;
898 float f = value;
899 cTimer.Interval = (int)Math.Floor(1000 / f);
900 }
901 }

◆ Ctrl

bool BioCore.ImageView.Ctrl
staticget

Definition at line 339 of file ImageView.cs.

340 {
341 get
342 {
343 return Win32.GetKeyState(Keys.LControlKey);
344 }
345 }
static bool GetKeyState(System.Windows.Forms.Keys vKey)
Definition Win32.cs:20

◆ GChannel

Channel BioCore.ImageView.GChannel
get

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

Definition at line 702 of file ImageView.cs.

703 {
704 get
705 {
706 return SelectedImage.Channels[SelectedImage.rgbChannels[1]];
707 }
708 }

◆ Images

List<BioImage> BioCore.ImageView.Images
get

Definition at line 358 of file ImageView.cs.

359 {
360 get
361 {
362 return imgs;
363 }
364 }

◆ LabelResolution

int? BioCore.ImageView.LabelResolution
get

Definition at line 725 of file ImageView.cs.

725{ get { return SelectedImage.LabelResolution; } }

◆ Level

int BioCore.ImageView.Level
get

Current level when viewing whole-slide and pyramidal images.

Definition at line 790 of file ImageView.cs.

791 {
792 get
793 {
794 if (SelectedImage != null)
795 return SelectedImage.Level;
796 else
797 return 0;
798 }
799 }

◆ MacroResolution

int? BioCore.ImageView.MacroResolution
get

Definition at line 724 of file ImageView.cs.

724{ get { return SelectedImage.MacroResolution; } }

◆ Mode

ViewMode BioCore.ImageView.Mode
getset

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

Definition at line 634 of file ImageView.cs.

635 {
636 get
637 {
638 return viewMode;
639 }
640 set
641 {
642 if (Mode == value)
643 return;
644 viewMode = value;
645 //If view mode is changed we update.
646 update = true;
647 UpdateImages();
648 App.tabsView.UpdateViewMode(viewMode);
649 UpdateView();
651 if (viewMode == ViewMode.RGBImage)
652 {
653 cBar.Value = 0;
654 rgbBoxsPanel.BringToFront();
655 cBar.SendToBack();
656 cLabel.SendToBack();
657 gl.BringToFront();
658 }
659 else
660 if (viewMode == ViewMode.Filtered)
661 {
662 rgbBoxsPanel.SendToBack();
663 cBar.BringToFront();
664 cLabel.BringToFront();
665 gl.BringToFront();
666 }
667 else
668 if (viewMode == ViewMode.Raw)
669 {
670 rgbBoxsPanel.SendToBack();
671 cBar.BringToFront();
672 cLabel.BringToFront();
673 gl.BringToFront();
674 }
675 else
676 {
677 cBar.Value = 0;
678 rgbBoxsPanel.BringToFront();
679 cBar.SendToBack();
680 cLabel.SendToBack();
681 gl.BringToFront();
682 }
683 }
684 }

◆ MouseDownInt

PointD BioCore.ImageView.MouseDownInt
getset

Definition at line 3357 of file ImageView.cs.

3358 {
3359 get { return mouseDownInt; }
3360 set { mouseDownInt = value; }
3361 }

◆ MouseMoveInt

PointD BioCore.ImageView.MouseMoveInt
getset

Definition at line 3369 of file ImageView.cs.

3370 {
3371 get { return mouseMoveInt; }
3372 set { mouseMoveInt = value; }
3373 }

◆ MouseUpInt

PointD BioCore.ImageView.MouseUpInt
getset

Definition at line 3363 of file ImageView.cs.

3364 {
3365 get { return mouseUpInt; }
3366 set { mouseUpInt = value; }
3367 }

◆ OpenSlide

bool BioCore.ImageView.OpenSlide
get

Definition at line 720 of file ImageView.cs.

721 {
722 get { return openSlide; }
723 }

◆ Origin

PointD BioCore.ImageView.Origin
getset

A property of the class PointD. *‍/.

Definition at line 742 of file ImageView.cs.

743 {
744 get { return origin; }
745 set
746 {
747 origin = value;
748 update = true;
749 UpdateView();
750 }
751 }

◆ OverView

Rectangle BioCore.ImageView.OverView
get

Definition at line 427 of file ImageView.cs.

428 {
429 get { return overview; }
430 }

◆ Path

string BioCore.ImageView.Path
get

A property that returns the filepath. *‍/.

Definition at line 686 of file ImageView.cs.

687 {
688 get
689 {
690 return filepath;
691 }
692 }

◆ PxHmicron

double BioCore.ImageView.PxHmicron
getset

Only used when opening stacks.

Definition at line 613 of file ImageView.cs.

614 {
615 get
616 {
617 return pxHmicron;
618 }
619 set
620 {
621 pxHmicron = value;
622 }
623 }

◆ PxWmicron

double BioCore.ImageView.PxWmicron
getset

Only used when opening stacks.

Definition at line 598 of file ImageView.cs.

599 {
600 get
601 {
602 return pxWmicron;
603 }
604 set
605 {
606 pxWmicron = value;
607 }
608 }

◆ PyramidalOrigin

PointD BioCore.ImageView.PyramidalOrigin
getset

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

Definition at line 754 of file ImageView.cs.

755 {
756 get
757 {
758 if (SelectedImage == null)
759 return new PointD(0, 0);
760 return SelectedImage.PyramidalOrigin;
761 }
762 set
763 {
764 SelectedImage.PyramidalOrigin = value;
765 }
766 }

◆ PyramidalOriginTransformed

PointD BioCore.ImageView.PyramidalOriginTransformed
getset

Definition at line 3346 of file ImageView.cs.

3347 {
3348 get { return new PointD(PyramidalOrigin.X * Resolution, PyramidalOrigin.Y * Resolution); }
3349 set { PyramidalOrigin = new PointD(value.X / Resolution, value.Y / Resolution); }
3350 }

◆ RChannel

Channel BioCore.ImageView.RChannel
get

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

Definition at line 694 of file ImageView.cs.

695 {
696 get
697 {
698 return SelectedImage.Channels[SelectedImage.rgbChannels[0]];
699 }
700 }

◆ Resolution

double BioCore.ImageView.Resolution
getset

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

Definition at line 769 of file ImageView.cs.

770 {
771 get
772 {
773 if (SelectedImage == null)
774 return 1;
775 return SelectedImage.Resolution;
776 }
777 set
778 {
779 double dp = Resolution / value;
780 SelectedImage.PyramidalOrigin = new PointD((dp * PyramidalOrigin.X), (dp * PyramidalOrigin.Y));
781 SelectedImage.Resolution = value;
782 if (SelectedImage.Type == BioImage.ImageType.well)
783 SelectedImage.Level = (int)value;
784 updatePyr = true;
785 }
786 }

◆ Scale

new AForge.SizeF BioCore.ImageView.Scale
getset

Scale when opening image stacks.

Definition at line 804 of file ImageView.cs.

805 {
806 get
807 {
808 return scale;
809 }
810 set
811 {
812 scale = value;
813 update = true;
814 UpdateView();
815 if (SelectedImage != null)
816 if (SelectedImage.isPyramidal)
817 {
818 Tools.selectBoxSize = (float)(ROI.selectBoxSize * Resolution);
819 }
820 else
821 Tools.selectBoxSize = ROI.selectBoxSize;
822 }
823 }

◆ SelectedBuffer

Bitmap BioCore.ImageView.SelectedBuffer
staticget

Definition at line 327 of file ImageView.cs.

328 {
329 get
330 {
331 int ind = SelectedImage.Coords[SelectedImage.Coordinate.Z, SelectedImage.Coordinate.C, SelectedImage.Coordinate.T];
332 return SelectedImage.Buffers[ind];
333 }
334 }

◆ SelectedImage

BioImage BioCore.ImageView.SelectedImage
staticgetset

Definition at line 305 of file ImageView.cs.

306 {
307 get
308 {
309 if (App.viewer != null)
310 {
311 if (App.viewer.Images.Count > 0)
312 return App.viewer.Images[selectedIndex];
313 else
314 return null;
315 }
316 else
317 return null;
318 }
319 set
320 {
321 if (App.viewer.Images.Count > 0)
322 App.viewer.Images[selectedIndex] = value;
323 else
324 App.viewer.Images.Add(value);
325 }
326 }

◆ SelectedIndex

int BioCore.ImageView.SelectedIndex = 0
getset

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

Definition at line 405 of file ImageView.cs.

406 {
407 get;
408 set
409 {
410 if (value >= 0 && Images.Count > 0)
411 {
412 field = value;
413 selectedIndex = field;
414 InitGUI();
415 }
416 }
417 } = 0;

◆ ShowControls

bool BioCore.ImageView.ShowControls
getset

Setting the visibility of the trackBarPanel. *‍/.

Definition at line 524 of file ImageView.cs.

525 {
526 get { return trackBarPanel.Visible; }
527 set
528 {
529 showControls = value;
530 if (!value)
531 {
532 trackBarPanel.Hide();
533 if (ShowStatus)
534 {
535 gl.Top = 25;
536 gl.Height += 75;
537 }
538 else
539 {
540 gl.Top = 0;
541 gl.Height += 75;
542 }
543 hideControlsToolStripMenuItem1.Text = "Show Controls";
544 }
545 else
546 {
547 trackBarPanel.Show();
548 if (ShowStatus)
549 {
550 gl.Top = 25;
551 gl.Height -= 75;
552 }
553 else
554 {
555 gl.Top = 0;
556 gl.Height += 75;
557 }
558
559 //panel.Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left;
560 hideControlsToolStripMenuItem1.Text = "Hide Controls";
561 }
562 UpdateView();
563 }
564 }
bool ShowStatus
Setting the value of the property ShowStatus. *‍/.
Definition ImageView.cs:570

◆ ShowMasks

bool BioCore.ImageView.ShowMasks = true
getset

Definition at line 3376 of file ImageView.cs.

3376{ get; set; } = true;

◆ ShowOverview

bool BioCore.ImageView.ShowOverview
getset

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

19 {
20 get => showOverview;
21 set
22 {
23 showOverview = value;
24 UpdateOverviewVisibility();
25 }
26 }

◆ ShowStage

bool BioCore.ImageView.ShowStage
getset

Definition at line 432 of file ImageView.cs.

432{ get; set; }

◆ ShowStatus

bool BioCore.ImageView.ShowStatus
getset

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

Definition at line 569 of file ImageView.cs.

570 {
571 get { return showStatus; }
572 set
573 {
574 showStatus = true;
575 if (!value)
576 {
577 statusPanel.Hide();
578 gl.Top = 0;
579 gl.Height += 25;
580 showControlsToolStripMenuItem.Visible = true;
581 hideControlsToolStripMenuItem.Text = "Show Status";
582 }
583 else
584 {
585 statusPanel.Show();
586 statusPanel.Visible = value;
587 gl.Top = 25;
588 showControlsToolStripMenuItem.Visible = false;
589 hideControlsToolStripMenuItem.Text = "Hide Status";
590 }
591 }
592 }

◆ TimeFps

int BioCore.ImageView.TimeFps
getset

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

Definition at line 873 of file ImageView.cs.

874 {
875 get
876 {
877 return timefps;
878 }
879 set
880 {
881 timefps = value;
882 float f = value;
883 timelineTimer.Interval = (int)Math.Floor(1000 / f);
884 }
885 }

◆ tools

Tools BioCore.ImageView.tools
get

Definition at line 418 of file ImageView.cs.

418{ get { return App.tools; } }
static Tools tools
Definition App.cs:14

◆ ViewContextMenu

ContextMenuStrip BioCore.ImageView.ViewContextMenu
get

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

Definition at line 825 of file ImageView.cs.

826 {
827 get
828 {
829 return contextMenuStrip;
830 }
831 }

◆ ViewHeight

int BioCore.ImageView.ViewHeight
get

Definition at line 733 of file ImageView.cs.

734 {
735 get
736 {
737 return viewport.ClientSize.Height;
738 }
739 }

◆ ViewWidth

int BioCore.ImageView.ViewWidth
get

Definition at line 726 of file ImageView.cs.

727 {
728 get
729 {
730 return viewport.ClientSize.Width;
731 }
732 }

◆ ZFps

int BioCore.ImageView.ZFps
getset

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

Definition at line 857 of file ImageView.cs.

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

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