BioGTK  6.3.0
A .NET library & program for annotating, editing various microscopy imaging formats using Bioformats supported images. Including whole slide, pyramidal, and series.
Loading...
Searching...
No Matches
BioGTK.ImageView Class Reference
Inheritance diagram for BioGTK.ImageView:

Public Types

enum  ViewMode { Raw , Filtered , RGBImage , Emission }
 

Public Member Functions

void SetCoordinate (int z, int c, int t)
 
ZCT GetCoordinate ()
 
void AddImage (BioImage im)
 
void SetTitle (string s)
 
void UpdateImages (bool updatePyramidal=false)
 It updates the images.
 
void UpdateImage (bool updatePyramidal=false)
 It updates the image.
 
void UpdateGUI ()
 It updates the GUI to reflect the current state of the image.
 
void CopySelection ()
 It takes the selected ROIs and copies them to the clipboard.
 
void PasteSelection ()
 
void UpdateStatus ()
 It updates the status of the user.
 
void UpdateView (bool update=false, bool updateImages=false)
 It updates the view.
 
double GetScale ()
 
List< ROI > GetSelectedROIs ()
 
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)
 
RectangleD ToScreenSpace (RectangleD p)
 
RectangleD ToScreenSpace (RectangleF p)
 
RectangleD[] ToScreenSpace (RectangleD[] p)
 
PointD[] ToScreenSpace (PointD[] p)
 
double ToScreenW (double x)
 
float ToScreenH (double y)
 
void GoToImage ()
 This function is used to go to the image at the specified index.
 
void GoToImage (int i)
 

Static Public Member Functions

static ImageView Create (BioImage bm)
 
static SKImage Convert16bppBitmapToSKImage (Bitmap sourceBitmap)
 
static SKImage BitmapToSKImage (AForge.Bitmap bitm)
 
static Cairo.Color FromColor (Color color)
 

Public Attributes

List< BioImage > Images = new List<BioImage>()
 
List< SKImage > SKImages = new List<SKImage>()
 
List< Bitmap > Bitmaps = new List<Bitmap>()
 
Gtk.Box mainBox
 
Menu contextMenu
 
bool showRROIs = true
 
bool showGROIs = true
 
bool showBROIs = true
 

Static Public Attributes

static List< ROI > selectedAnnotations = new List<ROI>()
 
static int waitz = 1000
 
static int waitc = 1000
 
static int waitt = 1000
 
static int startz = 0
 
static int startc = 0
 
static int startt = 0
 
static int endz = 0
 
static int endc = 0
 
static int endt = 0
 
static Gdk.Key keyDown = Gdk.Key.Key_3270_Test
 
static bool x1State
 
static bool x2State
 
static bool mouseLeftState
 
static ModifierType Modifiers
 

Protected Member Functions

 ImageView (Builder builder, IntPtr handle, BioImage im)
 
void SetupHandlers ()
 Sets up the handlers.
 

Properties

double PxWmicron [get, set]
 
double PxHmicron [get, set]
 
bool AllowNavigation [get, set]
 
bool ShowMasks [get, set]
 
static AForge.Bitmap SelectedBuffer [get]
 
int SelectedIndex [get, set]
 
bool ShowOverview [get, set]
 
int? MacroResolution [get]
 
int? LabelResolution [get]
 
bool OpenSlide [get, set]
 
static BioImage SelectedImage [get, set]
 
ViewMode Mode [get, set]
 
Channel RChannel [get]
 
Channel GChannel [get]
 
Channel BChannel [get]
 
PointD Origin [get, set]
 
PointD TopRightOrigin [get]
 
PointD PyramidalOriginTransformed [get, set]
 
PointD PyramidalOrigin [get, set]
 
double Resolution [get, set]
 
int Level [get, set]
 
SizeF Scale [get, set]
 
PointD MouseDownInt [get, set]
 
PointD MouseMoveInt [get, set]
 
PointD MouseUpInt [get, set]
 
PointD MouseDown [get, set]
 
PointD MouseUp [get, set]
 
PointD MouseMove [get, set]
 

Detailed Description

Definition at line 24 of file ImageView.cs.

Member Enumeration Documentation

◆ ViewMode

enum BioGTK.ImageView.ViewMode

Definition at line 1794 of file ImageView.cs.

1795 {
1796 Raw,
1797 Filtered,
1798 RGBImage,
1799 Emission,
1800 }

Constructor & Destructor Documentation

◆ ImageView()

BioGTK.ImageView.ImageView ( Builder builder,
IntPtr handle,
BioImage im )
protected

Definition at line 247 of file ImageView.cs.

247 : base(handle)
248 {
249 _builder = builder;
250 App.viewer = this;
251 builder.Autoconnect(this);
252 viewStack.Add(sk);
253 viewStack.ShowAll();
254 sk.Show();
255 roi.Submenu = roiMenu;
256 roi.ShowAll();
257 AddImage(im);
258 ShowMasks = true;
259 pxWmicron = SelectedImage.PhysicalSizeX;
260 pxHmicron = SelectedImage.PhysicalSizeY;
262 //pictureBox.WidthRequest = im.SizeX;
263 //pictureBox.HeightRequest = im.SizeY;
264 Function.InitializeContextMenu();
265 this.Scale = new SizeF(1, 1);
266 // Set the text column to display for comboboxs.
267 var rendererr = new CellRendererText();
268 rBox.PackStart(rendererr, false);
269 rBox.AddAttribute(rendererr, "text", 0);
270 var rendererg = new CellRendererText();
271 gBox.PackStart(rendererg, false);
272 gBox.AddAttribute(rendererg, "text", 0);
273 var rendererb = new CellRendererText();
274 bBox.PackStart(rendererb, false);
275 bBox.AddAttribute(rendererb, "text", 0);
276 App.ApplyStyles(this);
277 if(im.Type == BioImage.ImageType.well)
278 {
279 Resolution = 0;
280 }
281 if(im.Type == BioImage.ImageType.pyramidal)
282 {
283 WidthRequest = 800;
284 HeightRequest = 600;
285 im.PyramidalSize = new AForge.Size(800, 600);
286 }
287 else
288 if(im.SizeX > 1920 || im.SizeY > 1080)
289 {
290 WidthRequest = 800;
291 HeightRequest = 600;
292 }
293 }
void SetupHandlers()
Sets up the handlers.
Definition ImageView.cs:854
void AddImage(BioImage im)
Definition ImageView.cs:65

