BioGTK  6.0.0
A .NET library & program for annotating, editing various microscopy imaging formats using Bioformats supported images. Including whole slide, pyramidal, and series.
All Classes Namespaces Functions
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 1803 of file ImageView.cs.

1804 {
1805 Raw,
1806 Filtered,
1807 RGBImage,
1808 Emission,
1809 }

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:863
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:737
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 713 of file ImageView.cs.

714 {
715 if(bitm.PixelFormat == PixelFormat.Format24bppRgb)
716 return Convert24bppBitmapToSKImage(bitm);
717 if (bitm.PixelFormat == PixelFormat.Format32bppArgb)
718 return Convert32bppBitmapToSKImage(bitm);
719 if (bitm.PixelFormat == PixelFormat.Float)
720 return Convert32bppBitmapToSKImage(bitm.GetImageRGBA());
721 if (bitm.PixelFormat == PixelFormat.Format16bppGrayScale)
722 return Convert16bppBitmapToSKImage(bitm.GetImageRGB());
723 if (bitm.PixelFormat == PixelFormat.Format48bppRgb)
724 return Convert16bppBitmapToSKImage(bitm.GetImageRGB());
725 if (bitm.PixelFormat == PixelFormat.Format8bppIndexed)
726 return Convert8bppBitmapToSKImage(bitm);
727 else
728 throw new NotSupportedException("PixelFormat " + bitm.PixelFormat + " is not supported for SKImage.");
729 }

◆ Convert16bppBitmapToSKImage()

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

Definition at line 679 of file ImageView.cs.

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

◆ CopySelection()

void BioGTK.ImageView.CopySelection ( )

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

Definition at line 1763 of file ImageView.cs.

1764 {
1765 copys.Clear();
1766 string s = "";
1767 List<ROI> rois = new List<ROI>();
1768 rois.AddRange(SelectedImage.AnnotationsR);
1769 rois.AddRange(SelectedImage.AnnotationsG);
1770 rois.AddRange(SelectedImage.AnnotationsB);
1771 foreach (ROI item in rois)
1772 {
1773 if (item.Selected)
1774 {
1775 copys.Add(item);
1776 s += BioImage.ROIToString(item);
1777 }
1778 }
1779 Clipboard clipboard = Clipboard.Get(Gdk.Selection.Clipboard);
1780 clipboard.Text = s;
1781 }

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

1451 {
1452 return new Cairo.Color((double)color.R / 255, (double)color.G / 255, (double)color.B / 255);
1453 }

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

2055 {
2056 return ToViewSizeW(ROI.selectBoxSize / Scale.Width);
2057 }

◆ GetSelectedROIs()

List< ROI > BioGTK.ImageView.GetSelectedROIs ( )

Definition at line 2064 of file ImageView.cs.

2065 {
2066 List<ROI> roi = new List<ROI>();
2067 List<ROI> rois = new List<ROI>();
2068 rois.AddRange(SelectedImage.AnnotationsR);
2069 rois.AddRange(SelectedImage.AnnotationsG);
2070 rois.AddRange(SelectedImage.AnnotationsB);
2071 foreach (ROI r in rois)
2072 {
2073 if(r.Selected)
2074 {
2075 roi.Add(r);
2076 }
2077 }
2078 return roi;
2079 }

◆ GoToImage() [1/2]

void BioGTK.ImageView.GoToImage ( )

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

Definition at line 2827 of file ImageView.cs.

2828 {
2829 GoToImage(0);
2830 }

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

