BioImager  3.9.1
A .NET microscopy imaging library. Supports various microscopes by using imported libraries & GUI automation. Supported libraries include Prior® & Zeiss® & all devices supported by Micromanager 2.0 and python-microscope.
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
 

Public Member Functions

 ImageView (BioImage im, bool OpenWithOpenSlide=true)
 Initializing the image viewer. *‍/. More...
 
 ImageView ()
 Initializing the ImageView class. *‍/. More...
 
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 RenderFrame ()
 
void UpdateView (bool refresh)
 
void UpdateImages ()
 
void RemoveImage (int i)
 
void RemoveImages ()
 
void UpdateImage ()
 
void GetRange ()
 
void DrawView (System.Drawing.Graphics g)
 Draws the viewport when Hardware Acceleration is off. More...
 
double GetScale ()
 
void CopySelection ()
 It takes the selected ROIs and copies them to the clipboard. More...
 
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)
 
System.Drawing.PointF ToScreenSpace (PointF p)
 
System.Drawing.PointF[] ToScreenSpace (PointF[] p)
 
PointF ToScreenSpace (Point3D p)
 
float ToScreenScaleW (double x)
 
float ToScreenScaleH (double y)
 
PointF ToScreenScale (PointD p)
 
System.Drawing.RectangleF ToScreenRectF (double x, double y, double w, double h)
 
RawRectangleF ToRawRectF (double x, double y, double w, double h)
 
System.Drawing.RectangleF ToScreenSpace (RectangleD p)
 
System.Drawing.RectangleF ToScreenSpace (RectangleF p)
 
System.Drawing.RectangleF[] ToScreenSpace (RectangleD[] p)
 
System.Drawing.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

Direct2D dx = null
 
Image Buf = null
 
bool init = false
 
List< BioImageImages = 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
 

Static Public Attributes

static List< ROIselectedAnnotations = 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 Dispose (bool disposing)
 Clean up any resources being used. More...
 

Properties

List< LayerLayers [get, set]
 
static BioImage SelectedImage [get]
 
static Bitmap SelectedBuffer [get]
 
static bool Ctrl [get]
 
int SelectedIndex [get, set]
 A property that is used to set the selected index of the image. *‍/. More...
 
Tools tools [get]
 
bool ShowStage [get, set]
 
bool ShowOverview [get, set]
 
bool ShowControls [get, set]
 Setting the visibility of the trackBarPanel. *‍/. More...
 
bool ShowStatus [get, set]
 Setting the value of the property ShowStatus. *‍/. More...
 
double PxWmicron [get, set]
 Only used when opening stacks. More...
 
double PxHmicron [get, set]
 Only used when opening stacks. More...
 
ViewMode Mode [get, set]
 Setting the view mode of the application. *‍/. More...
 
string Path [get]
 A property that returns the filepath. *‍/. More...
 
Channel RChannel [get]
 A property that returns the R channel of the selected image. *‍/. More...
 
Channel GChannel [get]
 A property that returns the G channel of the image. *‍/. More...
 
Channel BChannel [get]
 Getting the B channel of the image. *‍/. More...
 
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. *‍/. More...
 
PointD PyramidalOrigin [get, set]
 Setting the value of the pyramidalOrigin variable. *‍/. More...
 
double Resolution [get, set]
 A property of the class ImageViewer. It is a getter and setter for the resolution of the image. More...
 
int Level [get]
 Current level when viewing whole-slide and pyramidal images. More...
 
new AForge.SizeF Scale [get, set]
 Scale when opening image stacks. More...
 
bool HardwareAcceleration [get, set]
 Whether or not Hardware Acceleration should be used for rendering. More...
 
ContextMenuStrip ViewContextMenu [get]
 A property that returns a ContextMenuStrip object. *‍/. More...
 
int ZFps [get, set]
 Setting the interval of the timer to the value of the fps. *‍/. More...
 
int TimeFps [get, set]
 Setting the interval of the timer to the value of the timefps variable. *‍/. More...
 
int CFps [get, set]
 Setting the interval of the timer to the inverse of the fps. *‍/. More...
 
List< ROIAnnotationsR [get]
 
List< ROIAnnotationsG [get]
 
List< ROIAnnotationsB [get]
 
List< ROIAnnotationsRGB [get]
 
PointD PyramidalOriginTransformed [get, set]
 
PointD MouseDownInt [get, set]
 
PointD MouseMoveInt [get, set]
 

Detailed Description

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

Definition at line 18 of file ImageView.cs.

Member Enumeration Documentation

◆ ViewMode

enum BioImager.ImageView.ViewMode

Definition at line 487 of file ImageView.cs.

488 {
489 Raw,
490 Filtered,
491 RGBImage,
492 Emission,
493 }

Constructor & Destructor Documentation

◆ ImageView() [1/2]

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

Initializing the image viewer. *‍/.

Definition at line 21 of file ImageView.cs.

22 {
23 string file = im.ID.Replace("\\", "/");
24 InitializeComponent();
25 App.viewer = this;
26 if (im.slideImage != null && im.isPyramidal && OpenSlide)
27 openSlide = true;
28 serie = im.series;
29
30 Dock = DockStyle.Fill;
31 AddImage(im);
32 App.viewer = this;
33 if (file == "" || file == null)
34 return;
35 SetCoordinate(0, 0, 0);
36 InitGUI();
37 MouseWheel += new System.Windows.Forms.MouseEventHandler(ImageView_MouseWheel);
38 zBar.MouseWheel += new System.Windows.Forms.MouseEventHandler(ZTrackBar_MouseWheel);
39 cBar.MouseWheel += new System.Windows.Forms.MouseEventHandler(CTrackBar_MouseWheel);
40 tBar.MouseWheel += new System.Windows.Forms.MouseEventHandler(TimeTrackBar_MouseWheel);
41 //We set the trackbar event to handled so that it only scrolls one tick not the default multiple.
42 zBar.MouseWheel += (sender, e) => ((HandledMouseEventArgs)e).Handled = true;
43 tBar.MouseWheel += (sender, e) => ((HandledMouseEventArgs)e).Handled = true;
44 cBar.MouseWheel += (sender, e) => ((HandledMouseEventArgs)e).Handled = true;
45 TimeFps = 60;
46 ZFps = 60;
47 CFps = 1;
48 // Change parent for overlay PictureBox.
49 overlayPictureBox.Parent = pictureBox;
50 overlayPictureBox.Location = new System.Drawing.Point(0, 0);
51 resolutions = im.Resolutions;
52 if (im.isPyramidal)
53 {
54 dxPanel.Size = new System.Drawing.Size(800, 600);
55 if (im.openSlideImage != null && OpenWithOpenSlide)
56 {
57 openSlide = true;
58 Initialize(im.file);
59 }
60 else
61 Initialize(im.file);
62 hScrollBar.Maximum = im.Resolutions[Level].SizeX;
63 vScrollBar.Maximum = im.Resolutions[Level].SizeY;
64 hScrollBar.Visible = true;
65 vScrollBar.Visible = true;
66 }
67 else
68 {
69 hScrollBar.Visible = false;
70 vScrollBar.Visible = false;
71 pictureBox.Width += 18;
72 pictureBox.Height += 18;
73 overlayPictureBox.Width += 18;
74 overlayPictureBox.Height += 18;
75 Tools.selectBoxSize = ROI.selectBoxSize;
76 }
77 update = true;
78 InitPreview();
79 GoToImage();
81 Mode = ViewMode.Filtered;
82 UpdateView();
84 {
85 dx = new Direct2D();
86 dx.Initialize(new Configuration("BioImager", dxPanel.Width, dxPanel.Height), dxPanel.Handle);
87 }
88 }
void SetCoordinate(int z, int c, int t)
Definition: ImageView.cs:253
ViewMode Mode
Setting the view mode of the application. *‍/.
Definition: ImageView.cs:497
int TimeFps
Setting the interval of the timer to the value of the timefps variable. *‍/.
Definition: ImageView.cs:878
int CFps
Setting the interval of the timer to the inverse of the fps. *‍/.
Definition: ImageView.cs:893
bool HardwareAcceleration
Whether or not Hardware Acceleration should be used for rendering.
Definition: ImageView.cs:796
int ZFps
Setting the interval of the timer to the value of the fps. *‍/.
Definition: ImageView.cs:863
int Level
Current level when viewing whole-slide and pyramidal images.
Definition: ImageView.cs:758
void AddImage(BioImage im)
Definition: ImageView.cs:285

References BioImager.ImageView.AddImage(), BioImager.ImageView.CFps, BioImager.ImageView.GoToImage(), BioImager.ImageView.HardwareAcceleration, BioImager.ImageView.InitGUI(), BioImager.ImageView.Level, BioImager.ImageView.Mode, BioImager.ImageView.SetCoordinate(), BioImager.ImageView.TimeFps, BioImager.ImageView.UpdateImages(), BioImager.ImageView.UpdateView(), and BioImager.ImageView.ZFps.

◆ ImageView() [2/2]

BioImager.ImageView.ImageView ( )

Initializing the ImageView class. *‍/.

Definition at line 90 of file ImageView.cs.

91 {
92 InitializeComponent();
93 Dock = DockStyle.Fill;
94 App.viewer = this;
95 SetCoordinate(0, 0, 0);
96 InitGUI();
97 //Buf = image.GetBufByCoord(GetCoordinate());
98 MouseWheel += new System.Windows.Forms.MouseEventHandler(ImageView_MouseWheel);
99 zBar.MouseWheel += new System.Windows.Forms.MouseEventHandler(ZTrackBar_MouseWheel);
100 cBar.MouseWheel += new System.Windows.Forms.MouseEventHandler(CTrackBar_MouseWheel);
101 tBar.MouseWheel += new System.Windows.Forms.MouseEventHandler(TimeTrackBar_MouseWheel);
102 //We set the trackbar event to handled so that it only scrolls one tick not the default multiple.
103 zBar.MouseWheel += (sender, e) => ((HandledMouseEventArgs)e).Handled = true;
104 tBar.MouseWheel += (sender, e) => ((HandledMouseEventArgs)e).Handled = true;
105 cBar.MouseWheel += (sender, e) => ((HandledMouseEventArgs)e).Handled = true;
106 TimeFps = 60;
107 ZFps = 60;
108 CFps = 1;
109 // Change parent for overlay PictureBox.
110 overlayPictureBox.Parent = pictureBox;
111 overlayPictureBox.Location = new System.Drawing.Point(0, 0);
112
113 update = true;
114 UpdateImages();
115 GoToImage();
116 UpdateView();
118 {
119 dx = new Direct2D();
120 dx.Initialize(new Configuration("BioImager", dxPanel.Width, dxPanel.Height), dxPanel.Handle);
121 }
122 }

References BioImager.ImageView.CFps, BioImager.ImageView.GoToImage(), BioImager.ImageView.HardwareAcceleration, BioImager.ImageView.InitGUI(), BioImager.ImageView.SetCoordinate(), BioImager.ImageView.TimeFps, BioImager.ImageView.UpdateImages(), BioImager.ImageView.UpdateView(), and BioImager.ImageView.ZFps.

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 285 of file ImageView.cs.

286 {
287 Images.Add(im);
288 SelectedIndex = Images.Count - 1;
289 bool c = false;
290 foreach (var item in layers)
291 {
292 if (item.Resolution == im.PhysicalSizeX)
293 c = true;
294 }
295 if (!c)
296 Layers.Add(new Layer(im.PhysicalSizeX));
297 if (im.isPyramidal)
298 {
299 hScrollBar.Maximum = im.Resolutions[Level].SizeX;
300 vScrollBar.Maximum = im.Resolutions[Level].SizeY;
301 hScrollBar.Visible = true;
302 vScrollBar.Visible = true;
303 }
304 else
305 {
306 hScrollBar.Visible = false;
307 vScrollBar.Visible = false;
308 pictureBox.Width += 18;
309 pictureBox.Height += 18;
310 overlayPictureBox.Width += 18;
311 overlayPictureBox.Height += 18;
312 Tools.selectBoxSize = ROI.selectBoxSize;
313 }
314 InitGUI();
315 UpdateImages();
316 GoToImage(Images.Count - 1);
317 }
int SelectedIndex
A property that is used to set the selected index of the image. *‍/.
Definition: ImageView.cs:216