Member Function Documentation

◆ AddImage()

void BioGTK.ImageView.AddImage ( BioImage im)

It adds an image to the list of images, and then updates the GUI and the images

Parameters
BioImagea class that contains the image data and metadata

Definition at line 65 of file ImageView.cs.

66 {
67 Images.Add(im);
68 selectedIndex = Images.Count - 1;
69 if(im.Resolutions[0].SizeX < 1920 && im.Resolutions[0].SizeY < 1080)
70 {
71 sk.WidthRequest = 600;
72 sk.HeightRequest = 400;
73 }
74 if(im.isPyramidal)
75 {
76 Initialize();
77 InitPreview();
78 }
79 UpdateGUI();
81 GoToImage(Images.Count - 1);
82 }
void UpdateImages(bool updatePyramidal=false)
It updates the images.
Definition ImageView.cs:729
void GoToImage()
This function is used to go to the image at the specified index.
void UpdateGUI()
It updates the GUI to reflect the current state of the image.

◆ BitmapToSKImage()

static SKImage BioGTK.ImageView.BitmapToSKImage ( AForge.Bitmap bitm)
static

Definition at line 705 of file ImageView.cs.

706 {
707 if(bitm.PixelFormat == PixelFormat.Format24bppRgb)
708 return Convert24bppBitmapToSKImage(bitm);
709 if (bitm.PixelFormat == PixelFormat.Format32bppArgb)
710 return Convert32bppBitmapToSKImage(bitm);
711 if (bitm.PixelFormat == PixelFormat.Float)
712 return Convert32bppBitmapToSKImage(bitm.GetImageRGBA());
713 if (bitm.PixelFormat == PixelFormat.Format16bppGrayScale)
714 return Convert16bppBitmapToSKImage(bitm.GetImageRGB());
715 if (bitm.PixelFormat == PixelFormat.Format48bppRgb)
716 return Convert16bppBitmapToSKImage(bitm.GetImageRGB());
717 if (bitm.PixelFormat == PixelFormat.Format8bppIndexed)
718 return Convert8bppBitmapToSKImage(bitm);
719 else
720 throw new NotSupportedException("PixelFormat " + bitm.PixelFormat + " is not supported for SKImage.");
721 }

◆ Convert16bppBitmapToSKImage()

static SKImage BioGTK.ImageView.Convert16bppBitmapToSKImage ( Bitmap sourceBitmap)
static

Definition at line 671 of file ImageView.cs.

672 {
673 Bitmap bm = sourceBitmap.GetImageRGB();
674 int width = bm.Width;
675 int height = bm.Height;
676
677 SKBitmap skBitmap = new SKBitmap(width, height, SKColorType.Bgra8888, SKAlphaType.Opaque);
678
679 BitmapData bitmapData = sourceBitmap.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadOnly, bm.PixelFormat);
680
681 unsafe
682 {
683 byte* sourcePtr = (byte*)bm.Data.ToPointer();
684 byte* destPtr = (byte*)skBitmap.GetPixels().ToPointer();
685
686 for (int y = 0; y < height; y++)
687 {
688 for (int x = 0; x < width; x++)
689 {
690 destPtr[0] = sourcePtr[0]; // Blue
691 destPtr[1] = sourcePtr[1]; // Green
692 destPtr[2] = sourcePtr[2]; // Red
693 destPtr[3] = 255; // Alpha (fully opaque)
694
695 sourcePtr += 3;
696 destPtr += 4;
697 }
698 }
699 }
700
701 sourceBitmap.UnlockBits(bitmapData);
702
703 return SKImage.FromBitmap(skBitmap);
704 }

◆ CopySelection()

void BioGTK.ImageView.CopySelection ( )

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

Definition at line 1754 of file ImageView.cs.

1755 {
1756 copys.Clear();
1757 string s = "";
1758 List<ROI> rois = new List<ROI>();
1759 rois.AddRange(SelectedImage.AnnotationsR);
1760 rois.AddRange(SelectedImage.AnnotationsG);
1761 rois.AddRange(SelectedImage.AnnotationsB);
1762 foreach (ROI item in rois)
1763 {
1764 if (item.Selected)
1765 {
1766 copys.Add(item);
1767 s += BioImage.ROIToString(item);
1768 }
1769 }
1770 Clipboard clipboard = Clipboard.Get(Gdk.Selection.Clipboard);
1771 clipboard.Text = s;
1772 }

◆ Create()

static ImageView BioGTK.ImageView.Create ( BioImage bm)
static

The function creates an ImageView object using a BioImage object and returns it.

Parameters
BioImageThe BioImage parameter is an object that represents an image in a biological context. It likely contains information about the image file, such as the filename, and possibly additional metadata related to the image.
Returns
The method is returning an instance of the ImageView class.

Definition at line 236 of file ImageView.cs.

237 {
238 Console.WriteLine("Creating ImageView for " + bm.file);
239 Builder builder = new Builder(new FileStream(System.IO.Path.GetDirectoryName(Environment.ProcessPath) + "/" + "Glade/ImageView.glade", FileMode.Open));
240 ImageView v = new ImageView(builder, builder.GetObject("imageView").Handle, bm);
241 v.Title = bm.Filename;
242 return v;
243 }

◆ FromColor()

static Cairo.Color BioGTK.ImageView.FromColor ( Color color)
static

It takes a System.Drawing.Color and returns a Cairo.Color

Parameters
ColorThe color to convert
Returns
A Cairo.Color object.

Definition at line 1441 of file ImageView.cs.

1442 {
1443 return new Cairo.Color((double)color.R / 255, (double)color.G / 255, (double)color.B / 255);
1444 }

◆ GetCoordinate()

ZCT BioGTK.ImageView.GetCoordinate ( )

It returns the coordinate of the selected image

Returns
The Coordinate property of the SelectedImage object.

Definition at line 58 of file ImageView.cs.

59 {
60 return SelectedImage.Coordinate;
61 }

◆ GetScale()

double BioGTK.ImageView.GetScale ( )

Definition at line 2039 of file ImageView.cs.

2040 {
2041 return ToViewSizeW(ROI.selectBoxSize / Scale.Width);
2042 }