2837 {
2838 if (Images.Count <= i)
2839 return;
2840 if (SelectedImage.Type == BioImage.ImageType.pyramidal)
2841 {
2842 if (SelectedImage.OpenSlideBase != null)
2843 {
2844 if (MacroResolution.HasValue)
2845 {
2846 int lev = MacroResolution.Value - 2;
2847 Resolution = _openSlideBase.Schema.Resolutions[lev].UnitsPerPixel * 0.98;
2848 }
2849 else
2850 {
2851 int lev = 0;
2852 Resolution = _openSlideBase.Schema.Resolutions[lev].UnitsPerPixel * 0.98;
2853 }
2854 }
2855 else
2856 {
2857 if (MacroResolution.HasValue)
2858 {
2859 int lev = MacroResolution.Value - 1;
2860 Resolution = SelectedImage.SlideBase.Schema.Resolutions[lev].UnitsPerPixel * 0.98;
2861 PyramidalOrigin = new PointD(0, 0);
2862 }
2863 else
2864 {
2865 Resolution = SelectedImage.GetUnitPerPixel(SelectedImage.Resolutions.Count - 1) * 0.98;
2866 }
2867 }
2868 }
2869 double dx = Images[i].Volume.Width / 2;
2870 double dy = Images[i].Volume.Height / 2;
2871 Origin = new PointD(-(Images[i].Volume.Location.X + dx), -(Images[i].Volume.Location.Y + dy));
2872 double wx, wy;
2873 wx = viewStack.AllocatedWidth / ToScreenW(SelectedImage.Volume.Width);
2874 wy = viewStack.AllocatedHeight / ToScreenH(SelectedImage.Volume.Height);
2875 Scale = new SizeF((float)wy, (float)wy);
2876 UpdateView();
2877 }
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 2525 of file ImageView.cs.

2526 {
2527 if (SelectedImage == null)
2528 return ToViewSpace(x, y);
2529 if (SelectedImage.isPyramidal)
2530 {
2531 return new PointD((PyramidalOrigin.X + x) * Resolution, (PyramidalOrigin.Y + y) * Resolution);
2532 }
2533 else
2534 return ToViewSpace(x, y);
2535 }
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 1784 of file ImageView.cs.

1785 {
1786 Clipboard clipboard = Clipboard.Get(Gdk.Selection.Clipboard);
1787 string text = clipboard.WaitForText();
1788 string[] sts = text.Split(BioImage.NewLine);
1789 foreach (string line in sts)
1790 {
1791 if (line.Length > 8)
1792 {
1793 ROI an = BioImage.StringToROI(line);
1794 //We set the coordinates of the ROI's we are pasting
1795 an.coord = GetCoordinate();
1796 SelectedImage.Annotations.Add(an);
1797 }
1798 }
1799 UpdateView();
1800 }
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 731 of file ImageView.cs.

732 {
733 this.Title = s;
734 }

◆ SetupHandlers()

void BioGTK.ImageView.SetupHandlers ( )
protected

Sets up the handlers.

Definition at line 863 of file ImageView.cs.

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

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

2823 {
2824 return (float)(y * PxHmicron);
2825 }

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

2736 {
2737 if (SelectedImage == null)
2738 {
2739 double dx = (pxWmicron * (-Origin.X)) * Scale.Width;
2740 double dy = (pxHmicron * (-Origin.Y)) * Scale.Height;
2741 RectangleD rf = new RectangleD((PxWmicron * x * Scale.Width + dx), (PxHmicron * y * Scale.Height + dy), (PxWmicron * w * Scale.Width), (PxHmicron * h * Scale.Height));
2742 return rf;
2743 }
2744 if (SelectedImage.isPyramidal)
2745 {
2746 PointD d = ToViewSpace(x, y);
2747 double dw = ToViewSizeW(w);
2748 double dh = ToViewSizeH(h);
2749 return new RectangleD(d.X, d.Y, dw, dh);
2750 }
2751 else
2752 {
2753 double dx = (pxWmicron * (Origin.X)) * Scale.Width;
2754 double dy = (pxHmicron * (Origin.Y)) * Scale.Height;
2755 RectangleD rf = new RectangleD((PxWmicron * x * Scale.Width + dx), (PxHmicron * y * Scale.Height + dy), (PxWmicron * w * Scale.Width), (PxHmicron * h * Scale.Height));
2756 return rf;
2757 }
2758 }
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 2721 of file ImageView.cs.