References BioImager.ImageView.GoToImage(), BioImager.ImageView.InitGUI(), BioImager.ImageView.Level, BioImager.ImageView.SelectedIndex, and BioImager.ImageView.UpdateImages().

Referenced by BioImager.ImageView.ImageView().

◆ CopySelection()

void BioImager.ImageView.CopySelection ( )

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

Definition at line 2728 of file ImageView.cs.

2729 {
2730 copys.Clear();
2731 string s = "";
2732 foreach (ROI item in AnnotationsRGB)
2733 {
2734 if (item.selected)
2735 {
2736 copys.Add(item);
2737 s += BioImage.ROIToString(item);
2738 }
2739 }
2740 Clipboard.SetText(s);
2741 }
static string ROIToString(ROI an)
Definition: Bio.cs:7712

References BioImager.BioImage.ROIToString().

Referenced by BioImager.ImageView.ImageView_KeyDown().

◆ Dispose() [1/2]

new void BioImager.ImageView.Dispose ( )

Definition at line 3392 of file ImageView.cs.

3393 {
3394 for (int i = 0; i < Bitmaps.Count; i++)
3395 {
3396 if (Bitmaps[i] != null)
3397 Bitmaps[i].Dispose();
3398 }
3399 for (int i = 0; i < dBitmaps.Count; i++)
3400 {
3401 if (dBitmaps[i] != null)
3402 dBitmaps[i].Dispose();
3403 }
3404 }

◆ 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 2216 of file ImageView.cs.

2217 {
2219 {
2220 RenderFrame();
2221 return;
2222 }
2223 drawing = true;
2224 if (Bitmaps.Count == 0 || Bitmaps.Count != Images.Count)
2225 UpdateImages();
2226 g.TranslateTransform(ViewWidth / 2, ViewHeight / 2);
2227 if (Scale.Width == 0 || float.IsInfinity(Scale.Width))
2228 Scale = new SizeF(1, 1);
2229 g.ScaleTransform(Scale.Width, Scale.Height);
2230 if (Bitmaps.Count == 0)
2231 return;
2232 System.Drawing.RectangleF[] rf = new System.Drawing.RectangleF[1];
2233 System.Drawing.Pen blue = new System.Drawing.Pen(Brushes.Blue, 1 / Scale.Width);
2234 int i = 0;
2235 foreach (BioImage im in Images)
2236 {
2237 if (!IsLayerEnabled(im.PhysicalSizeX) && !im.isPyramidal)
2238 continue;
2239 if (Bitmaps[i] == null)
2240 UpdateImages();
2241 System.Drawing.RectangleF r = ToScreenRectF(im.Volume.Location.X, im.Volume.Location.Y, im.Volume.Width, im.Volume.Height);
2242 double w = ToViewW(ViewWidth);
2243 double h = ToViewH(ViewHeight);
2244 RectangleF rg = new RectangleF((float)((-Origin.X) - (w / 2)), (float)((-Origin.Y) - (h / 2)), (float)(w), (float)(h));
2245 RectangleF rec = new RectangleF((float)im.Volume.Location.X, (float)im.Volume.Location.Y, (float)im.Volume.Width, (float)im.Volume.Height);
2246 if (SelectedImage.isPyramidal)
2247 {
2248 var tr = g.Transform;
2249 g.ResetTransform();
2250 g.DrawImage(ToSysBitmap(Bitmaps[i]), 0, 0);
2251 g.Transform = tr;
2252 }
2253 else
2254 if (rg.IntersectsWith(rec))
2255 {
2256 g.DrawImage(ToSysBitmap(Bitmaps[i]), r.X, r.Y, r.Width, r.Height);
2257 }
2258 if (i == SelectedIndex && !SelectedImage.isPyramidal)
2259 {
2260 rf[0] = r;
2261 g.DrawRectangles(blue, rf);
2262 }
2263 i++;
2264 }
2265 if (ShowOverview)
2266 {
2267 g.ResetTransform();
2268 g.DrawImage(ToSysBitmap(overviewBitmap), new System.Drawing.Point(0, 0));
2269 g.DrawRectangle(Pens.Gray, overview.X, overview.Y, overview.Width, overview.Height);
2270 if (!openSlide)
2271 {
2272 double dsx = _slideBase.Schema.Resolutions[Level].UnitsPerPixel / Resolution;
2273 Resolution rs = SelectedImage.Resolutions[Level];
2274 double dx = ((double)PyramidalOrigin.X / (rs.SizeX * dsx)) * overview.Width;
2275 double dy = ((double)PyramidalOrigin.Y / (rs.SizeY * dsx)) * overview.Height;
2276 double dw = ((double)ViewWidth / (rs.SizeX * dsx)) * overview.Width;
2277 double dh = ((double)ViewHeight / (rs.SizeY * dsx)) * overview.Height;
2278 g.DrawRectangle(Pens.Red, (int)dx, (int)dy, (int)dw, (int)dh);
2279 }
2280 else
2281 {
2282 double dsx = _openSlideBase.Schema.Resolutions[Level].UnitsPerPixel / Resolution;
2283 Resolution rs = SelectedImage.Resolutions[Level];
2284 double dx = ((double)PyramidalOrigin.X / (rs.SizeX * dsx)) * overview.Width;
2285 double dy = ((double)PyramidalOrigin.Y / (rs.SizeY * dsx)) * overview.Height;
2286 double dw = ((double)ViewWidth / (rs.SizeX * dsx)) * overview.Width;
2287 double dh = ((double)ViewHeight / (rs.SizeY * dsx)) * overview.Height;
2288 g.DrawRectangle(Pens.Red, (int)dx, (int)dy, (int)dw, (int)dh);
2289 }
2290 }
2291 if (ShowStage)
2292 {
2293 RectangleD d = Microscope.GetViewRectangle(false);
2294 System.Drawing.RectangleF[] rfs = new System.Drawing.RectangleF[1] { new System.Drawing.RectangleF((float)d.X, (float)d.Y, (float)d.W, (float)d.H) };
2295 rfs[0] = ToScreenRectF(rfs[0].X, rfs[0].Y, rfs[0].Width, rfs[0].Height);
2296 System.Drawing.Pen red = new System.Drawing.Pen(Brushes.Red, 1 / Scale.Width);
2297 g.DrawRectangles(red, rfs);
2298 }
2299 blue.Dispose();
2300 update = false;
2301 drawing = false;
2302 }
new AForge.SizeF Scale
Scale when opening image stacks.
Definition: ImageView.cs:773
PointD Origin
A property of the class PointD. *‍/.
Definition: ImageView.cs:644
PointD PyramidalOrigin
Setting the value of the pyramidalOrigin variable. *‍/.
Definition: ImageView.cs:654
System.Drawing.RectangleF ToScreenRectF(double x, double y, double w, double h)
Definition: ImageView.cs:3057
double ToViewW(double d)
Definition: ImageView.cs:2935
double ToViewH(double d)
Definition: ImageView.cs:2945
double Resolution
A property of the class ImageViewer. It is a getter and setter for the resolution of the image.
Definition: ImageView.cs:671

References BioImager.ImageView.HardwareAcceleration, BioImager.ImageView.Level, BioImager.ImageView.Origin, BioImager.ImageView.PyramidalOrigin, BioImager.ImageView.RenderFrame(), BioImager.ImageView.Resolution, BioImager.ImageView.Scale, BioImager.ImageView.SelectedIndex, BioImager.ImageView.ToScreenRectF(), BioImager.ImageView.ToViewH(), BioImager.ImageView.ToViewW(), and BioImager.ImageView.UpdateImages().

◆ GetCoordinate()

ZCT BioImager.ImageView.GetCoordinate ( )

It returns the coordinate of the selected image

Returns
The Coordinate property of the SelectedImage object.

Definition at line 276 of file ImageView.cs.

277 {
278 return SelectedImage.Coordinate;
279 }

Referenced by BioImager.SlideSourceBase.GetSlice(), BioImager.ImageView.PasteSelection(), BioImager.SlideImage.ReadRegion(), BioImager.Tools.ToolDown(), BioImager.Tools.ToolUp(), and BioImager.BioImage.UpdateBuffersPyramidal().

◆ 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 1672 of file ImageView.cs.

1673 {
1674 RangeTool t;
1675 if (Mode == ViewMode.Filtered)
1676 t = new RangeTool(timeEnabled, true, zBar.Minimum, zBar.Maximum, tBar.Minimum, tBar.Maximum, cBar.Minimum, cBar.Maximum);
1677 else
1678 t = new RangeTool(timeEnabled, false, zBar.Minimum, zBar.Maximum, tBar.Minimum, tBar.Maximum, cBar.Minimum, cBar.Maximum);
1679 if (t.ShowDialog() != DialogResult.OK)
1680 return;
1681 zBar.Minimum = t.ZMin;
1682 zBar.Maximum = t.ZMax;
1683 tBar.Minimum = t.TimeMin;
1684 tBar.Maximum = t.TimeMax;
1685 cBar.Minimum = t.CMin;
1686 cBar.Maximum = t.CMax;
1687 }

References BioImager.ImageView.Mode.

◆ GetScale()

double BioImager.ImageView.GetScale ( )

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

Returns
The scale of the image.

Definition at line 2317 of file ImageView.cs.

2318 {
2319 return ToViewSizeW(ROI.selectBoxSize / Scale.Width);
2320 }

References BioImager.ImageView.Scale.

Referenced by BioImager.Tools.ToolUp().

◆ 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 3261 of file ImageView.cs.

3262 {
3263 GoToImage(0);
3264 }

References BioImager.ImageView.GoToImage().

Referenced by BioImager.ImageView.AddImage(), BioImager.ImageView.GoToImage(), BioImager.ImageView.ImageView(), and BioImager.TabsView.ResizeView().

◆ 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 3289 of file ImageView.cs.

3290 {
3291 if (Images.Count <= i)
3292 return;
3293 if (SelectedImage.Type == BioImage.ImageType.pyramidal)
3294 {
3295 if (SelectedImage.openSlideBase != null)
3296 {
3297 if (MacroResolution.HasValue)
3298 {
3299 int lev = MacroResolution.Value - 2;
3300 Resolution = _openSlideBase.Schema.Resolutions[lev].UnitsPerPixel*0.98;
3301 }
3302 else
3303 {
3304 Resolution = _openSlideBase.Schema.Resolutions[0].UnitsPerPixel;
3305 }
3306 }
3307 else
3308 {
3309 if (MacroResolution.HasValue)
3310 {
3311 int lev = MacroResolution.Value-1;
3312 Resolution = SelectedImage.slideBase.Schema.Resolutions[lev].UnitsPerPixel*0.98;
3313 PyramidalOrigin = new PointD(0, 0);
3314 }
3315 else
3316 {
3317 Resolution = SelectedImage.GetUnitPerPixel(SelectedImage.Resolutions.Count - 1)*0.98;
3318 }
3319 }
3320 }
3321 double dx = Images[i].Volume.Width / 2;
3322 double dy = Images[i].Volume.Height / 2;
3323 Origin = new PointD(-(Images[i].Volume.Location.X + dx), -(Images[i].Volume.Location.Y + dy));
3324 double wx, wy;
3326 {
3327 wx = ViewWidth / ToScreenW(SelectedImage.Volume.Width);
3328 wy = ViewHeight / ToScreenH(SelectedImage.Volume.Height);
3329 }
3330 else
3331 {
3332 wx = ViewWidth / ToScreenScaleW(SelectedImage.Volume.Width);
3333 wy = ViewHeight / ToScreenScaleH(SelectedImage.Volume.Height);
3334 }
3335 Scale = new SizeF((float)wy, (float)wy);
3336 UpdateView();
3337 }
double GetUnitPerPixel(int level)
Get Unit Per Pixel for pyramidal images.
Definition: Bio.cs:2617
float ToScreenScaleH(double y)
Definition: ImageView.cs:3030
float ToScreenH(double y)
Definition: ImageView.cs:3187
float ToScreenW(double x)
Definition: ImageView.cs:3174
float ToScreenScaleW(double x)
Definition: ImageView.cs:3017