◆ GetSelectedROIs()

List< ROI > BioGTK.ImageView.GetSelectedROIs ( )

Definition at line 2049 of file ImageView.cs.

2050 {
2051 List<ROI> roi = new List<ROI>();
2052 List<ROI> rois = new List<ROI>();
2053 rois.AddRange(SelectedImage.AnnotationsR);
2054 rois.AddRange(SelectedImage.AnnotationsG);
2055 rois.AddRange(SelectedImage.AnnotationsB);
2056 foreach (ROI r in rois)
2057 {
2058 if(r.Selected)
2059 {
2060 roi.Add(r);
2061 }
2062 }
2063 return roi;
2064 }

◆ GoToImage() [1/2]

void BioGTK.ImageView.GoToImage ( )

This function is used to go to the image at the specified index.

Definition at line 2812 of file ImageView.cs.

2813 {
2814 GoToImage(0);
2815 }

◆ GoToImage() [2/2]

void BioGTK.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 2821 of file ImageView.cs.

2822 {
2823 if (Images.Count <= i)
2824 return;
2825 if (SelectedImage.Type == BioImage.ImageType.pyramidal)
2826 {
2827 if (SelectedImage.OpenSlideBase != null)
2828 {
2829 if (MacroResolution.HasValue)
2830 {
2831 int lev = MacroResolution.Value - 2;
2832 Resolution = _openSlideBase.Schema.Resolutions[lev].UnitsPerPixel * 0.98;
2833 }
2834 else
2835 {
2836 int lev = 0;
2837 Resolution = _openSlideBase.Schema.Resolutions[lev].UnitsPerPixel * 0.98;
2838 }
2839 }
2840 else
2841 {
2842 if (MacroResolution.HasValue)
2843 {
2844 int lev = MacroResolution.Value - 1;
2845 Resolution = SelectedImage.SlideBase.Schema.Resolutions[lev].UnitsPerPixel * 0.98;
2846 PyramidalOrigin = new PointD(0, 0);
2847 }
2848 else
2849 {
2850 Resolution = SelectedImage.GetUnitPerPixel(SelectedImage.Resolutions.Count - 1) * 0.98;
2851 }
2852 }
2853 }
2854 double dx = Images[i].Volume.Width / 2;
2855 double dy = Images[i].Volume.Height / 2;
2856 Origin = new PointD(-(Images[i].Volume.Location.X + dx), -(Images[i].Volume.Location.Y + dy));
2857 double wx, wy;
2858 wx = viewStack.AllocatedWidth / ToScreenW(SelectedImage.Volume.Width);
2859 wy = viewStack.AllocatedHeight / ToScreenH(SelectedImage.Volume.Height);
2860 Scale = new SizeF((float)wy, (float)wy);
2861 UpdateView();
2862 }
void UpdateView(bool update=false, bool updateImages=false)
It updates the view.
float ToScreenH(double y)
double ToScreenW(double x)

◆ ImageToViewSpace()

PointD BioGTK.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 2510 of file ImageView.cs.

2511 {
2512 if (SelectedImage == null)
2513 return ToViewSpace(x, y);
2514 if (SelectedImage.isPyramidal)
2515 {
2516 return new PointD((PyramidalOrigin.X + x) * Resolution, (PyramidalOrigin.Y + y) * Resolution);
2517 }
2518 else
2519 return ToViewSpace(x, y);
2520 }
PointF ToViewSpace(PointF p)

◆ PasteSelection()

void BioGTK.ImageView.PasteSelection ( )

The function takes the text from the clipboard and splits it into lines. Each line is then converted into an ROI object and added to the list of annotations

Definition at line 1775 of file ImageView.cs.

1776 {
1777 Clipboard clipboard = Clipboard.Get(Gdk.Selection.Clipboard);
1778 string text = clipboard.WaitForText();
1779 string[] sts = text.Split(BioImage.NewLine);
1780 foreach (string line in sts)
1781 {
1782 if (line.Length > 8)
1783 {
1784 ROI an = BioImage.StringToROI(line);
1785 //We set the coordinates of the ROI's we are pasting
1786 an.coord = GetCoordinate();
1787 SelectedImage.Annotations.Add(an);
1788 }
1789 }
1790 UpdateView();
1791 }
ZCT GetCoordinate()
Definition ImageView.cs:58

◆ SetCoordinate()

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

Definition at line 33 of file ImageView.cs.

34 {
35 if (SelectedImage == null)
36 return;
37 if (z > SelectedImage.SizeZ - 1 && SelectedImage.Type == BioImage.ImageType.well)
38 zBar.Value = zBar.Adjustment.Upper;
39 else
40 zBar.Value = z;
41 if (c > SelectedImage.SizeC - 1)
42 cBar.Value = cBar.Adjustment.Upper;
43 else
44 cBar.Value = c;
45 if (t > SelectedImage.SizeT - 1)
46 tBar.Value = tBar.Adjustment.Upper;
47 else
48 tBar.Value = t;
49 if (SelectedImage.Type == BioImage.ImageType.well)
50 SelectedImage.Coordinate = new ZCT(0, (int)cBar.Value, (int)tBar.Value);
51 else
52 SelectedImage.Coordinate = new ZCT((int)zBar.Value, (int)cBar.Value, (int)tBar.Value);
53 UpdateView(true, true);
54 }

◆ SetTitle()

void BioGTK.ImageView.SetTitle ( string s)

Definition at line 723 of file ImageView.cs.

724 {
725 this.Title = s;
726 }

◆ SetupHandlers()

void BioGTK.ImageView.SetupHandlers ( )
protected

Sets up the handlers.

Definition at line 854 of file ImageView.cs.