2722 {
2723 float x = ToScreenScaleW((float)p.X);
2724 float y = ToScreenScaleH((float)p.Y);
2725 return new PointF(x, y);
2726 }
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 2712 of file ImageView.cs.

2713 {
2714 return (float)(-y * PxHmicron * Scale.Height);
2715 }

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

2704 {
2705 return (float)(-x * PxWmicron * Scale.Width);
2706 }

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

2651 {
2652 RectangleD f = ToScreenRect(x, y, 1, 1);
2653 return new PointD(f.X, f.Y);
2654 }
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 2693 of file ImageView.cs.

2694 {
2695 PointD pd = ToScreenSpace(p.X, p.Y);
2696 return new PointF((float)pd.X, (float)pd.Y);
2697 }
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 2660 of file ImageView.cs.

2661 {
2662 return ToScreenSpace(p.X, p.Y);
2663 }

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

2799 {
2800 PointD[] rs = new PointD[p.Length];
2801 for (int i = 0; i < p.Length; i++)
2802 {
2803 PointD pd = ToScreenSpace(p[i]);
2804 rs[i] = new PointD((float)pd.X, (float)pd.Y);
2805 }
2806 return rs;
2807 }

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

2670 {
2671 PointD pd = ToScreenSpace(p.X, p.Y);
2672 return new PointF((float)pd.X, (float)pd.Y);
2673 }

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

2680 {
2681 PointF[] pf = new PointF[p.Length];
2682 for (int i = 0; i < p.Length; i++)
2683 {
2684 pf[i] = ToScreenSpace(p[i]);
2685 }
2686 return pf;
2687 }

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

2766 {
2767 return ToScreenRect(p.X, p.Y, p.W, p.H);
2768 }

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

2784 {
2785 RectangleD[] rs = new RectangleD[p.Length];
2786 for (int i = 0; i < p.Length; i++)
2787 {
2788 rs[i] = ToScreenSpace(p[i]);
2789 }
2790 return rs;
2791 }

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

2775 {
2776 return ToScreenRect(p.X, p.Y, p.Width, p.Height);
2777 }

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

2814 {
2815 return (float)(x * PxWmicron);
2816 }

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

2635 {
2636 if (SelectedImage != null)
2637 if (SelectedImage.isPyramidal)
2638 {
2639 return d / Resolution;
2640 }
2641 double y = (double)(d / PxHmicron) / scale.Height;
2642 return y;
2643 }

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

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

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

2562 {
2563 if (SelectedImage == null)
2564 {
2565 double dx = (ToViewSizeW(x - (viewStack.AllocatedWidth / 2)) / Scale.Width) - Origin.X;
2566 double dy = (ToViewSizeH(y - (viewStack.AllocatedHeight / 2)) / Scale.Height) - Origin.Y;
2567 return new PointD(dx, dy);
2568 }
2569
2570 if (SelectedImage.isPyramidal)
2571 {
2572 PointD p = new PointD(x / Resolution, y / Resolution);
2573 return new PointD(p.X - PyramidalOrigin.X, p.Y - PyramidalOrigin.Y);
2574 }
2575 else
2576 {
2577 // Handle non-pyramidal case
2578 double dx = (ToViewSizeW(x - (viewStack.AllocatedWidth / 2)) / Scale.Width) - Origin.X;
2579 double dy = (ToViewSizeH(y - (viewStack.AllocatedHeight / 2)) / Scale.Height) - Origin.Y;
2580 return new PointD(dx, dy);
2581 }
2582 }

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

2552 {
2553 return ToViewSpace(p.X, p.Y); ;
2554 }

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

2542 {
2543 PointD d = ToViewSpace(p.X, p.Y);
2544 return new PointF((float)d.X, (float)d.Y);
2545 }

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

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

◆ UpdateGUI()

void BioGTK.ImageView.UpdateGUI ( )

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

Definition at line 1693 of file ImageView.cs.

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

◆ UpdateImage()

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

It updates the image.

Definition at line 785 of file ImageView.cs.