References BioImager.BioImage.GetUnitPerPixel(), BioImager.ImageView.HardwareAcceleration, BioImager.ImageView.Origin, BioImager.ImageView.PyramidalOrigin, BioImager.ImageView.Scale, BioImager.ImageView.ToScreenH(), BioImager.ImageView.ToScreenScaleH(), BioImager.ImageView.ToScreenScaleW(), BioImager.ImageView.ToScreenW(), and BioImager.ImageView.UpdateView().

◆ GoToStage()

void BioImager.ImageView.GoToStage ( )

Definition at line 3514 of file ImageView.cs.

3515 {
3516 RectangleD d = Microscope.GetViewRectangle(false);
3517 double dx = d.W / 2;
3518 double dy = d.H / 2;
3519 Origin = new PointD(-(d.X + dx), -(d.Y + dy));
3520 double wx, wy;
3522 {
3523 wx = Math.Abs(ViewWidth / ToScreenW(d.W));
3524 wy = Math.Abs(ViewHeight / ToScreenH(d.H));
3525 }
3526 else
3527 {
3528 wx = Math.Abs(ViewWidth / ToScreenScaleW(d.W));
3529 wy = Math.Abs(ViewHeight / ToScreenScaleH(d.H));
3530 }
3531 scale.Width = (float)wy;
3532 scale.Height = (float)wy;
3533 update = true;
3534 UpdateView();
3535 }

◆ 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 2842 of file ImageView.cs.

2843 {
2844 if(SelectedImage==null)
2845 return ToViewSpace(x, y);
2846 if (SelectedImage.isPyramidal)
2847 {
2848 return new PointD((PyramidalOrigin.X + x) * Resolution, (PyramidalOrigin.Y + y) * Resolution);
2849 }
2850 else
2851 return ToViewSpace(x, y);
2852 }
PointF ToViewSpace(PointF p)
Definition: ImageView.cs:2858

References BioImager.ImageView.PyramidalOrigin, and BioImager.ImageView.ToViewSpace().

◆ 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 3202 of file ImageView.cs.

3203 {
3204 double moveAmount = 5 * Scale.Width;
3205 Plugins.KeyDownEvent(sender,e);
3206 if (e.KeyCode == Keys.C && e.Control)
3207 {
3208 CopySelection();
3209 return;
3210 }
3211 if (e.KeyCode == Keys.V && e.Control)
3212 {
3214 return;
3215 }
3216 if (e.KeyCode == Keys.Subtract || e.KeyCode == Keys.NumPad7)
3217 {
3218 Scale = new SizeF(Scale.Width - 0.1f, Scale.Height - 0.1f);
3219 UpdateOverlay();
3220 }
3221 if (e.KeyCode == Keys.Add || e.KeyCode == Keys.NumPad9)
3222 {
3223 Scale = new SizeF(Scale.Width + 0.1f, Scale.Height + 0.1f);
3224 UpdateOverlay();
3225 }
3226 if (e.KeyCode == Keys.W || e.KeyCode == Keys.NumPad8)
3227 {
3228 Origin = new PointD(Origin.X, Origin.Y + moveAmount);
3229 UpdateView();
3230 }
3231 if (e.KeyCode == Keys.S || e.KeyCode == Keys.NumPad2)
3232 {
3233 Origin = new PointD(Origin.X, Origin.Y - moveAmount);
3234 UpdateView();
3235 }
3236 if (e.KeyCode == Keys.A || e.KeyCode == Keys.NumPad4)
3237 {
3238 Origin = new PointD(Origin.X + moveAmount, Origin.Y);
3239 UpdateView();
3240 }
3241 if (e.KeyCode == Keys.D || e.KeyCode == Keys.NumPad6)
3242 {
3243 Origin = new PointD(Origin.X - moveAmount, Origin.Y);
3244 UpdateView();
3245 }
3246 }
void CopySelection()
It takes the selected ROIs and copies them to the clipboard.
Definition: ImageView.cs:2728

References BioImager.ImageView.CopySelection(), BioImager.ImageView.Origin, BioImager.ImageView.PasteSelection(), BioImager.ImageView.Scale, BioImager.ImageView.UpdateOverlay(), and BioImager.ImageView.UpdateView().

◆ InitGUI()

void BioImager.ImageView.InitGUI ( )

It initializes the GUI

Returns
The image is being returned.

Definition at line 908 of file ImageView.cs.

909 {
910 if (SelectedImage == null)
911 return;
912 zBar.Maximum = SelectedImage.SizeZ - 1;
913 if (SelectedImage.Buffers[0].RGBChannelsCount == 3)
914 cBar.Maximum = 0;
915 else
916 cBar.Maximum = SelectedImage.SizeC - 1;
917 if (SelectedImage.SizeT > 1)
918 {
919 tBar.Maximum = SelectedImage.SizeT - 1;
920 timeEnabled = true;
921 }
922 else
923 {
924 tBar.Enabled = false;
925 timeEnabled = false;
926 tBar.Maximum = SelectedImage.SizeT - 1;
927 }
928 //rgbPictureBox.Image = image.plane.GetBitmap();
929 //we clear the channel comboboxes incase we have channels from previous loaded image.
930 channelBoxR.Items.Clear();
931 channelBoxG.Items.Clear();
932 channelBoxB.Items.Clear();
933
934 foreach (Channel ch in SelectedImage.Channels)
935 {
936 channelBoxR.Items.Add(ch);
937 channelBoxG.Items.Add(ch);
938 channelBoxB.Items.Add(ch);
939 }
940 if (SelectedImage.Channels.Count > 2)
941 {
942 channelBoxR.SelectedIndex = 0;
943 channelBoxG.SelectedIndex = 1;
944 channelBoxB.SelectedIndex = 2;
945 }
946 else
947 if (SelectedImage.Channels.Count == 2)
948 {
949 channelBoxR.SelectedIndex = 0;
950 channelBoxG.SelectedIndex = 1;
951 }
953 init = true;
954 }
void UpdateRGBChannels()
Definition: ImageView.cs:842

References BioImager.ImageView.UpdateRGBChannels().

Referenced by BioImager.ImageView.AddImage(), BioImager.ImageView.ImageView(), and BioImager.ImageView.UpdateImages().

◆ 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 3539 of file ImageView.cs.

3540 {
3541 if (SelectedImage == null)
3542 return;
3543 Microscope.Stage.SetPosition(SelectedImage.Volume.Location.X, SelectedImage.Volume.Location.Y);
3544 update = true;
3545 UpdateView();
3546 }

References BioImager.ImageView.UpdateView().

◆ 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 3550 of file ImageView.cs.

3551 {
3552 update = true;
3553 Microscope.Stage.SetPosition(Images[i].Volume.Location.X, Images[i].Volume.Location.Y);
3554 UpdateView();
3555 }

References BioImager.ImageView.UpdateView().

◆ 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 2744 of file ImageView.cs.

2745 {
2746 string[] sts = Clipboard.GetText().Split(BioImage.NewLine);
2747 foreach (string line in sts)
2748 {
2749 if (line.Length > 8)
2750 {
2751 ROI an = BioImage.StringToROI(line);
2752 //We set the coordinates of the ROI's we are pasting
2753 an.coord = GetCoordinate();
2754 SelectedImage.Annotations.Add(an);
2755 }
2756 }
2757 UpdateOverlay();
2758 }
static ROI StringToROI(string sts)
Definition: Bio.cs:7737

References BioImager.ImageView.GetCoordinate(), BioImager.BioImage.StringToROI(), and BioImager.ImageView.UpdateOverlay().

Referenced by BioImager.ImageView.ImageView_KeyDown().

◆ RemoveImage()

void BioImager.ImageView.RemoveImage ( int  i)

Definition at line 1376 of file ImageView.cs.

1377 {
1378 do
1379 {
1380 System.Threading.Thread.Sleep(50);
1381 Application.DoEvents();
1382 } while (drawing || updating);
1383 Images[i].Dispose();
1384 Images.RemoveAt(i);
1385 UpdateImages();
1386 }

◆ RemoveImages()

void BioImager.ImageView.RemoveImages ( )

Definition at line 1387 of file ImageView.cs.

1388 {
1389 do
1390 {
1391 Thread.Sleep(50);
1392 Application.DoEvents();
1393 } while (drawing || updating);
1394 for (int i = 0; i < Images.Count; i++)
1395 {
1396 Images[i].Dispose();
1397 }
1398 Images.Clear();
1399 UpdateImages();
1400 }

◆ RenderFrame()

void BioImager.ImageView.RenderFrame ( )

It draws the images and annotations to the screen

Returns
A Bitmap

Definition at line 1037 of file ImageView.cs.