855 {
856 zBar.ValueChanged += ValueChanged;
857 cBar.ValueChanged += ValueChanged;
858 tBar.ValueChanged += ValueChanged;
859 zBar.ScrollEvent += ZBar_ScrollEvent;
860 cBar.ScrollEvent += CBar_ScrollEvent;
861 tBar.ScrollEvent += TBar_ScrollEvent;
862 sk.MotionNotifyEvent += ImageView_MotionNotifyEvent;
863 sk.ButtonPressEvent += ImageView_ButtonPressEvent;
864 sk.ButtonReleaseEvent += ImageView_ButtonReleaseEvent;
865 sk.ScrollEvent += ImageView_ScrollEvent;
866 sk.PaintSurface += Render;
867 sk.SizeAllocated += PictureBox_SizeAllocated;
868 sk.AddEvents((int)
869 (EventMask.ButtonPressMask
870 | EventMask.ButtonReleaseMask
871 | EventMask.KeyPressMask
872 | EventMask.PointerMotionMask | EventMask.ScrollMask));
873 this.KeyPressEvent += ImageView_KeyPressEvent;
874 this.DestroyEvent += ImageView_DestroyEvent;
875 this.DeleteEvent += ImageView_DeleteEvent;
876 this.FocusInEvent += ImageView_FocusInEvent;
877 rBox.Changed += RBox_Changed;
878 gBox.Changed += GBox_Changed;
879 bBox.Changed += BBox_Changed;
880 //Context Menu
881 goToImageMenu.ButtonPressEvent += GoToImageMenu_ButtonPressEvent;
882 goToOriginMenu.ButtonPressEvent += GoToOriginMenu_ButtonPressEvent;
883
884 roiDelete.ButtonPressEvent += RoiDelete_ButtonPressEvent;
885 roiID.ButtonPressEvent += RoiID_ButtonPressEvent;
886 copy.ButtonPressEvent += Copy_ButtonPressEvent;
887 paste.ButtonPressEvent += Paste_ButtonPressEvent;
888 draw.ButtonPressEvent += Draw_ButtonPressEvent;
889 fill.ButtonPressEvent += Fill_ButtonPressEvent;
890
891 play.ButtonPressEvent += Play_ButtonPressEvent;
892 stop.ButtonPressEvent += Stop_ButtonPressEvent;
893 playSpeed.ButtonPressEvent += PlaySpeed_ButtonPressEvent;
894 setValueRange.ButtonPressEvent += SetValueRange_ButtonPressEvent;
895 loop.ButtonPressEvent += Loop_ButtonPressEvent;
896
897 zBar.ButtonPressEvent += ZBar_ButtonPressEvent;
898 tBar.ButtonPressEvent += TBar_ButtonPressEvent;
899 cBar.ButtonPressEvent += CBar_ButtonPressEvent;
900
901 }

◆ ToScreenH()

float BioGTK.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 2807 of file ImageView.cs.

2808 {
2809 return (float)(y * PxHmicron);
2810 }

◆ ToScreenRect()

RectangleD BioGTK.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 2720 of file ImageView.cs.

2721 {
2722 if (SelectedImage == null)
2723 {
2724 double dx = (pxWmicron * (-Origin.X)) * Scale.Width;
2725 double dy = (pxHmicron * (-Origin.Y)) * Scale.Height;
2726 RectangleD rf = new RectangleD((PxWmicron * x * Scale.Width + dx), (PxHmicron * y * Scale.Height + dy), (PxWmicron * w * Scale.Width), (PxHmicron * h * Scale.Height));
2727 return rf;
2728 }
2729 if (SelectedImage.isPyramidal)
2730 {
2731 PointD d = ToViewSpace(x, y);
2732 double dw = ToViewSizeW(w);
2733 double dh = ToViewSizeH(h);
2734 return new RectangleD(d.X, d.Y, dw, dh);
2735 }
2736 else
2737 {
2738 double dx = (pxWmicron * (Origin.X)) * Scale.Width;
2739 double dy = (pxHmicron * (Origin.Y)) * Scale.Height;
2740 RectangleD rf = new RectangleD((PxWmicron * x * Scale.Width + dx), (PxHmicron * y * Scale.Height + dy), (PxWmicron * w * Scale.Width), (PxHmicron * h * Scale.Height));
2741 return rf;
2742 }
2743 }
double ToViewSizeH(double d)

◆ ToScreenScale()

PointF BioGTK.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 2706 of file ImageView.cs.

2707 {
2708 float x = ToScreenScaleW((float)p.X);
2709 float y = ToScreenScaleH((float)p.Y);
2710 return new PointF(x, y);
2711 }
float ToScreenScaleW(double x)
float ToScreenScaleH(double y)

◆ ToScreenScaleH()

float BioGTK.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 2697 of file ImageView.cs.

2698 {
2699 return (float)(-y * PxHmicron * Scale.Height);
2700 }

◆ ToScreenScaleW()

float BioGTK.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 2688 of file ImageView.cs.

2689 {
2690 return (float)(-x * PxWmicron * Scale.Width);
2691 }

◆ ToScreenSpace() [1/9]

PointD BioGTK.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 2635 of file ImageView.cs.

2636 {
2637 RectangleD f = ToScreenRect(x, y, 1, 1);
2638 return new PointD(f.X, f.Y);
2639 }
RectangleD ToScreenRect(double x, double y, double w, double h)

◆ ToScreenSpace() [2/9]

PointF BioGTK.ImageView.ToScreenSpace ( Point3D p)

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

Parameters
Point3D
Returns
A PointF object.

Definition at line 2678 of file ImageView.cs.

2679 {
2680 PointD pd = ToScreenSpace(p.X, p.Y);
2681 return new PointF((float)pd.X, (float)pd.Y);
2682 }
PointD ToScreenSpace(double x, double y)

◆ ToScreenSpace() [3/9]

PointD BioGTK.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 2645 of file ImageView.cs.

2646 {
2647 return ToScreenSpace(p.X, p.Y);
2648 }

◆ ToScreenSpace() [4/9]

PointD[] BioGTK.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 2783 of file ImageView.cs.

2784 {
2785 PointD[] rs = new PointD[p.Length];
2786 for (int i = 0; i < p.Length; i++)
2787 {
2788 PointD pd = ToScreenSpace(p[i]);
2789 rs[i] = new PointD((float)pd.X, (float)pd.Y);
2790 }
2791 return rs;
2792 }

◆ ToScreenSpace() [5/9]

PointF BioGTK.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 2654 of file ImageView.cs.

2655 {
2656 PointD pd = ToScreenSpace(p.X, p.Y);
2657 return new PointF((float)pd.X, (float)pd.Y);
2658 }

◆ ToScreenSpace() [6/9]

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

2665 {
2666 PointF[] pf = new PointF[p.Length];
2667 for (int i = 0; i < p.Length; i++)
2668 {
2669 pf[i] = ToScreenSpace(p[i]);
2670 }
2671 return pf;
2672 }