786 {
787 UpdateImages(updatePyramidal);
788 }

◆ UpdateImages()

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

It updates the images.

Definition at line 737 of file ImageView.cs.

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

◆ UpdateStatus()

void BioGTK.ImageView.UpdateStatus ( )

It updates the status of the user.

Definition at line 2023 of file ImageView.cs.

2024 {
2025 if (SelectedImage.Buffers.Count == 0)
2026 return;
2027 if(SelectedImage.Type == BioImage.ImageType.well)
2028 {
2029 statusLabel.Text = (zBar.Value + 1) + "/" + (zBar.Adjustment.Upper + 1) + ", " + (cBar.Value + 1) + "/" + (cBar.Adjustment.Upper + 1) + ", " + (tBar.Value + 1) + "/" + (tBar.Adjustment.Upper + 1) + ", " +
2030 mousePoint + mouseColor + ", " + SelectedImage.Buffers[0].PixelFormat.ToString() + ", (" + SelectedImage.Volume.Location.X.ToString("N2") + ", " + SelectedImage.Volume.Location.Y.ToString("N2") + ") "
2031 + Origin.X.ToString("N2") + "," + Origin.Y.ToString("N2") + " , Well:" + SelectedImage.Level;
2032 }
2033 else
2034 statusLabel.Text = (zBar.Value + 1) + "/" + (zBar.Adjustment.Upper + 1) + ", " + (cBar.Value + 1) + "/" + (cBar.Adjustment.Upper + 1) + ", " + (tBar.Value + 1) + "/" + (tBar.Adjustment.Upper + 1) + ", " +
2035 mousePoint + mouseColor + ", " + SelectedImage.Buffers[0].PixelFormat.ToString() + ", (" + SelectedImage.Volume.Location.X.ToString("N2") + ", " + SelectedImage.Volume.Location.Y.ToString("N2") + ") "
2036 + Origin.X.ToString("N2") + "," + Origin.Y.ToString("N2") + ", Res:" + Resolution;
2037 }

◆ UpdateView()

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

It updates the view.

Definition at line 2039 of file ImageView.cs.

2040 {
2041 if(updateImages)
2042 UpdateImages(true);
2043 refresh = true;
2044 if(update)
2045 sk.QueueDraw();
2046 }

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

◆ endt

int BioGTK.ImageView.endt = 0
static

Definition at line 944 of file ImageView.cs.

◆ endz

int BioGTK.ImageView.endz = 0
static

Definition at line 942 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 1513 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 2061 of file ImageView.cs.

◆ mouseLeftState

bool BioGTK.ImageView.mouseLeftState
static

Definition at line 2060 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 2052 of file ImageView.cs.

◆ showGROIs

bool BioGTK.ImageView.showGROIs = true

Definition at line 2051 of file ImageView.cs.

◆ showRROIs

bool BioGTK.ImageView.showRROIs = true

Definition at line 2050 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 940 of file ImageView.cs.

◆ startt

int BioGTK.ImageView.startt = 0
static

Definition at line 941 of file ImageView.cs.

◆ startz

int BioGTK.ImageView.startz = 0
static

Definition at line 939 of file ImageView.cs.

◆ waitc

int BioGTK.ImageView.waitc = 1000
static

Definition at line 937 of file ImageView.cs.

◆ waitt

int BioGTK.ImageView.waitt = 1000
static

Definition at line 938 of file ImageView.cs.

◆ waitz

int BioGTK.ImageView.waitz = 1000
static

Definition at line 936 of file ImageView.cs.

◆ x1State

bool BioGTK.ImageView.x1State
static

Definition at line 2058 of file ImageView.cs.

◆ x2State

bool BioGTK.ImageView.x2State
static

Definition at line 2059 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 1881 of file ImageView.cs.

1882 {
1883 get
1884 {
1885 return SelectedImage.Channels[SelectedImage.rgbChannels[2]];
1886 }
1887 }

◆ GChannel