1038 {
1039 drawing = true;
1040 if (HardwareAcceleration && dx != null)
1041 {
1042 Plugins.Render(this, dx);
1043 dx.BeginDraw();
1044 dx.RenderTarget2D.Clear(new RawColor4(1.0f, 1.0f, 1.0f, 1.0f));
1045 System.Drawing.RectangleF rg = ToScreenRectF(PointD.MinX, PointD.MinY, PointD.MaxX - PointD.MinX, PointD.MaxY - PointD.MinY);
1046 //dx.RenderTarget2D.Transform = SharpDX.Matrix3x2.Rotation((float)Math.PI);
1047 SharpDX.Direct2D1.SolidColorBrush pen = new SharpDX.Direct2D1.SolidColorBrush(dx.RenderTarget2D, new RawColor4(1.0f, 0.0f, 0.0f, 1.0f));
1048 SharpDX.Direct2D1.SolidColorBrush red = new SharpDX.Direct2D1.SolidColorBrush(dx.RenderTarget2D, new RawColor4(1.0f, 0.0f, 0.0f, 1.0f));
1049 SharpDX.Direct2D1.SolidColorBrush green = new SharpDX.Direct2D1.SolidColorBrush(dx.RenderTarget2D, new RawColor4(0.0f, 1.0f, 0.0f, 1.0f));
1050 SharpDX.Direct2D1.SolidColorBrush mag = new SharpDX.Direct2D1.SolidColorBrush(dx.RenderTarget2D, new RawColor4(1.0f, 0.0f, 1.0f, 1.0f));
1051 SharpDX.Direct2D1.SolidColorBrush blue = new SharpDX.Direct2D1.SolidColorBrush(dx.RenderTarget2D, new RawColor4(0.0f, 0.0f, 1.0f, 1.0f));
1052 SharpDX.Direct2D1.SolidColorBrush b = new SharpDX.Direct2D1.SolidColorBrush(dx.RenderTarget2D, new RawColor4(1.0f, 1.0f, 0.0f, 1.0f));
1053 SharpDX.Direct2D1.SolidColorBrush gray = new SharpDX.Direct2D1.SolidColorBrush(dx.RenderTarget2D, new RawColor4(0.5f, 0.5f, 0.5f, 1.0f));
1054
1055 dx.RenderTarget2D.FillRectangle(ToRawRectF(rg.X, rg.Y, rg.Width, rg.Height), gray);
1056 for (int x = 0; x < Images.Count; x++)
1057 {
1058 if (!IsLayerEnabled(Images[x].PhysicalSizeX) && !Images[x].isPyramidal)
1059 continue;
1060 if (dBitmaps == null)
1061 UpdateImages();
1062 if (dBitmaps.Count != Images.Count)
1063 UpdateImages();
1064 if (dBitmaps[x] == null)
1065 UpdateImages();
1066 System.Drawing.RectangleF r = ToScreenRectF(Images[x].Volume.Location.X, Images[x].Volume.Location.Y, Images[x].Volume.Width, Images[x].Volume.Height);
1067 double w = ToViewW(ViewWidth);
1068 double h = ToViewH(ViewHeight);
1069 RectangleF rge = new RectangleF((float)((-Origin.X) - (w / 2)), (float)((-Origin.Y) - (h / 2)), (float)(Math.Abs(w)), (float)(Math.Abs(h)));
1070 RectangleF rec = new RectangleF((float)Images[x].Volume.Location.X, (float)Images[x].Volume.Location.Y, (float)Images[x].Volume.Width, (float)Images[x].Volume.Height);
1071 //if (rge.IntersectsWith(rec))
1072 dx.RenderTarget2D.DrawBitmap(dBitmaps[x], ToRawRectF(r.X, r.Y, r.Width, r.Height), 1.0f, SharpDX.Direct2D1.BitmapInterpolationMode.Linear);
1073 if (x == selectedIndex)
1074 dx.RenderTarget2D.DrawRectangle(ToRawRectF(r.X, r.Y, r.Width, r.Height), blue);
1075 }
1076 bool bounds = showBounds;
1077 bool labels = showText;
1078 foreach (BioImage bi in Images)
1079 {
1080 if (!IsLayerEnabled(bi.PhysicalSizeX) && !bi.isPyramidal)
1081 continue;
1082 foreach (ROI an in bi.Annotations)
1083 {
1084 if (zBar.Value != an.coord.Z || cBar.Value != an.coord.C || tBar.Value != an.coord.T)
1085 continue;
1086 float w = Math.Abs(Scale.Width);
1087 Font fo = new Font(new FontFamily(an.family), (float)((an.strokeWidth / w) * an.fontSize));
1088 PointF pc = new PointF((float)(an.BoundingBox.X + (an.BoundingBox.W / 2)), (float)(an.BoundingBox.Y + (an.BoundingBox.H / 2)));
1089 float width = 1;
1090 dx.RenderTarget2D.StrokeWidth = width;
1091 if (an.type == ROI.Type.Point)
1092 {
1093 System.Drawing.PointF pf = ToScreenSpace(new PointF((float)an.Point.X + 1, (float)an.Point.Y + 1));
1094 dx.RenderTarget2D.DrawLine(new RawVector2((float)an.Point.X, (float)an.Point.Y), new RawVector2(pf.X, pf.Y), b);
1095 System.Drawing.RectangleF[] rfs = ToScreenSpace(an.GetSelectBoxes(Tools.selectBoxSize));
1096 for (int i = 0; i < rfs.Length; i++)
1097 {
1098 dx.RenderTarget2D.DrawRectangle(ToRawRectF(rfs[i].X, rfs[i].Y, rfs[i].Width, rfs[i].Height), red);
1099 }
1100 }
1101 else
1102 if (an.type == ROI.Type.Line)
1103 {
1104 PointD pf = ToScreenSpace(an.GetPoint(0));
1105 PointD pf2 = ToScreenSpace(an.GetPoint(1));
1106 dx.RenderTarget2D.DrawLine(new RawVector2((float)pf.X, (float)pf.Y), new RawVector2((float)pf2.X, (float)pf2.Y), b);
1107 System.Drawing.RectangleF[] rfs = ToScreenSpace(an.GetSelectBoxes(Tools.selectBoxSize));
1108 for (int i = 0; i < rfs.Length; i++)
1109 {
1110 dx.RenderTarget2D.DrawRectangle(ToRawRectF(rfs[i].X, rfs[i].Y, rfs[i].Width, rfs[i].Height), red);
1111 }
1112 }
1113 else
1114 if (an.type == ROI.Type.Rectangle && an.Rect.W > 0 && an.Rect.H > 0)
1115 {
1116 System.Drawing.RectangleF rec = ToScreenSpace(an.Rect);
1117 dx.RenderTarget2D.DrawRectangle(ToRawRectF(rec.X, rec.Y, rec.Width, rec.Height), red);
1118 System.Drawing.RectangleF[] rfs = ToScreenSpace(an.GetSelectBoxes(Tools.selectBoxSize));
1119 for (int i = 0; i < rfs.Length; i++)
1120 {
1121 dx.RenderTarget2D.DrawRectangle(ToRawRectF(rfs[i].X, rfs[i].Y, rfs[i].Width, rfs[i].Height), red);
1122 }
1123 }
1124 else
1125 if (an.type == ROI.Type.Ellipse)
1126 {
1127 System.Drawing.RectangleF r = ToScreenSpace(an.BoundingBox);
1128 System.Drawing.RectangleF[] rfs = ToScreenSpace(an.GetSelectBoxes(Tools.selectBoxSize));
1129 RawRectangleF rf = ToRawRectF(rfs[0].X, rfs[0].Y, rfs[0].Width, rfs[0].Height);
1130 SharpDX.Direct2D1.Ellipse e = new SharpDX.Direct2D1.Ellipse(new RawVector2(rf.Left + (Math.Abs(r.Width) / 2) - (rfs[0].Width / 2), rf.Top + (Math.Abs(r.Height) / 2) - (rfs[0].Height / 2)), -r.Width / 2, -r.Height / 2);
1131 dx.RenderTarget2D.DrawEllipse(e, b);
1132 for (int i = 0; i < rfs.Length; i++)
1133 {
1134 dx.RenderTarget2D.DrawRectangle(ToRawRectF(rfs[i].X, rfs[i].Y, rfs[i].Width, rfs[i].Height), red);
1135 }
1136 }
1137 else
1138 if (an.type == ROI.Type.Polygon && an.closed)
1139 {
1140 RawVector2 pf;
1141 RawVector2 pf2;
1142 for (int i = 0; i < an.PointsD.Count - 1; i++)
1143 {
1144 pf = new RawVector2((float)ToScreenSpace(an.GetPoint(i).X, an.GetPoint(i).Y).X, (float)ToScreenSpace(an.GetPoint(i).X, an.GetPoint(i).Y).Y);
1145 pf2 = new RawVector2((float)ToScreenSpace(an.GetPoint(i + 1).X, an.GetPoint(i + 1).Y).X, (float)ToScreenSpace(an.GetPoint(i + 1).X, an.GetPoint(i + 1).Y).Y);
1146 dx.RenderTarget2D.DrawLine(pf, pf2, b);
1147 }
1148 pf = new RawVector2((float)ToScreenSpace(an.GetPoint(0)).X, (float)ToScreenSpace(an.GetPoint(0)).Y);
1149 pf2 = new RawVector2((float)ToScreenSpace(an.GetPoint(an.PointsD.Count - 1)).X, (float)ToScreenSpace(an.GetPoint(an.PointsD.Count - 1)).Y);
1150 dx.RenderTarget2D.DrawLine(pf, pf2, b);
1151
1152 System.Drawing.RectangleF[] rfs = ToScreenSpace(an.GetSelectBoxes(Tools.selectBoxSize));
1153 for (int i = 0; i < rfs.Length; i++)
1154 {
1155 dx.RenderTarget2D.DrawRectangle(ToRawRectF(rfs[i].X, rfs[i].Y, rfs[i].Width, rfs[i].Height), red);
1156 }
1157 }
1158 else
1159 if (an.type == ROI.Type.Polygon && !an.closed || an.type == ROI.Type.Polyline)
1160 {
1161 RawVector2 pf;
1162 RawVector2 pf2;
1163 for (int i = 0; i < an.PointsD.Count - 1; i++)
1164 {
1165 pf = new RawVector2((float)ToScreenSpace(an.GetPoint(i).X, an.GetPoint(i).Y).X, (float)ToScreenSpace(an.GetPoint(i).X, an.GetPoint(i).Y).Y);
1166 pf2 = new RawVector2((float)ToScreenSpace(an.GetPoint(i + 1).X, an.GetPoint(i + 1).Y).X, (float)ToScreenSpace(an.GetPoint(i + 1).X, an.GetPoint(i + 1).Y).Y);
1167 dx.RenderTarget2D.DrawLine(pf, pf2, b);
1168 dx.RenderTarget2D.DrawLine(pf, pf2, b);
1169 }
1170
1171 System.Drawing.RectangleF[] rfs = ToScreenSpace(an.GetSelectBoxes(Tools.selectBoxSize));
1172 for (int i = 0; i < rfs.Length; i++)
1173 {
1174 dx.RenderTarget2D.DrawRectangle(ToRawRectF(rfs[i].X, rfs[i].Y, rfs[i].Width, rfs[i].Height), red);
1175 }
1176
1177 }
1178 else
1179 if (an.type == ROI.Type.Freeform && an.closed)
1180 {
1181 RawVector2 pf;
1182 RawVector2 pf2;
1183 for (int i = 0; i < an.PointsD.Count - 1; i++)
1184 {
1185 pf = new RawVector2((float)ToScreenSpace(an.GetPoint(i).X, an.GetPoint(i).Y).X, (float)ToScreenSpace(an.GetPoint(i).X, an.GetPoint(i).Y).Y);
1186 pf2 = new RawVector2((float)ToScreenSpace(an.GetPoint(i + 1).X, an.GetPoint(i + 1).Y).X, (float)ToScreenSpace(an.GetPoint(i + 1).X, an.GetPoint(i + 1).Y).Y);
1187 dx.RenderTarget2D.DrawLine(pf, pf2, b);
1188 dx.RenderTarget2D.DrawLine(pf, pf2, b);
1189 }
1190 pf = new RawVector2((float)ToScreenSpace(an.GetPoint(0)).X, (float)ToScreenSpace(an.GetPoint(0)).Y);
1191 pf2 = new RawVector2((float)ToScreenSpace(an.GetPoint(an.PointsD.Count - 1)).X, (float)ToScreenSpace(an.GetPoint(an.PointsD.Count - 1)).Y);
1192 dx.RenderTarget2D.DrawLine(pf, pf2, b);
1193 }
1194 if (an.type == ROI.Type.Label)
1195 {
1196 System.Drawing.RectangleF rec = ToScreenSpace(an.Rect);
1197 RawRectangleF r = ToRawRectF(rec.X, rec.Y, rec.Width, rec.Height);
1198 SharpDX.DirectWrite.TextFormat tex = new SharpDX.DirectWrite.TextFormat(dx.FactoryDWrite, an.family.ToString(), an.fontSize);
1199 dx.RenderTarget2D.DrawText(an.Text, tex, r, b);
1200 tex.Dispose();
1201 System.Drawing.RectangleF[] rfs = ToScreenSpace(an.GetSelectBoxes(Tools.selectBoxSize));
1202 for (int i = 0; i < rfs.Length; i++)
1203 {
1204 dx.RenderTarget2D.DrawRectangle(ToRawRectF(rfs[i].X, rfs[i].Y, rfs[i].Width, rfs[i].Height), red);
1205 }
1206 }
1207 if (labels)
1208 {
1209 if (an.Text != null)
1210 {
1211 System.Drawing.Size s = TextRenderer.MeasureText(an.Text, new Font(an.family, an.fontSize));
1212 //Lets draw the text of this ROI in the middle of the ROI.
1213 float fw = ((float)an.Rect.X + ((float)an.Rect.W / 2)) - ((float)s.Width / 2);
1214 float fh = ((float)an.Rect.Y + ((float)an.Rect.H / 2)) - ((float)s.Height / 2);
1215 RawRectangleF r = ToRawRectF(fw, fh, s.Width, s.Height);
1216 SharpDX.DirectWrite.TextFormat tex = new SharpDX.DirectWrite.TextFormat(dx.FactoryDWrite, an.family.ToString(), an.fontSize);
1217 dx.RenderTarget2D.DrawText(an.Text, tex, r, b);
1218 tex.Dispose();
1219 }
1220 }
1221 if (bounds)
1222 {
1223 System.Drawing.RectangleF r = ToScreenSpace(an.Rect);
1224 dx.RenderTarget2D.DrawRectangle(ToRawRectF(r.X, r.Y, r.Width, r.Height), green);
1225 }
1226 if (an.selected)
1227 {
1228 //Lets draw the selected bounding box.
1229 System.Drawing.RectangleF r = ToScreenSpace(an.Rect);
1230 dx.RenderTarget2D.DrawRectangle(ToRawRectF(r.X, r.Y, r.Width, r.Height), mag);
1231
1232 //Lets draw the selectBoxes.
1233 List<RectangleD> rects = new List<RectangleD>();
1234 RectangleD[] sels = an.GetSelectBoxes(Tools.selectBoxSize);
1235 for (int i = 0; i < an.selectedPoints.Count; i++)
1236 {
1237 if (an.selectedPoints[i] < an.GetPointCount())
1238 {
1239 rects.Add(sels[an.selectedPoints[i]]);
1240 }
1241 }
1242 if (rects.Count > 0)
1243 {
1244 for (int i = 0; i < rects.Count; i++)
1245 {
1246 System.Drawing.RectangleF ri = ToScreenSpace(rects[i]);
1247 dx.RenderTarget2D.DrawRectangle(ToRawRectF(ri.X, ri.Y, ri.Width, ri.Height), blue);
1248 }
1249 }
1250 rects.Clear();
1251 }
1252
1253 }
1254 }
1255 if (ShowStage)
1256 {
1257 AForge.RectangleD re = Microscope.GetViewRectangle(false);
1258 System.Drawing.RectangleF vr = ToScreenRectF(re.X, re.Y, re.W, re.H);
1259 RawRectangleF rr = ToRawRectF(vr.X, vr.Y, vr.Width, vr.Height);
1260 dx.RenderTarget2D.DrawRectangle(rr, red);
1261 }
1262 pen.Dispose();
1263 red.Dispose();
1264 mag.Dispose();
1265 green.Dispose();
1266 blue.Dispose();
1267 gray.Dispose();
1268 b.Dispose();
1269 dx.EndDraw();
1270 }
1271 drawing = false;
1272 }
PointD ToScreenSpace(double x, double y)
Definition: ImageView.cs:2956
RawRectangleF ToRawRectF(double x, double y, double w, double h)
Definition: ImageView.cs:3102