◆ ToScreenSpace() [7/9]

RectangleD BioGTK.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 2750 of file ImageView.cs.

2751 {
2752 return ToScreenRect(p.X, p.Y, p.W, p.H);
2753 }

◆ ToScreenSpace() [8/9]

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

2769 {
2770 RectangleD[] rs = new RectangleD[p.Length];
2771 for (int i = 0; i < p.Length; i++)
2772 {
2773 rs[i] = ToScreenSpace(p[i]);
2774 }
2775 return rs;
2776 }

◆ ToScreenSpace() [9/9]

RectangleD BioGTK.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 2759 of file ImageView.cs.

2760 {
2761 return ToScreenRect(p.X, p.Y, p.Width, p.Height);
2762 }

◆ ToScreenW()

double BioGTK.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 2798 of file ImageView.cs.

2799 {
2800 return (float)(x * PxWmicron);
2801 }

◆ ToViewH()

double BioGTK.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 2619 of file ImageView.cs.

2620 {
2621 if (SelectedImage != null)
2622 if (SelectedImage.isPyramidal)
2623 {
2624 return d / Resolution;
2625 }
2626 double y = (double)(d / PxHmicron) / scale.Height;
2627 return y;
2628 }

◆ ToViewSizeH()

double BioGTK.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 2589 of file ImageView.cs.

2590 {
2591 if (SelectedImage != null)
2592 if (SelectedImage.isPyramidal)
2593 {
2594 return d / Resolution;
2595 }
2596 double y = (double)(d / PxHmicron);
2597 return y;
2598 }

◆ ToViewSpace() [1/3]

PointD BioGTK.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 2546 of file ImageView.cs.

2547 {
2548 if (SelectedImage == null)
2549 {
2550 double dx = (ToViewSizeW(x - (viewStack.AllocatedWidth / 2)) / Scale.Width) - Origin.X;
2551 double dy = (ToViewSizeH(y - (viewStack.AllocatedHeight / 2)) / Scale.Height) - Origin.Y;
2552 return new PointD(dx, dy);
2553 }
2554
2555 if (SelectedImage.isPyramidal)
2556 {
2557 PointD p = new PointD(x / Resolution, y / Resolution);
2558 return new PointD(p.X - PyramidalOrigin.X, p.Y - PyramidalOrigin.Y);
2559 }
2560 else
2561 {
2562 // Handle non-pyramidal case
2563 double dx = (ToViewSizeW(x - (viewStack.AllocatedWidth / 2)) / Scale.Width) - Origin.X;
2564 double dy = (ToViewSizeH(y - (viewStack.AllocatedHeight / 2)) / Scale.Height) - Origin.Y;
2565 return new PointD(dx, dy);
2566 }
2567 }

◆ ToViewSpace() [2/3]

PointD BioGTK.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 2536 of file ImageView.cs.

2537 {
2538 return ToViewSpace(p.X, p.Y); ;
2539 }

◆ ToViewSpace() [3/3]

PointF BioGTK.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 2526 of file ImageView.cs.

2527 {
2528 PointD d = ToViewSpace(p.X, p.Y);
2529 return new PointF((float)d.X, (float)d.Y);
2530 }

◆ ToViewW()

double BioGTK.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 2604 of file ImageView.cs.

2605 {
2606 if (SelectedImage != null)
2607 if (SelectedImage.isPyramidal)
2608 {
2609 return d / Resolution;
2610 }
2611 double x = (double)(d / PxWmicron) / scale.Width;
2612 return x;
2613 }

◆ UpdateGUI()

void BioGTK.ImageView.UpdateGUI ( )

It updates the GUI to reflect the current state of the image.

Definition at line 1684 of file ImageView.cs.

1685 {
1686 cBar.Adjustment.Lower = 0;
1687 cBar.Adjustment.Upper = Images[selectedIndex].SizeC - 1;
1688 zBar.Adjustment.Lower = 0;
1689 zBar.Adjustment.Upper = Images[selectedIndex].SizeZ - 1;
1690 tBar.Adjustment.Lower = 0;
1691 tBar.Adjustment.Upper = Images[selectedIndex].SizeT - 1;
1692 if (endz == 0 || endz > Images[selectedIndex].SizeZ - 1)
1693 endz = Images[selectedIndex].SizeZ - 1;
1694 if (endc == 0 || endc > Images[selectedIndex].SizeC - 1)
1695 endc = Images[selectedIndex].SizeC - 1;
1696 if (endt == 0 || endt > Images[selectedIndex].SizeT - 1)
1697 endt = Images[selectedIndex].SizeT - 1;
1698 var store = new ListStore(typeof(string));
1699 foreach (Channel c in SelectedImage.Channels)
1700 {
1701 store.AppendValues(c.Name);
1702 }
1703 // Set the model for the ComboBox
1704 rBox.Model = store;
1705 gBox.Model = store;
1706 bBox.Model = store;
1707 if (SelectedImage.Channels.Count > 2)
1708 {
1709 rBox.Active = 0;
1710 gBox.Active = 1;
1711 bBox.Active = 2;
1712 }
1713 else
1714 if (SelectedImage.Channels.Count == 2)
1715 {
1716 rBox.Active = 0;
1717 gBox.Active = 1;
1718 }
1719 imagesMenu = new Menu();
1720 foreach (BioImage b in Images)
1721 {
1722 MenuItem mi = new MenuItem(b.Filename);
1723 mi.ButtonPressEvent += Mi_ButtonPressEvent;
1724 imagesMenu.Append(mi);
1725 }
1726 goToImageMenu.Submenu = imagesMenu;
1727 goToImageMenu.ShowAll();
1728 }

◆ UpdateImage()

void BioGTK.ImageView.UpdateImage ( bool updatePyramidal = false)

It updates the image.

Definition at line 778 of file ImageView.cs.

779 {
780 UpdateImages(updatePyramidal);
781 }

◆ UpdateImages()

void BioGTK.ImageView.UpdateImages ( bool updatePyramidal = false)

It updates the images.

Definition at line 729 of file ImageView.cs.