Channel BioGTK.ImageView.GChannel
get

Definition at line 1873 of file ImageView.cs.

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

◆ LabelResolution

int? BioGTK.ImageView.LabelResolution
get

Definition at line 804 of file ImageView.cs.

804{ get { return SelectedImage.LabelResolution; } }

◆ Level

int BioGTK.ImageView.Level
getset

Definition at line 1974 of file ImageView.cs.

1975 {
1976 get
1977 {
1978 if(SelectedImage.Type == BioImage.ImageType.well)
1979 {
1980 return (int)SelectedImage.Level;
1981 }
1982 if(SelectedImage.isPyramidal)
1983 if (!openSlide)
1984 l = OpenSlideGTK.TileUtil.GetLevel(_slideBase.Schema.Resolutions, Resolution);
1985 else
1986 l = OpenSlideGTK.TileUtil.GetLevel(_openSlideBase.Schema.Resolutions, Resolution);
1987 return l;
1988 }
1989 set
1990 {
1991 if (value < 0)
1992 return;
1993 l = value;
1994 SelectedImage.Level = l;
1995 if (SelectedImage.Type == BioImage.ImageType.well)
1996 {
1997 SelectedImage.UpdateBuffersWells();
1998 UpdateImages();
1999 UpdateView();
2000 }
2001 }
2002 }

◆ MacroResolution

int? BioGTK.ImageView.MacroResolution
get

Definition at line 803 of file ImageView.cs.

803{ get { return SelectedImage.MacroResolution; } }

◆ Mode

ViewMode BioGTK.ImageView.Mode
getset

Definition at line 1833 of file ImageView.cs.

1834 {
1835 get
1836 {
1837 return viewMode;
1838 }
1839 set
1840 {
1841 viewMode = value;
1842 if (viewMode == ViewMode.RGBImage)
1843 {
1844 rgbStack.VisibleChild = rgbStack.Children[1];
1845 }
1846 else
1847 if (viewMode == ViewMode.Filtered)
1848 {
1849 rgbStack.VisibleChild = rgbStack.Children[0];
1850 }
1851 else
1852 if (viewMode == ViewMode.Raw)
1853 {
1854 rgbStack.VisibleChild = rgbStack.Children[0];
1855 }
1856 else
1857 {
1858 rgbStack.VisibleChild = rgbStack.Children[0];
1859 }
1860 UpdateImage();
1861 UpdateView();
1862 }
1863 }
void UpdateImage(bool updatePyramidal=false)
It updates the image.
Definition ImageView.cs:785

◆ MouseDown

PointD BioGTK.ImageView.MouseDown
getset

Definition at line 2282 of file ImageView.cs.

2283 {
2284 get { return mouseDown; }
2285 set { mouseDown = value; }
2286 }

◆ MouseDownInt

PointD BioGTK.ImageView.MouseDownInt
getset

Definition at line 2267 of file ImageView.cs.

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

◆ MouseMove

PointD BioGTK.ImageView.MouseMove
getset

Definition at line 2292 of file ImageView.cs.

2293 {
2294 get { return mouseMove; }
2295 set { mouseMove = value; }
2296 }

◆ MouseMoveInt

PointD BioGTK.ImageView.MouseMoveInt
getset

Definition at line 2272 of file ImageView.cs.

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

◆ MouseUp

PointD BioGTK.ImageView.MouseUp
getset

Definition at line 2287 of file ImageView.cs.

2288 {
2289 get { return mouseUp; }
2290 set { mouseUp = value; }
2291 }

◆ MouseUpInt

PointD BioGTK.ImageView.MouseUpInt
getset

Definition at line 2277 of file ImageView.cs.

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

◆ OpenSlide

bool BioGTK.ImageView.OpenSlide
getset

Definition at line 1811 of file ImageView.cs.

1812 {
1813 get { return openSlide; }
1814 set { openSlide = value; }
1815 }

◆ Origin

PointD BioGTK.ImageView.Origin
getset

Definition at line 1890 of file ImageView.cs.