References BioImager.ROI.GetPoint(), BioImager.ROI.GetPointCount(), BioImager.ROI.GetSelectBoxes(), BioImager.ImageView.HardwareAcceleration, BioImager.ImageView.Origin, BioImager.ImageView.Scale, BioImager.ImageView.ToRawRectF(), BioImager.ImageView.ToScreenRectF(), BioImager.ImageView.ToScreenSpace(), BioImager.ImageView.ToViewH(), BioImager.ImageView.ToViewW(), and BioImager.ImageView.UpdateImages().

Referenced by BioImager.ImageView.DrawView(), BioImager.ImageView.UpdateOverlay(), and BioImager.ImageView.UpdateView().

◆ SetCoordinate()

void BioImager.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 253 of file ImageView.cs.

254 {
255 System.Threading.Tasks.Task.Run(() =>
256 {
257 App.viewer.Invoke((MethodInvoker)delegate
258 {
259 if (SelectedImage == null)
260 return;
261 if (z >= SelectedImage.SizeZ)
262 zBar.Value = zBar.Maximum;
263 if (c >= SelectedImage.SizeC)
264 cBar.Value = cBar.Maximum;
265 if (t >= SelectedImage.SizeT)
266 tBar.Value = tBar.Maximum;
267 zBar.Value = z;
268 cBar.Value = c;
269 tBar.Value = t;
270 });
271 });
272 }

Referenced by BioImager.ImageView.ImageView().

◆ ToRawRectF()