730 {
731 if (SelectedImage == null)
732 return;
733 if (zBar.Adjustment.Upper != SelectedImage.SizeZ - 1 || tBar.Adjustment.Upper != SelectedImage.SizeT - 1)
734 {
735 UpdateGUI();
736 }
737 int bi = 0;
738 if (SelectedImage.isPyramidal && sk.AllocatedHeight <= 1 || sk.AllocatedWidth <= 1)
739 return;
740 if (SelectedImage.isPyramidal && updatePyramidal || SelectedImage.Buffers.Count == 0)
741 {
742 SelectedImage.Coordinate = GetCoordinate();
743 SelectedImage.PyramidalSize = new AForge.Size(sk.AllocatedWidth, sk.AllocatedHeight);
744 SelectedImage.UpdateBuffersPyramidal().Wait();
745 }
746 SKImages.Clear();
747 Bitmaps.Clear();
748 foreach (BioImage b in Images)
749 {
750 ZCT c = GetCoordinate();
751 AForge.Bitmap bitmap = null;
752 int index = b.GetFrameIndex(c.Z, c.C, c.T);
753 if (Mode == ViewMode.Filtered)
754 {
755 bitmap = b.GetFiltered(c, b.RChannel.RangeR, b.GChannel.RangeG, b.BChannel.RangeB);
756 }
757 else if (Mode == ViewMode.RGBImage)
758 {
759 bitmap = b.GetRGBBitmap(c, b.RChannel.RangeR, b.GChannel.RangeG, b.BChannel.RangeB);
760 }
761 else if (Mode == ViewMode.Raw)
762 {
763 bitmap = b.Buffers[index];
764 }
765 else
766 {
767 bitmap = b.GetEmission(c, b.RChannel.RangeR, b.GChannel.RangeG, b.BChannel.RangeB);
768 }
769 if (bitmap == null)
770 return;
771 Bitmaps.Add(bitmap);
772 SKImage skim = BitmapToSKImage(bitmap);
773 SKImages.Add(skim);
774 bi++;
775 }
776 }

◆ UpdateStatus()

void BioGTK.ImageView.UpdateStatus ( )

It updates the status of the user.

Definition at line 2008 of file ImageView.cs.

2009 {
2010 if (SelectedImage.Buffers.Count == 0)
2011 return;
2012 if(SelectedImage.Type == BioImage.ImageType.well)
2013 {
2014 statusLabel.Text = (zBar.Value + 1) + "/" + (zBar.Adjustment.Upper + 1) + ", " + (cBar.Value + 1) + "/" + (cBar.Adjustment.Upper + 1) + ", " + (tBar.Value + 1) + "/" + (tBar.Adjustment.Upper + 1) + ", " +
2015 mousePoint + mouseColor + ", " + SelectedImage.Buffers[0].PixelFormat.ToString() + ", (" + SelectedImage.Volume.Location.X.ToString("N2") + ", " + SelectedImage.Volume.Location.Y.ToString("N2") + ") "
2016 + Origin.X.ToString("N2") + "," + Origin.Y.ToString("N2") + " , Well:" + SelectedImage.Level;
2017 }
2018 else
2019 statusLabel.Text = (zBar.Value + 1) + "/" + (zBar.Adjustment.Upper + 1) + ", " + (cBar.Value + 1) + "/" + (cBar.Adjustment.Upper + 1) + ", " + (tBar.Value + 1) + "/" + (tBar.Adjustment.Upper + 1) + ", " +
2020 mousePoint + mouseColor + ", " + SelectedImage.Buffers[0].PixelFormat.ToString() + ", (" + SelectedImage.Volume.Location.X.ToString("N2") + ", " + SelectedImage.Volume.Location.Y.ToString("N2") + ") "
2021 + Origin.X.ToString("N2") + "," + Origin.Y.ToString("N2") + ", Res:" + Resolution;
2022 }

◆ UpdateView()

void BioGTK.ImageView.UpdateView ( bool update = false,
bool updateImages = false )

It updates the view.

Definition at line 2024 of file ImageView.cs.

2025 {
2026 if(updateImages)
2027 UpdateImages(true);
2028 refresh = true;
2029 if(update)
2030 sk.QueueDraw();
2031 }

Member Data Documentation

◆ Bitmaps

List<Bitmap> BioGTK.ImageView.Bitmaps = new List<Bitmap>()

Definition at line 32 of file ImageView.cs.

◆ contextMenu

Menu BioGTK.ImageView.contextMenu

Definition at line 190 of file ImageView.cs.

◆ endc

int BioGTK.ImageView.endc = 0
static

Definition at line 934 of file ImageView.cs.

◆ endt

int BioGTK.ImageView.endt = 0
static

Definition at line 935 of file ImageView.cs.

◆ endz

int BioGTK.ImageView.endz = 0
static

Definition at line 933 of file ImageView.cs.

◆ Images

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

Definition at line 30 of file ImageView.cs.

◆ keyDown

Gdk.Key BioGTK.ImageView.keyDown = Gdk.Key.Key_3270_Test
static

Definition at line 1504 of file ImageView.cs.

◆ mainBox

Gtk.Box BioGTK.ImageView.mainBox

Definition at line 180 of file ImageView.cs.

◆ Modifiers

ModifierType BioGTK.ImageView.Modifiers
static

Definition at line 2046 of file ImageView.cs.

◆ mouseLeftState

bool BioGTK.ImageView.mouseLeftState
static

Definition at line 2045 of file ImageView.cs.

◆ selectedAnnotations

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

Definition at line 160 of file ImageView.cs.

◆ showBROIs

bool BioGTK.ImageView.showBROIs = true

Definition at line 2037 of file ImageView.cs.

◆ showGROIs

bool BioGTK.ImageView.showGROIs = true

Definition at line 2036 of file ImageView.cs.

◆ showRROIs

bool BioGTK.ImageView.showRROIs = true

Definition at line 2035 of file ImageView.cs.

◆ SKImages

List<SKImage> BioGTK.ImageView.SKImages = new List<SKImage>()

Definition at line 31 of file ImageView.cs.

◆ startc

int BioGTK.ImageView.startc = 0
static

Definition at line 931 of file ImageView.cs.

◆ startt

int BioGTK.ImageView.startt = 0
static

Definition at line 932 of file ImageView.cs.

◆ startz

int BioGTK.ImageView.startz = 0
static

Definition at line 930 of file ImageView.cs.

◆ waitc