1891 {
1892 get { return origin; }
1893 set
1894 {
1895 if(AllowNavigation)
1896 origin = value;
1897 UpdateView(true, false);
1898 }
1899 }

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

1915 {
1916 get
1917 {
1918 return SelectedImage.PyramidalOrigin;
1919 }
1920 set
1921 {
1922 if (!AllowNavigation)
1923 return;
1924 PointD p = new PointD();
1925 if (value.X > 0)
1926 p.X = value.X;
1927 if (value.Y > 0)
1928 p.Y = value.Y;
1929 SelectedImage.PyramidalOrigin = p;
1930 UpdateView(true, true);
1931 }
1932 }

◆ PyramidalOriginTransformed

PointD BioGTK.ImageView.PyramidalOriginTransformed
getset

Definition at line 1908 of file ImageView.cs.

1909 {
1910 get { return new PointD(PyramidalOrigin.X * Resolution, PyramidalOrigin.Y * Resolution); }
1911 set { PyramidalOrigin = new PointD(value.X / Resolution, value.Y / Resolution); }
1912 }

◆ RChannel

Channel BioGTK.ImageView.RChannel
get

Definition at line 1865 of file ImageView.cs.

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

◆ Resolution

double BioGTK.ImageView.Resolution
getset

Definition at line 1935 of file ImageView.cs.

1936 {
1937 get
1938 {
1939 return SelectedImage.Resolution;
1940 }
1941 set
1942 {
1943 if (SelectedImage.Type == BioImage.ImageType.well)
1944 {
1945 SelectedImage.Resolution = value;
1946
1947 return;
1948 }
1949
1950 // Calculate the scaling factor based on the new and current resolution
1951 double scalingFactor = value / SelectedImage.Resolution;
1952
1953 // Convert the screen coordinates of the mouse position to image coordinates
1954 PointD imageMousePosition = new PointD(
1955 (PyramidalOrigin.X / scalingFactor),
1956 (PyramidalOrigin.Y / scalingFactor)
1957 );
1958
1959 // Calculate the mouse position in viewport space (center of viewport)
1960 PointD viewportCenter = new PointD(
1961 SelectedImage.PyramidalSize.Width / 2,
1962 SelectedImage.PyramidalSize.Height / 2
1963 );
1964 // Update the resolution
1965
1966 // Calculate new PyramidalOrigin so that the image stays centered on the middle
1967 PyramidalOrigin = new PointD(
1968 imageMousePosition.X - (viewportCenter.X * (scalingFactor - 1)),
1969 imageMousePosition.Y - (viewportCenter.Y * (scalingFactor - 1))
1970 );
1971 }
1972 }

◆ Scale

SizeF BioGTK.ImageView.Scale
getset

Definition at line 2006 of file ImageView.cs.

2007 {
2008 get
2009 {
2010 return scale;
2011 }
2012 set
2013 {
2014 scale = value;
2015 // update ui on main UI thread
2016 Application.Invoke(delegate
2017 {
2018 UpdateView(true,false);
2019 });
2020 }
2021 }

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

1817 {
1818 get
1819 {
1820 if (App.viewer == null)
1821 return null;
1822 if(App.viewer.Images.Count == 0)
1823 return null;
1824 return App.viewer.Images[App.viewer.SelectedIndex];
1825 }
1826 set
1827 {
1828 App.viewer.Images[App.viewer.SelectedIndex] = value;
1829 }
1830 }

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

794 {
795 get { return showOverview; }
796 set
797 {
798 showOverview = value;
799 UpdateView();
800 }
801 }

◆ TopRightOrigin

PointD BioGTK.ImageView.TopRightOrigin
get

Definition at line 1901 of file ImageView.cs.

1902 {
1903 get
1904 {
1905 return new PointD((Origin.X - ((sk.AllocatedWidth / 2) * pxWmicron)), (Origin.Y - ((sk.AllocatedHeight / 2) * pxHmicron)));
1906 }
1907 }

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