RawRectangleF BioImager.ImageView.ToRawRectF ( 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 RawRectangleF object.

Definition at line 3102 of file ImageView.cs.

3103 {
3104 double xd = dxPanel.Width / 2;
3105 double yd = dxPanel.Height / 2;
3106 return new RawRectangleF((float)(xd - x), (float)(yd - y), (float)(xd - (x + w)), (float)(yd - (y + h)));
3107 }

Referenced by BioImager.ImageView.RenderFrame(), and BioImager.ImageView.ToScreenSpace().

◆ 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 3187 of file ImageView.cs.

3188 {
3190 {
3191 return (float)(y * PxHmicron);
3192 }
3193 return (float)(y * PxHmicron);
3194 }
double PxHmicron
Only used when opening stacks.
Definition: ImageView.cs:477

References BioImager.ImageView.HardwareAcceleration, and BioImager.ImageView.PxHmicron.

Referenced by BioImager.ImageView.GoToImage().

◆ ToScreenRectF()

System.Drawing.RectangleF BioImager.ImageView.ToScreenRectF ( 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 3057 of file ImageView.cs.

3058 {
3059 if (SelectedImage == null)
3060 {
3061 PointD pf;
3063 {
3064 double dx = (pxWmicron * (-Origin.X)) * Scale.Width;
3065 double dy = (pxHmicron * (-Origin.Y)) * Scale.Height;
3066 System.Drawing.RectangleF rf = new System.Drawing.RectangleF((float)(PxWmicron * -x * Scale.Width + dx), (float)(PxHmicron * -y * Scale.Height + dy), (float)(PxWmicron * -w * Scale.Width), (float)(PxHmicron * -h * Scale.Height));
3067 return rf;
3068 }
3069 pf = ToScreenSpace(x, y);
3070 return new System.Drawing.RectangleF((float)pf.X, (float)pf.Y, ToScreenScaleW(w), ToScreenScaleH(h));
3071 }
3072 if (SelectedImage.isPyramidal)
3073 {
3074 PointD d = ToViewSpace(x, y);
3075 double dw = ToViewSizeW(w);
3076 double dh = ToViewSizeH(h);
3077 return new System.Drawing.RectangleF((float)(d.X - PyramidalOrigin.X), (float)(d.Y - PyramidalOrigin.Y), (float)dw, (float)dh);
3078 }
3079 else
3080 {
3081 PointD pf;
3083 {
3084 double dx = (pxWmicron * (-Origin.X)) * Scale.Width;
3085 double dy = (pxHmicron * (-Origin.Y)) * Scale.Height;
3086 System.Drawing.RectangleF rf = new System.Drawing.RectangleF((float)(PxWmicron * -x * Scale.Width + dx), (float)(PxHmicron * -y * Scale.Height + dy), (float)(PxWmicron * -w * Scale.Width), (float)(PxHmicron * -h * Scale.Height));
3087 return rf;
3088 }
3089 pf = ToScreenSpace(x, y);
3090 return new System.Drawing.RectangleF((float)pf.X, (float)pf.Y, ToScreenScaleW(w), ToScreenScaleH(h));
3091 }
3092 }
double PxWmicron
Only used when opening stacks.
Definition: ImageView.cs:463
double ToViewSizeH(double d)
Definition: ImageView.cs:2920

References BioImager.ImageView.HardwareAcceleration, BioImager.ImageView.Origin, BioImager.ImageView.PxHmicron, BioImager.ImageView.PxWmicron, BioImager.ImageView.PyramidalOrigin, BioImager.ImageView.Scale, BioImager.ImageView.ToScreenScaleH(), BioImager.ImageView.ToScreenScaleW(), BioImager.ImageView.ToScreenSpace(), BioImager.ImageView.ToViewSizeH(), and BioImager.ImageView.ToViewSpace().

Referenced by BioImager.ImageView.DrawView(), BioImager.ImageView.RenderFrame(), and BioImager.ImageView.ToScreenSpace().

◆ 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 3043 of file ImageView.cs.

3044 {
3045 float x = ToScreenScaleW((float)p.X);
3046 float y = ToScreenScaleH((float)p.Y);
3047 return new PointF(x, y);
3048 }

References BioImager.ImageView.ToScreenScaleH(), and BioImager.ImageView.ToScreenScaleW().

◆ 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 3030 of file ImageView.cs.

3031 {
3033 {
3034 return (float)(-y * PxHmicron * Scale.Height);
3035 }
3036 return (float)(y * PxHmicron);
3037 }

References BioImager.ImageView.HardwareAcceleration, BioImager.ImageView.PxHmicron, and BioImager.ImageView.Scale.

Referenced by BioImager.ImageView.GoToImage(), BioImager.ImageView.ToScreenRectF(), BioImager.ImageView.ToScreenScale(), and BioImager.ImageView.ToScreenSpace().

◆ 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 3017 of file ImageView.cs.

3018 {
3020 {
3021 return (float)(-x * PxWmicron * Scale.Width);
3022 }
3023 return (float)(x * PxWmicron);
3024 }

References BioImager.ImageView.HardwareAcceleration, BioImager.ImageView.PxWmicron, and BioImager.ImageView.Scale.

Referenced by BioImager.ImageView.GoToImage(), BioImager.ImageView.ToScreenRectF(), BioImager.ImageView.ToScreenScale(), and BioImager.ImageView.ToScreenSpace().

◆ 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 2956 of file ImageView.cs.

2957 {
2959 {
2960 System.Drawing.RectangleF f = ToScreenRectF(x, y, 1, 1);
2961 RawRectangleF rf = ToRawRectF(f.X, f.Y, f.Width, f.Height);
2962 return new PointD(rf.Left, rf.Top);
2963 }
2964
2965 double fx = ToScreenScaleW(Origin.X + x);
2966 double fy = ToScreenScaleH(Origin.Y + y);
2967 return new PointD(fx, fy);
2968 }

References BioImager.ImageView.HardwareAcceleration, BioImager.ImageView.Origin, BioImager.ImageView.ToRawRectF(), BioImager.ImageView.ToScreenRectF(), BioImager.ImageView.ToScreenScaleH(), and BioImager.ImageView.ToScreenScaleW().

Referenced by BioImager.ImageView.RenderFrame(), BioImager.ImageView.ToScreenRectF(), and BioImager.ImageView.ToScreenSpace().

◆ 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 3007 of file ImageView.cs.

3008 {
3009 PointD pd = ToScreenSpace(p.X, p.Y);
3010 return new PointF((float)pd.X, (float)pd.Y);
3011 }

References BioImager.ImageView.ToScreenSpace().

◆ 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 2974 of file ImageView.cs.

2975 {
2976 return ToScreenSpace(p.X, p.Y);
2977 }

References BioImager.ImageView.ToScreenSpace().

◆ 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 3159 of file ImageView.cs.

3160 {
3161 PointF[] rs = new PointF[p.Length];
3162 for (int i = 0; i < p.Length; i++)
3163 {
3164 PointD pd = ToScreenSpace(p[i]);
3165 rs[i] = new PointF((float)pd.X, (float)pd.Y);
3166 }
3167 return rs;
3168 }

References BioImager.ImageView.ToScreenSpace().

◆ ToScreenSpace() [5/10]

System.Drawing.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 2983 of file ImageView.cs.

2984 {
2985 PointD pd = ToScreenSpace(p.X, p.Y);
2986 return new System.Drawing.PointF((float)pd.X, (float)pd.Y);
2987 }

References BioImager.ImageView.ToScreenSpace().

◆ ToScreenSpace() [6/10]

System.Drawing.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 2993 of file ImageView.cs.

2994 {
2995 System.Drawing.PointF[] pf = new System.Drawing.PointF[p.Length];
2996 for (int i = 0; i < p.Length; i++)
2997 {
2998 pf[i] = ToScreenSpace(p[i]);
2999 }
3000 return pf;
3001 }

References BioImager.ImageView.ToScreenSpace().

◆ ToScreenSpace() [7/10]

System.Drawing.RectangleF 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 3113 of file ImageView.cs.

3114 {
3115 return ToScreenRectF(p.X, p.Y, p.W, p.H);
3116 }

References BioImager.ImageView.ToScreenRectF().

◆ ToScreenSpace() [8/10]

System.Drawing.RectangleF[] 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 3131 of file ImageView.cs.

3132 {
3133 System.Drawing.RectangleF[] rs = new System.Drawing.RectangleF[p.Length];
3134 for (int i = 0; i < p.Length; i++)
3135 {
3136 rs[i] = ToScreenSpace(p[i]);
3137 }
3138 return rs;
3139 }

References BioImager.ImageView.ToScreenSpace().

◆ ToScreenSpace() [9/10]

System.Drawing.RectangleF 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 3122 of file ImageView.cs.

3123 {
3124 return ToScreenRectF(p.X, p.Y, p.Width, p.Height);
3125 }

References BioImager.ImageView.ToScreenRectF().

◆ ToScreenSpace() [10/10]

System.Drawing.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 3145 of file ImageView.cs.

3146 {
3147 System.Drawing.RectangleF[] rs = new System.Drawing.RectangleF[p.Length];
3148 for (int i = 0; i < p.Length; i++)
3149 {
3150 rs[i] = ToScreenSpace(p[i]);
3151 }
3152 return rs;
3153 }

References BioImager.ImageView.ToScreenSpace().

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

3175 {
3177 {
3178 return (float)(x * PxWmicron);
3179 }
3180 return (float)(x * PxWmicron);
3181 }

References BioImager.ImageView.HardwareAcceleration, and BioImager.ImageView.PxWmicron.

Referenced by BioImager.ImageView.GoToImage().

◆ 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 2945 of file ImageView.cs.

2946 {
2947 double y = (double)(d / PxHmicron) / scale.Height;
2948 return y;
2949 }

References BioImager.ImageView.PxHmicron.

Referenced by BioImager.ImageView.DrawView(), and BioImager.ImageView.RenderFrame().

◆ 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 2920 of file ImageView.cs.

2921 {
2922 if (SelectedImage != null)
2923 if (SelectedImage.isPyramidal)
2924 {
2925 return d / Resolution;
2926 }
2927 double y = (double)(d / PxHmicron);
2928 return y;
2929 }

References BioImager.ImageView.PxHmicron, and BioImager.ImageView.Resolution.

Referenced by BioImager.ImageView.ToScreenRectF(), and BioImager.ImageView.ToViewSpace().

◆ 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 2878 of file ImageView.cs.

2879 {
2880 if(SelectedImage!=null)
2881 if (SelectedImage.isPyramidal)
2882 {
2883 double ddx = x / Resolution;
2884 double ddy = y / Resolution;
2885 return new PointD(ddx, ddy);
2886 }
2887 double dx, dy;
2889 {
2890 dx = (ToViewSizeW(x - (dxPanel.Width / 2)) / Scale.Width) - Origin.X;
2891 dy = (ToViewSizeH(y - (dxPanel.Height / 2)) / Scale.Height) - Origin.Y;
2892 }
2893 else
2894 {
2895 dx = (ToViewSizeW(x - (ViewWidth / 2)) / Scale.Width) - Origin.X;
2896 dy = (ToViewSizeH(y - (ViewHeight / 2)) / Scale.Height) - Origin.Y;
2897 }
2898 return new PointD(dx, dy);
2899 }

References BioImager.ImageView.HardwareAcceleration, BioImager.ImageView.Origin, BioImager.ImageView.Resolution, BioImager.ImageView.Scale, and BioImager.ImageView.ToViewSizeH().

◆ 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 2868 of file ImageView.cs.

2869 {
2870 return ToViewSpace(p.X, p.Y); ;
2871 }

References BioImager.ImageView.ToViewSpace().

◆ 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 2858 of file ImageView.cs.

2859 {
2860 PointD d = ToViewSpace(p.X, p.Y);
2861 return new PointF((float)d.X, (float)d.Y);
2862 }

References BioImager.ImageView.ToViewSpace().

Referenced by BioImager.ImageView.ImageToViewSpace(), BioImager.ImageView.ToScreenRectF(), and BioImager.ImageView.ToViewSpace().

◆ 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 2935 of file ImageView.cs.

2936 {
2937 double x = (double)(d / PxWmicron) / scale.Width;
2938 return x;
2939 }

References BioImager.ImageView.PxWmicron.

Referenced by BioImager.ImageView.DrawView(), and BioImager.ImageView.RenderFrame().

◆ 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 1405 of file ImageView.cs.

1406 {
1407 UpdateImages();
1408 }

References BioImager.ImageView.UpdateImages().

Referenced by BioImager.ImageJ.RunOnImage().

◆ UpdateImages()

void BioImager.ImageView.UpdateImages ( )

It takes a list of images, and for each image, it gets the image at the current Z, C, T coordinates, and then converts it to a bitmap

Returns
A Bitmap

Definition at line 1295 of file ImageView.cs.

1296 {
1297 if (SelectedImage == null)
1298 {
1299 if (Images.Count > 0)
1300 SelectedIndex = 0;
1301 else
1302 return;
1303 }
1304 for (int i = 0; i < Bitmaps.Count; i++)
1305 {
1306 Bitmaps[i] = null;
1307 }
1308 Bitmaps.Clear();
1309 if (zBar.Maximum != SelectedImage.SizeZ - 1 || tBar.Maximum != SelectedImage.SizeT - 1)
1310 {
1311 InitGUI();
1312 }
1313
1314 for (int i = 0; i < Images.Count; i++)
1315 {
1316 if (dBitmaps != null)
1317 {
1318 if (dBitmaps.Count > i)
1319 if (dBitmaps[i] != null)
1320 {
1321 dBitmaps[i].Dispose();
1322 dBitmaps[i] = null;
1323 }
1324 }
1325 }
1326 dBitmaps = new List<SharpDX.Direct2D1.Bitmap>();
1327
1328 int bi = 0;
1329 foreach (BioImage b in Images)
1330 {
1331 b.PyramidalOrigin = PyramidalOrigin;
1332 b.PyramidalSize = new AForge.Size(dxPanel.Width, dxPanel.Height);
1333 b.UpdateBuffersPyramidal();
1334 ZCT coords = new ZCT(zBar.Value, cBar.Value, tBar.Value);
1335 Bitmap bitmap = null;
1336
1337 int index = b.Coords[zBar.Value, cBar.Value, tBar.Value];
1338 if (Mode == ViewMode.Filtered)
1339 {
1340 bitmap = b.GetFiltered(coords, b.RChannel.RangeR, b.GChannel.RangeG, b.BChannel.RangeB);
1341 }
1342 else if (Mode == ViewMode.RGBImage)
1343 {
1344 bitmap = b.GetRGBBitmap(coords, b.RChannel.RangeR, b.GChannel.RangeG, b.BChannel.RangeB);
1345 }
1346 else if (Mode == ViewMode.Raw)
1347 {
1348 bitmap = (Bitmap)b.Buffers[index].ImageRGB;
1349 }
1350 else
1351 {
1352 bitmap = b.GetEmission(coords, b.RChannel.RangeR, b.GChannel.RangeG, b.BChannel.RangeB);
1353 }
1354 if (bitmap != null)
1355 if (bitmap.PixelFormat == PixelFormat.Format16bppGrayScale || bitmap.PixelFormat == PixelFormat.Format48bppRgb)
1356 bitmap = AForge.Imaging.Image.Convert16bppTo8bpp((Bitmap)bitmap);
1357
1358 if (HardwareAcceleration && dx != null)
1359 {
1360 if(dBitmaps.Count>bi)
1361 if (dBitmaps[bi] != null)
1362 {
1363 dBitmaps[bi].Dispose();
1364 dBitmaps[bi] = null;
1365 }
1366 Bitmap bf = new Bitmap("", bitmap, new ZCT(), 0);
1367 dBitmaps.Add(DBitmap.FromImage(dx.RenderTarget2D, (bf)));
1368 }
1369 else
1370 Bitmaps.Add(bitmap);
1371 bi++;
1372 }
1373 update = true;
1374 }

References BioImager.DBitmap.FromImage(), BioImager.BioImage.GetEmission(), BioImager.BioImage.GetFiltered(), BioImager.BioImage.GetRGBBitmap(), BioImager.ImageView.HardwareAcceleration, BioImager.ImageView.InitGUI(), BioImager.ImageView.Mode, BioImager.ImageView.PyramidalOrigin, BioImager.ImageView.SelectedIndex, and BioImager.BioImage.UpdateBuffersPyramidal().

Referenced by BioImager.ImageView.AddImage(), BioImager.ImageView.DrawView(), BioImager.ImageView.ImageView(), BioImager.ImageView.RenderFrame(), BioImager.BioImage.To16Bit(), BioImager.BioImage.To24Bit(), BioImager.BioImage.To32Bit(), BioImager.BioImage.To48Bit(), BioImager.BioImage.To8Bit(), BioImager.Tools.ToolUp(), and BioImager.ImageView.UpdateImage().

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

968 {
970 {
971 RenderFrame();
972 return;
973 }
974 updateOverlay = true;
975 overlayPictureBox.Invalidate();
976 }

References BioImager.ImageView.HardwareAcceleration, and BioImager.ImageView.RenderFrame().

Referenced by BioImager.ImageView.ImageView_KeyDown(), and BioImager.ImageView.PasteSelection().

◆ UpdateRGBChannels()

void BioImager.ImageView.UpdateRGBChannels ( )

"If the user has selected a channel, then set the channel to the selected index, otherwise set it to 0."

The above function is called when the user changes the channel selection

Definition at line 842 of file ImageView.cs.

843 {
844 //Buf = image.GetBufByCoord(GetCoordinate());
845 if (channelBoxR.SelectedIndex == -1)
846 SelectedImage.rgbChannels[0] = 0;
847 else
848 SelectedImage.rgbChannels[1] = channelBoxR.SelectedIndex;
849 if (channelBoxG.SelectedIndex == -1)
850 SelectedImage.rgbChannels[1] = 0;
851 else
852 SelectedImage.rgbChannels[1] = channelBoxG.SelectedIndex;
853 if (channelBoxB.SelectedIndex == -1)
854 SelectedImage.rgbChannels[2] = 0;
855 else
856 SelectedImage.rgbChannels[2] = channelBoxB.SelectedIndex;
857
858 }

Referenced by BioImager.ImageView.InitGUI().

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

960 {
961 ROI.selectBoxSize = size;
962 }

◆ UpdateStatus()

void BioImager.ImageView.UpdateStatus ( )

It updates the status bar of the image viewer

Returns
The statusLabel.Text is being returned.

Definition at line 980 of file ImageView.cs.

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

References BioImager.ImageView.Mode, and BioImager.ImageView.Resolution.

Referenced by BioImager.ImageView.UpdateView().

◆ UpdateView() [1/2]

void BioImager.ImageView.UpdateView ( )

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

Returns
The method is returning void.

Definition at line 1023 of file ImageView.cs.

1024 {
1025 UpdateStatus();
1027 {
1028 RenderFrame();
1029 return;
1030 }
1031 pictureBox.Invalidate();
1032 overlayPictureBox.Invalidate();
1033 }

References BioImager.ImageView.HardwareAcceleration, BioImager.ImageView.RenderFrame(), and BioImager.ImageView.UpdateStatus().

Referenced by BioImager.ImageView.GoToImage(), BioImager.ImageView.ImageView(), BioImager.ImageView.ImageView_KeyDown(), BioImager.ImageView.MoveStageToImage(), BioImager.ImageJ.RunOnImage(), BioImager.Stage.SetPosition(), BioImager.BioImage.To16Bit(), BioImager.BioImage.To24Bit(), BioImager.BioImage.To32Bit(), BioImager.BioImage.To48Bit(), and BioImager.BioImage.To8Bit().

◆ UpdateView() [2/2]

void BioImager.ImageView.UpdateView ( bool  refresh)

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

Parameters
refreshboolean

Definition at line 1276 of file ImageView.cs.

1277 {
1278 UpdateStatus();
1279 update = refresh;
1281 {
1282 RenderFrame();
1283 }
1284 if (update)
1285 {
1286 pictureBox.Invalidate();
1287 overlayPictureBox.Invalidate();
1288 }
1289 }

References BioImager.ImageView.HardwareAcceleration, BioImager.ImageView.RenderFrame(), and BioImager.ImageView.UpdateStatus().

Member Data Documentation

◆ Buf

Image BioImager.ImageView.Buf = null

Definition at line 207 of file ImageView.cs.

◆ down

bool BioImager.ImageView.down
static

Definition at line 190 of file ImageView.cs.

◆ dx

Direct2D BioImager.ImageView.dx = null

Definition at line 165 of file ImageView.cs.

◆ filepath

string BioImager.ImageView.filepath = ""

Definition at line 232 of file ImageView.cs.

◆ Images

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

Definition at line 211 of file ImageView.cs.

◆ init

bool BioImager.ImageView.init = false

Definition at line 208 of file ImageView.cs.

◆ loopC

bool BioImager.ImageView.loopC = true

Definition at line 238 of file ImageView.cs.

◆ loopT

bool BioImager.ImageView.loopT = true

Definition at line 237 of file ImageView.cs.

◆ loopZ

bool BioImager.ImageView.loopZ = true

Definition at line 236 of file ImageView.cs.

◆ minSizeX

int BioImager.ImageView.minSizeX = 50

Definition at line 234 of file ImageView.cs.

◆ minSizeY

int BioImager.ImageView.minSizeY = 20

Definition at line 235 of file ImageView.cs.

◆ mouseDown

PointD BioImager.ImageView.mouseDown
static

Definition at line 189 of file ImageView.cs.

◆ mouseDownButtons

MouseButtons BioImager.ImageView.mouseDownButtons
static

Definition at line 203 of file ImageView.cs.

◆ mouseUp

PointD BioImager.ImageView.mouseUp
static

Definition at line 191 of file ImageView.cs.

◆ mouseUpButtons

MouseButtons BioImager.ImageView.mouseUpButtons
static

Definition at line 202 of file ImageView.cs.

◆ selectedAnnotations

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

Definition at line 163 of file ImageView.cs.

◆ serie

int BioImager.ImageView.serie = 0

Definition at line 233 of file ImageView.cs.

◆ showBounds

bool BioImager.ImageView.showBounds = true
static

Definition at line 205 of file ImageView.cs.

◆ showBROIs

bool BioImager.ImageView.showBROIs = true

Definition at line 1934 of file ImageView.cs.

◆ showGROIs

bool BioImager.ImageView.showGROIs = true

Definition at line 1933 of file ImageView.cs.

◆ showRROIs

bool BioImager.ImageView.showRROIs = true

Definition at line 1932 of file ImageView.cs.

◆ showText

bool BioImager.ImageView.showText = true
static

Definition at line 206 of file ImageView.cs.

◆ up

bool BioImager.ImageView.up
static

Definition at line 192 of file ImageView.cs.

Property Documentation

◆ AnnotationsB

List<ROI> BioImager.ImageView.AnnotationsB
get

Definition at line 1953 of file ImageView.cs.

1954 {
1955 get
1956 {
1957 return SelectedImage.GetAnnotations(SelectedImage.Coordinate.Z, SelectedImage.BChannel.Index, SelectedImage.Coordinate.T);
1958 }
1959 }
List< ROI > GetAnnotations(ZCT coord)
Definition: Bio.cs:4436

◆ AnnotationsG

List<ROI> BioImager.ImageView.AnnotationsG
get

Definition at line 1945 of file ImageView.cs.

1946 {
1947 get
1948 {
1949 return SelectedImage.GetAnnotations(SelectedImage.Coordinate.Z, SelectedImage.GChannel.Index, SelectedImage.Coordinate.T);
1950 }
1951 }

◆ AnnotationsR

List<ROI> BioImager.ImageView.AnnotationsR
get

Definition at line 1937 of file ImageView.cs.

1938 {
1939 get
1940 {
1941 return SelectedImage.GetAnnotations(SelectedImage.Coordinate.Z, SelectedImage.RChannel.Index, SelectedImage.Coordinate.T);
1942 }
1943 }

◆ AnnotationsRGB

List<ROI> BioImager.ImageView.AnnotationsRGB
get

Definition at line 1960 of file ImageView.cs.

1961 {
1962 get
1963 {
1964 if (SelectedImage == null)
1965 return null;
1966 List<ROI> ans = new List<ROI>();
1967 if (Mode == ViewMode.RGBImage)
1968 {
1969 if (showRROIs)
1970 ans.AddRange(AnnotationsR);
1971 if (showGROIs)
1972 ans.AddRange(AnnotationsG);
1973 if (showBROIs)
1974 ans.AddRange(AnnotationsB);
1975 }
1976 else
1977 {
1978 ans.AddRange(SelectedImage.GetAnnotations(SelectedImage.Coordinate));
1979 }
1980 return ans;
1981 }
1982 }

◆ BChannel

Channel BioImager.ImageView.BChannel
get

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

Definition at line 606 of file ImageView.cs.

607 {
608 get
609 {
610 return SelectedImage.Channels[SelectedImage.rgbChannels[2]];
611 }
612 }

◆ CFps

int BioImager.ImageView.CFps
getset

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

Definition at line 892 of file ImageView.cs.

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

Referenced by BioImager.ImageView.ImageView().

◆ Ctrl

bool BioImager.ImageView.Ctrl
staticget

Definition at line 193 of file ImageView.cs.

194 {
195 get
196 {
197 return Win32.GetKeyState(Keys.LControlKey);
198 }
199 }

◆ GChannel

Channel BioImager.ImageView.GChannel
get

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

Definition at line 598 of file ImageView.cs.

599 {
600 get
601 {
602 return SelectedImage.Channels[SelectedImage.rgbChannels[1]];
603 }
604 }

◆ HardwareAcceleration

bool BioImager.ImageView.HardwareAcceleration
getset

Whether or not Hardware Acceleration should be used for rendering.

Definition at line 795 of file ImageView.cs.

796 {
797 get
798 {
799 if (Images.Count > 0)
800 if (Images[0].isPyramidal)
801 return false;
802 return hardwareAcceleration;
803 }
804 set
805 {
806 hardwareAcceleration = value;
807 if (value)
808 {
809 GoToImage(0);
810 cBar.Value = 0;
811 rgbBoxsPanel.SendToBack();
812 pictureBox.BringToFront();
813 cBar.BringToFront();
814 cLabel.BringToFront();
815 dxPanel.Visible = true;
816 dxPanel.BringToFront();
817 }
818 else
819 {
820 GoToImage(0);
821 rgbBoxsPanel.SendToBack();
822 cBar.BringToFront();
823 cLabel.BringToFront();
824 dxPanel.Visible = false;
825 pictureBox.BringToFront();
826 overlayPictureBox.BringToFront();
827 }
828 }
829 }

Referenced by BioImager.ImageView.DrawView(), BioImager.ImageView.GoToImage(), BioImager.ImageView.ImageView(), BioImager.ImageView.RenderFrame(), BioImager.Tools.ToolDown(), BioImager.Tools.ToolUp(), BioImager.ImageView.ToScreenH(), BioImager.ImageView.ToScreenRectF(), BioImager.ImageView.ToScreenScaleH(), BioImager.ImageView.ToScreenScaleW(), BioImager.ImageView.ToScreenSpace(), BioImager.ImageView.ToScreenW(), BioImager.ImageView.ToViewSpace(), BioImager.ImageView.UpdateImages(), BioImager.ImageView.UpdateOverlay(), and BioImager.ImageView.UpdateView().

◆ LabelResolution

int? BioImager.ImageView.LabelResolution
get

Definition at line 621 of file ImageView.cs.

621{ get { return SelectedImage.LabelResolution; } }

◆ Layers

List<Layer> BioImager.ImageView.Layers
getset

Definition at line 146 of file ImageView.cs.

147 {
148 get { return layers; }
149 set { layers = value; }
150 }

◆ Level

int BioImager.ImageView.Level
get

Current level when viewing whole-slide and pyramidal images.

Definition at line 757 of file ImageView.cs.

758 {
759 get
760 {
761 int l = 0;
762 if (!openSlide)
763 l = SelectedImage.Level;
764 else
765 l = OpenSlideGTK.TileUtil.GetLevel(_openSlideBase.Schema.Resolutions, Resolution);
766 return l;
767 }
768 }

Referenced by BioImager.ImageView.AddImage(), BioImager.ImageView.DrawView(), BioImager.ImageView.ImageView(), and BioImager.TabsView.ResizeView().

◆ MacroResolution

int? BioImager.ImageView.MacroResolution
get

Definition at line 620 of file ImageView.cs.

620{ get { return SelectedImage.MacroResolution; } }

◆ Mode

ViewMode BioImager.ImageView.Mode
getset

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

Definition at line 496 of file ImageView.cs.

497 {
498 get
499 {
500 return viewMode;
501 }
502 set
503 {
504 viewMode = value;
505 //If view mode is changed we update.
506 update = true;
507 UpdateImages();
508 App.tabsView.UpdateViewMode(viewMode);
509 UpdateView();
511 if (viewMode == ViewMode.RGBImage)
512 {
513 cBar.Value = 0;
514 rgbBoxsPanel.BringToFront();
515 cBar.SendToBack();
516 cLabel.SendToBack();
518 {
519 dxPanel.Visible = HardwareAcceleration;
520 dxPanel.BringToFront();
521 }
522 else
523 {
524 pictureBox.BringToFront();
525 overlayPictureBox.BringToFront();
526 }
527 }
528 else
529 if (viewMode == ViewMode.Filtered)
530 {
531 rgbBoxsPanel.SendToBack();
532 cBar.BringToFront();
533 cLabel.BringToFront();
535 {
536 dxPanel.Visible = HardwareAcceleration;
537 dxPanel.BringToFront();
538 }
539 else
540 {
541 pictureBox.BringToFront();
542 overlayPictureBox.BringToFront();
543 }
544 }
545 else
546 if (viewMode == ViewMode.Raw)
547 {
548 rgbBoxsPanel.SendToBack();
549 cBar.BringToFront();
550 cLabel.BringToFront();
552 {
553 dxPanel.Visible = HardwareAcceleration;
554 dxPanel.BringToFront();
555 }
556 else
557 {
558 pictureBox.BringToFront();
559 overlayPictureBox.BringToFront();
560 }
561 }
562 else
563 {
564 cBar.Value = 0;
565 rgbBoxsPanel.BringToFront();
566 cBar.SendToBack();
567 cLabel.SendToBack();
569 {
570 dxPanel.Visible = HardwareAcceleration;
571 dxPanel.BringToFront();
572 }
573 else
574 {
575 pictureBox.BringToFront();
576 overlayPictureBox.BringToFront();
577 }
578 }
579 }
580 }

Referenced by BioImager.ImageView.GetRange(), BioImager.ImageView.ImageView(), BioImager.ImageView.UpdateImages(), and BioImager.ImageView.UpdateStatus().

◆ MouseDownInt

PointD BioImager.ImageView.MouseDownInt
getset

Definition at line 3274 of file ImageView.cs.

3275 {
3276 get { return mouseDownInt; }
3277 set { mouseDownInt = value; }
3278 }

◆ MouseMoveInt

PointD BioImager.ImageView.MouseMoveInt
getset

Definition at line 3279 of file ImageView.cs.

3280 {
3281 get { return mouseMoveInt; }
3282 set { mouseMoveInt = value; }
3283 }

◆ OpenSlide

bool BioImager.ImageView.OpenSlide
get

Definition at line 616 of file ImageView.cs.

617 {
618 get { return openSlide; }
619 }

◆ Origin

PointD BioImager.ImageView.Origin
getset

A property of the class PointD. *‍/.

Definition at line 643 of file ImageView.cs.

644 {
645 get { return origin; }
646 set
647 {
648 origin = value;
649 update = true;
650 }
651 }

Referenced by BioImager.ImageView.DrawView(), BioImager.ImageView.GoToImage(), BioImager.ImageView.ImageView_KeyDown(), BioImager.ImageView.RenderFrame(), BioImager.ImageView.ToScreenRectF(), BioImager.ImageView.ToScreenSpace(), and BioImager.ImageView.ToViewSpace().

◆ Path

string BioImager.ImageView.Path
get

A property that returns the filepath. *‍/.

Definition at line 582 of file ImageView.cs.

583 {
584 get
585 {
586 return filepath;
587 }
588 }

◆ PxHmicron

double BioImager.ImageView.PxHmicron
getset

Only used when opening stacks.

Definition at line 476 of file ImageView.cs.

477 {
478 get
479 {
480 return pxHmicron;
481 }
482 set
483 {
484 pxHmicron = value;
485 }
486 }

Referenced by BioImager.ImageView.ToScreenH(), BioImager.ImageView.ToScreenRectF(), BioImager.ImageView.ToScreenScaleH(), BioImager.ImageView.ToViewH(), and BioImager.ImageView.ToViewSizeH().

◆ PxWmicron

double BioImager.ImageView.PxWmicron
getset

Only used when opening stacks.

Definition at line 462 of file ImageView.cs.

463 {
464 get
465 {
466 return pxWmicron;
467 }
468 set
469 {
470 pxWmicron = value;
471 }
472 }

Referenced by BioImager.ImageView.ToScreenRectF(), BioImager.ImageView.ToScreenScaleW(), BioImager.ImageView.ToScreenW(), and BioImager.ImageView.ToViewW().

◆ PyramidalOrigin

PointD BioImager.ImageView.PyramidalOrigin
getset

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

Definition at line 653 of file ImageView.cs.

654 {
655 get
656 {
657 return SelectedImage.PyramidalOrigin;
658 }
659 set
660 {
661 if (SelectedImage.Resolutions[Level].SizeX > value.X || SelectedImage.Resolutions[Level].SizeY > value.Y)
662 {
663 SelectedImage.PyramidalOrigin = value;
664 UpdateImages();
665 UpdateView();
666 }
667 }
668 }

Referenced by BioImager.ImageView.DrawView(), BioImager.ImageView.GoToImage(), BioImager.ImageView.ImageToViewSpace(), BioImager.BioImage.SaveOMESeries(), BioImager.ImageView.ToScreenRectF(), and BioImager.ImageView.UpdateImages().

◆ PyramidalOriginTransformed

PointD BioImager.ImageView.PyramidalOriginTransformed
getset

Definition at line 3265 of file ImageView.cs.

3266 {
3267 get { return new PointD(PyramidalOrigin.X * Resolution, PyramidalOrigin.Y * Resolution); }
3268 set { PyramidalOrigin = new PointD(value.X / Resolution, value.Y / Resolution); }
3269 }

◆ RChannel

Channel BioImager.ImageView.RChannel
get

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

Definition at line 590 of file ImageView.cs.

591 {
592 get
593 {
594 return SelectedImage.Channels[SelectedImage.rgbChannels[0]];
595 }
596 }

◆ 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 670 of file ImageView.cs.

671 {
672 get
673 {
674 return SelectedImage.Resolution;
675 }
676 set
677 {
678 double dp = Resolution / value;
679 SelectedImage.PyramidalOrigin = new PointD((dp * PyramidalOrigin.X), (dp * PyramidalOrigin.Y));
680 SelectedImage.Resolution = value;
681 if (SelectedImage.Type == BioImage.ImageType.well)
682 SelectedImage.Level = (int)value;
683 UpdateImage();
684 UpdateView();
685 UpdateScrollBars();
686 }
687 }

Referenced by BioImager.ImageView.DrawView(), BioImager.ImageView.ToViewSizeH(), BioImager.ImageView.ToViewSpace(), and BioImager.ImageView.UpdateStatus().

◆ Scale

new AForge.SizeF BioImager.ImageView.Scale
getset

Scale when opening image stacks.

Definition at line 772 of file ImageView.cs.

773 {
774 get
775 {
776 return scale;
777 }
778 set
779 {
780 scale = value;
781 update = true;
782 UpdateView();
783 if (SelectedImage != null)
784 if (SelectedImage.isPyramidal)
785 {
786 Tools.selectBoxSize = (float)(ROI.selectBoxSize * Resolution);
787 }
788 else
789 Tools.selectBoxSize = ROI.selectBoxSize;
790 }
791 }

Referenced by BioImager.ImageView.DrawView(), BioImager.ImageView.GetScale(), BioImager.ImageView.GoToImage(), BioImager.ImageView.ImageView_KeyDown(), BioImager.ImageView.RenderFrame(), BioImager.ImageView.ToScreenRectF(), BioImager.ImageView.ToScreenScaleH(), BioImager.ImageView.ToScreenScaleW(), and BioImager.ImageView.ToViewSpace().

◆ SelectedBuffer

Bitmap BioImager.ImageView.SelectedBuffer
staticget

Definition at line 181 of file ImageView.cs.

182 {
183 get
184 {
185 int ind = SelectedImage.Coords[SelectedImage.Coordinate.Z, SelectedImage.Coordinate.C, SelectedImage.Coordinate.T];
186 return SelectedImage.Buffers[ind];
187 }
188 }

◆ SelectedImage

BioImage BioImager.ImageView.SelectedImage
staticget

Definition at line 166 of file ImageView.cs.

167 {
168 get
169 {
170 if (App.viewer != null)
171 {
172 if (App.viewer.Images.Count > 0)
173 return App.viewer.Images[selectedIndex];
174 else
175 return null;
176 }
177 else
178 return null;
179 }
180 }

◆ SelectedIndex

int BioImager.ImageView.SelectedIndex
getset

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

Definition at line 215 of file ImageView.cs.

216 {
217 get
218 {
219 return selIndex;
220 }
221 set
222 {
223 if (value >= 0 && Images.Count > 0)
224 {
225 selIndex = value;
226 selectedIndex = selIndex;
227 InitGUI();
228 }
229 }
230 }

Referenced by BioImager.ImageView.AddImage(), BioImager.ImageView.DrawView(), BioImager.ImageJ.RunOnImage(), and BioImager.ImageView.UpdateImages().

◆ ShowControls

bool BioImager.ImageView.ShowControls
getset

Setting the visibility of the trackBarPanel. *‍/.

Definition at line 366 of file ImageView.cs.

367 {
368 get { return trackBarPanel.Visible; }
369 set
370 {
371 showControls = value;
372 if (!value)
373 {
374 trackBarPanel.Hide();
375 if (ShowStatus)
376 {
377 pictureBox.Top = 25;
378 overlayPictureBox.Top = 25;
379 dxPanel.Top = 25;
380 pictureBox.Height += 75;
381 overlayPictureBox.Height += 75;
382 dxPanel.Height += 75;
383 }
384 else
385 {
386 pictureBox.Top = 0;
387 overlayPictureBox.Top = 0;
388 dxPanel.Top = 0;
389 pictureBox.Height += 75;
390 overlayPictureBox.Height += 75;
391 dxPanel.Height += 75;
392 }
393 hideControlsToolStripMenuItem1.Text = "Show Controls";
394 }
395 else
396 {
397 trackBarPanel.Show();
398 if (ShowStatus)
399 {
400 pictureBox.Top = 25;
401 overlayPictureBox.Top = 25;
402 dxPanel.Top = 25;
403 pictureBox.Height -= 75;
404 overlayPictureBox.Height -= 75;
405 dxPanel.Height -= 75;
406 }
407 else
408 {
409 pictureBox.Top = 0;
410 overlayPictureBox.Top = 0;
411 dxPanel.Top = 0;
412 pictureBox.Height += 75;
413 overlayPictureBox.Height += 75;
414 dxPanel.Height += 75;
415 }
416
417 //panel.Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left;
418 hideControlsToolStripMenuItem1.Text = "Hide Controls";
419 }
420 UpdateView();
421 }
422 }
bool ShowStatus
Setting the value of the property ShowStatus. *‍/.
Definition: ImageView.cs:427

◆ ShowOverview

bool BioImager.ImageView.ShowOverview
getset

Definition at line 362 of file ImageView.cs.

362{ get; set; }

◆ ShowStage

bool BioImager.ImageView.ShowStage
getset

Definition at line 241 of file ImageView.cs.

241{ get; set; }

◆ ShowStatus

bool BioImager.ImageView.ShowStatus
getset

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

Definition at line 426 of file ImageView.cs.

427 {
428 get { return showStatus; }
429 set
430 {
431 showStatus = true;
432 if (!value)
433 {
434 statusPanel.Hide();
435 //panel.Top = 0;
436 pictureBox.Top = 0;
437 overlayPictureBox.Top = 0;
438 dxPanel.Top = 0;
439 //panel.Height += 25;
440 pictureBox.Height += 25;
441 overlayPictureBox.Height += 25;
442 dxPanel.Height += 25;
443
444 showControlsToolStripMenuItem.Visible = true;
445 hideControlsToolStripMenuItem.Text = "Show Status";
446 }
447 else
448 {
449 statusPanel.Show();
450 statusPanel.Visible = value;
451 pictureBox.Top = 25;
452 overlayPictureBox.Top = 25;
453 dxPanel.Top = 25;
454 showControlsToolStripMenuItem.Visible = false;
455 hideControlsToolStripMenuItem.Text = "Hide Status";
456 }
457 }
458 }

◆ TimeFps

int BioImager.ImageView.TimeFps
getset

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

Definition at line 877 of file ImageView.cs.

878 {
879 get
880 {
881 return timefps;
882 }
883 set
884 {
885 timefps = value;
886 float f = value;
887 timelineTimer.Interval = (int)Math.Floor(1000 / f);
888 }
889 }

Referenced by BioImager.ImageView.ImageView().

◆ tools

Tools BioImager.ImageView.tools
get

Definition at line 231 of file ImageView.cs.

231{ get { return App.tools; } }

◆ ViewContextMenu

ContextMenuStrip BioImager.ImageView.ViewContextMenu
get

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

Definition at line 831 of file ImageView.cs.

832 {
833 get
834 {
835 return contextMenuStrip;
836 }
837 }

Referenced by BioImager.App.GetContextItems(), and BioImager.App.GetContextMenuItemFromPath().

◆ ViewHeight

int BioImager.ImageView.ViewHeight
get

Definition at line 632 of file ImageView.cs.

633 {
634 get
635 {
637 return dxPanel.Height;
638 else
639 return pictureBox.Height;
640 }
641 }

◆ ViewWidth

int BioImager.ImageView.ViewWidth
get

Definition at line 622 of file ImageView.cs.

623 {
624 get
625 {
627 return dxPanel.Width;
628 else
629 return pictureBox.Width;
630 }
631 }

◆ ZFps

int BioImager.ImageView.ZFps
getset

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

Definition at line 862 of file ImageView.cs.

863 {
864 get
865 {
866 return zfps;
867 }
868 set
869 {
870 zfps = value;
871 float f = value;
872 zTimer.Interval = (int)Math.Floor(1000 / f);
873 }
874 }

Referenced by BioImager.ImageView.ImageView().


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