int BioGTK.ImageView.waitc = 1000
static

Definition at line 928 of file ImageView.cs.

◆ waitt

int BioGTK.ImageView.waitt = 1000
static

Definition at line 929 of file ImageView.cs.

◆ waitz

int BioGTK.ImageView.waitz = 1000
static

Definition at line 927 of file ImageView.cs.

◆ x1State

bool BioGTK.ImageView.x1State
static

Definition at line 2043 of file ImageView.cs.

◆ x2State

bool BioGTK.ImageView.x2State
static

Definition at line 2044 of file ImageView.cs.

Property Documentation

◆ AllowNavigation

bool BioGTK.ImageView.AllowNavigation
getset

Definition at line 134 of file ImageView.cs.

135 {
136 get { return allowNavigation; }
137 set { allowNavigation = value; }
138 }

◆ BChannel

Channel BioGTK.ImageView.BChannel
get

Definition at line 1872 of file ImageView.cs.

1873 {
1874 get
1875 {
1876 return SelectedImage.Channels[SelectedImage.rgbChannels[2]];
1877 }
1878 }

◆ GChannel

Channel BioGTK.ImageView.GChannel
get

Definition at line 1864 of file ImageView.cs.

1865 {
1866 get
1867 {
1868 return SelectedImage.Channels[SelectedImage.rgbChannels[1]];
1869 }
1870 }

◆ LabelResolution

int? BioGTK.ImageView.LabelResolution
get

Definition at line 797 of file ImageView.cs.

797{ get { return SelectedImage.LabelResolution; } }

◆ Level

int BioGTK.ImageView.Level
getset

Definition at line 1959 of file ImageView.cs.

1960 {
1961 get
1962 {
1963 if(SelectedImage.Type == BioImage.ImageType.well)
1964 {
1965 return (int)SelectedImage.Level;
1966 }
1967 if(SelectedImage.isPyramidal)
1968 if (!openSlide)
1969 l = OpenSlideGTK.TileUtil.GetLevel(_slideBase.Schema.Resolutions, Resolution);
1970 else
1971 l = OpenSlideGTK.TileUtil.GetLevel(_openSlideBase.Schema.Resolutions, Resolution);
1972 return l;
1973 }
1974 set
1975 {
1976 if (value < 0)
1977 return;
1978 l = value;
1979 SelectedImage.Level = l;
1980 if (SelectedImage.Type == BioImage.ImageType.well)
1981 {
1982 SelectedImage.UpdateBuffersWells();
1983 UpdateImages();
1984 UpdateView();
1985 }
1986 }
1987 }

◆ MacroResolution

int? BioGTK.ImageView.MacroResolution
get

Definition at line 796 of file ImageView.cs.

796{ get { return SelectedImage.MacroResolution; } }

◆ Mode

ViewMode BioGTK.ImageView.Mode
getset

Definition at line 1824 of file ImageView.cs.

1825 {
1826 get
1827 {
1828 return viewMode;
1829 }
1830 set
1831 {
1832 viewMode = value;
1833 if (viewMode == ViewMode.RGBImage)
1834 {
1835 rgbStack.VisibleChild = rgbStack.Children[1];
1836 }
1837 else
1838 if (viewMode == ViewMode.Filtered)
1839 {
1840 rgbStack.VisibleChild = rgbStack.Children[0];
1841 }
1842 else
1843 if (viewMode == ViewMode.Raw)
1844 {
1845 rgbStack.VisibleChild = rgbStack.Children[0];
1846 }
1847 else
1848 {
1849 rgbStack.VisibleChild = rgbStack.Children[0];
1850 }
1851 UpdateImage();
1852 UpdateView();
1853 }
1854 }
void UpdateImage(bool updatePyramidal=false)
It updates the image.
Definition ImageView.cs:778

◆ MouseDown

PointD BioGTK.ImageView.MouseDown
getset

Definition at line 2267 of file ImageView.cs.

2268 {
2269 get { return mouseDown; }
2270 set { mouseDown = value; }
2271 }

◆ MouseDownInt

PointD BioGTK.ImageView.MouseDownInt
getset

Definition at line 2252 of file ImageView.cs.

2253 {
2254 get { return mouseDownInt; }
2255 set { mouseDownInt = value; }
2256 }

◆ MouseMove

PointD BioGTK.ImageView.MouseMove
getset

Definition at line 2277 of file ImageView.cs.

2278 {
2279 get { return mouseMove; }
2280 set { mouseMove = value; }
2281 }

◆ MouseMoveInt

PointD BioGTK.ImageView.MouseMoveInt
getset

Definition at line 2257 of file ImageView.cs.

2258 {
2259 get { return mouseMoveInt; }
2260 set { mouseMoveInt = value; }
2261 }

◆ MouseUp

PointD BioGTK.ImageView.MouseUp
getset

Definition at line 2272 of file ImageView.cs.

2273 {
2274 get { return mouseUp; }
2275 set { mouseUp = value; }
2276 }

◆ MouseUpInt

PointD BioGTK.ImageView.MouseUpInt
getset

Definition at line 2262 of file ImageView.cs.

2263 {
2264 get { return mouseUpInt; }
2265 set { mouseUpInt = value; }
2266 }

◆ OpenSlide

bool BioGTK.ImageView.OpenSlide
getset

Definition at line 1802 of file ImageView.cs.

1803 {
1804 get { return openSlide; }
1805 set { openSlide = value; }
1806 }

◆ Origin

PointD BioGTK.ImageView.Origin
getset

Definition at line 1881 of file ImageView.cs.

1882 {
1883 get { return origin; }
1884 set
1885 {
1886 if(AllowNavigation)
1887 origin = value;
1888 UpdateView(true, false);
1889 }
1890 }

◆ PxHmicron

double BioGTK.ImageView.PxHmicron
getset

Definition at line 110 of file ImageView.cs.

111 {
112 get
113 {
114 if (SelectedImage.Type == BioImage.ImageType.pyramidal)
115 if (openSlide)
116 {
117 int lev = OpenSlideGTK.TileUtil.GetLevel(_openSlideBase.Schema.Resolutions, Resolution);
118 return _openSlideBase.Schema.Resolutions[lev].UnitsPerPixel * pxHmicron;
119 }
120 else
121 {
122 int lev = OpenSlideGTK.TileUtil.GetLevel(_slideBase.Schema.Resolutions, Resolution);
123 return _slideBase.Schema.Resolutions[lev].UnitsPerPixel * pxHmicron;
124 }
125 return pxHmicron;
126 }
127 set
128 {
129 pxHmicron = value;
130 UpdateView(true, false);
131 }
132 }

◆ PxWmicron

double BioGTK.ImageView.PxWmicron
getset

Definition at line 86 of file ImageView.cs.

87 {
88 get
89 {
90 if(SelectedImage.Type == BioImage.ImageType.pyramidal)
91 if(openSlide)
92 {
93 int lev = OpenSlideGTK.TileUtil.GetLevel(_openSlideBase.Schema.Resolutions, Resolution);
94 return _openSlideBase.Schema.Resolutions[lev].UnitsPerPixel * pxWmicron;
95 }
96 else
97 {
98 int lev = OpenSlideGTK.TileUtil.GetLevel(_slideBase.Schema.Resolutions, Resolution);
99 return _slideBase.Schema.Resolutions[lev].UnitsPerPixel * pxWmicron;
100 }
101
102 return pxWmicron;
103 }
104 set
105 {
106 pxWmicron = value;
107 UpdateView(true,false);
108 }
109 }

◆ PyramidalOrigin

PointD BioGTK.ImageView.PyramidalOrigin
getset

Definition at line 1905 of file ImageView.cs.

1906 {
1907 get
1908 {
1909 return SelectedImage.PyramidalOrigin;
1910 }
1911 set
1912 {
1913 if (!AllowNavigation)
1914 return;
1915 PointD p = new PointD();
1916 if (value.X > 0)
1917 p.X = value.X;
1918 if (value.Y > 0)
1919 p.Y = value.Y;
1920 SelectedImage.PyramidalOrigin = p;
1921 UpdateView(true, true);
1922 }
1923 }

◆ PyramidalOriginTransformed

PointD BioGTK.ImageView.PyramidalOriginTransformed
getset

Definition at line 1899 of file ImageView.cs.

1900 {
1901 get { return new PointD(PyramidalOrigin.X * Resolution, PyramidalOrigin.Y * Resolution); }
1902 set { PyramidalOrigin = new PointD(value.X / Resolution, value.Y / Resolution); }
1903 }

◆ RChannel

Channel BioGTK.ImageView.RChannel
get

Definition at line 1856 of file ImageView.cs.

1857 {
1858 get
1859 {
1860 return SelectedImage.Channels[SelectedImage.rgbChannels[0]];
1861 }
1862 }

◆ Resolution

double BioGTK.ImageView.Resolution
getset

Definition at line 1926 of file ImageView.cs.

1927 {
1928 get
1929 {
1930 return SelectedImage.Resolution;
1931 }
1932 set
1933 {
1934 SelectedImage.Resolution = value;
1935 // Calculate the scaling factor based on the new and current resolution
1936 double scalingFactor = value / SelectedImage.Resolution;
1937
1938 // Convert the screen coordinates of the mouse position to image coordinates
1939 PointD imageMousePosition = new PointD(
1940 (PyramidalOrigin.X / scalingFactor),
1941 (PyramidalOrigin.Y / scalingFactor)
1942 );
1943
1944 // Calculate the mouse position in viewport space (center of viewport)
1945 PointD viewportCenter = new PointD(
1946 SelectedImage.PyramidalSize.Width / 2,
1947 SelectedImage.PyramidalSize.Height / 2
1948 );
1949 // Update the resolution
1950
1951 // Calculate new PyramidalOrigin so that the image stays centered on the middle
1952 PyramidalOrigin = new PointD(
1953 imageMousePosition.X - (viewportCenter.X * (scalingFactor - 1)),
1954 imageMousePosition.Y - (viewportCenter.Y * (scalingFactor - 1))
1955 );
1956 }
1957 }

◆ Scale

SizeF BioGTK.ImageView.Scale
getset

Definition at line 1991 of file ImageView.cs.

1992 {
1993 get
1994 {
1995 return scale;
1996 }
1997 set
1998 {
1999 scale = value;
2000 // update ui on main UI thread
2001 Application.Invoke(delegate
2002 {
2003 UpdateView(true,false);
2004 });
2005 }
2006 }

◆ SelectedBuffer

AForge.Bitmap BioGTK.ImageView.SelectedBuffer
staticget

Definition at line 143 of file ImageView.cs.

144 {
145 get
146 {
147 int ind = SelectedImage.GetFrameIndex(SelectedImage.Coordinate.Z, SelectedImage.Coordinate.C, SelectedImage.Coordinate.T);
148 return SelectedImage.Buffers[ind];
149 }
150 }

◆ SelectedImage

BioImage BioGTK.ImageView.SelectedImage
staticgetset

Definition at line 1807 of file ImageView.cs.

1808 {
1809 get
1810 {
1811 if (App.viewer == null)
1812 return null;
1813 if(App.viewer.Images.Count == 0)
1814 return null;
1815 return App.viewer.Images[App.viewer.SelectedIndex];
1816 }
1817 set
1818 {
1819 App.viewer.Images[App.viewer.SelectedIndex] = value;
1820 }
1821 }

◆ SelectedIndex

int BioGTK.ImageView.SelectedIndex
getset

Definition at line 152 of file ImageView.cs.

153 {
154 get { return selectedIndex; }
155 set { selectedIndex = value;
156 Images[selectedIndex] = SelectedImage;
157 }
158 }

◆ ShowMasks

bool BioGTK.ImageView.ShowMasks
getset

Definition at line 140 of file ImageView.cs.

140{ get; set; }

◆ ShowOverview

bool BioGTK.ImageView.ShowOverview
getset

Definition at line 786 of file ImageView.cs.

787 {
788 get { return showOverview; }
789 set
790 {
791 showOverview = value;
792 UpdateView();
793 }
794 }

◆ TopRightOrigin

PointD BioGTK.ImageView.TopRightOrigin
get

Definition at line 1892 of file ImageView.cs.

1893 {
1894 get
1895 {
1896 return new PointD((Origin.X - ((sk.AllocatedWidth / 2) * pxWmicron)), (Origin.Y - ((sk.AllocatedHeight / 2) * pxHmicron)));
1897 }
1898 }

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