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

Static Public Member Functions

static Bitmap PixbufToBitmap (Pixbuf pixbuf)
 

Public Attributes

List< omero.gateway.model.DatasetData > datas = new List<omero.gateway.model.DatasetData>()
 
int selectedIndex = 0
 

Protected Member Functions

override void Dispose (bool disposing)
 Clean up any resources being used.
 

Properties

int Progress [get, set]
 
string Status [get, set]
 

Detailed Description

Definition at line 3 of file OMERO.Designer.cs.

Constructor & Destructor Documentation

◆ OMERO()

BioImager.OMERO.OMERO ( )

Definition at line 42 of file OMERO.cs.

43 {
44 InitializeComponent();
45 Login log = new Login();
46 if (log.ShowDialog() == DialogResult.OK)
47 {
48 BioLib.OMERO.Connect(Login.host, Login.port, Login.username, Login.password);
49 Init();
50 }
51 }

Member Function Documentation

◆ Dispose()

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

Clean up any resources being used.

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

Definition at line 14 of file OMERO.Designer.cs.

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

◆ PixbufToBitmap()

static Bitmap BioImager.OMERO.PixbufToBitmap ( Pixbuf pixbuf)
static

Definition at line 140 of file OMERO.cs.

141 {
142 if (pixbuf == null)
143 throw new ArgumentNullException(nameof(pixbuf), "Pixbuf cannot be null.");
144
145 // Get Pixbuf properties
146 int width = pixbuf.Width;
147 int height = pixbuf.Height;
148 int rowstride = pixbuf.Rowstride;
149 bool hasAlpha = pixbuf.HasAlpha;
150 byte[] pixelData = pixbuf.PixelBytes.Data;
151
152 // Create a Bitmap
153 PixelFormat pixelFormat = hasAlpha ? PixelFormat.Format32bppArgb : PixelFormat.Format24bppRgb;
154 Bitmap bitmap = new Bitmap(width, height, pixelFormat);
155
156 // Lock the Bitmap's data
157 BitmapData bmpData = bitmap.LockBits(
158 new Rectangle(0, 0, width, height),
159 ImageLockMode.WriteOnly,
160 pixelFormat);
161
162 // Copy pixel data
163 IntPtr bmpPtr = bmpData.Scan0;
164 unsafe
165 {
166 byte* srcPtr = (byte*)pixbuf.Pixels;
167 byte* destPtr = (byte*)bmpPtr;
168
169 for (int y = 0; y < height; y++)
170 {
171 byte* srcRow = srcPtr + y * rowstride;
172 byte* destRow = destPtr + y * bmpData.Stride;
173
174 if (hasAlpha)
175 {
176 for (int x = 0; x < width; x++)
177 {
178 destRow[x * 4 + 0] = srcRow[x * 4 + 2]; // B
179 destRow[x * 4 + 1] = srcRow[x * 4 + 1]; // G
180 destRow[x * 4 + 2] = srcRow[x * 4 + 0]; // R
181 destRow[x * 4 + 3] = srcRow[x * 4 + 3]; // A
182 }
183 }
184 else
185 {
186 for (int x = 0; x < width; x++)
187 {
188 destRow[x * 3 + 0] = srcRow[x * 3 + 2]; // B
189 destRow[x * 3 + 1] = srcRow[x * 3 + 1]; // G
190 destRow[x * 3 + 2] = srcRow[x * 3 + 0]; // R
191 }
192 }
193 }
194 }
195
196 // Unlock and return the Bitmap
197 bitmap.UnlockBits(bmpData);
198 return bitmap;
199 }

Member Data Documentation

◆ datas

List<omero.gateway.model.DatasetData> BioImager.OMERO.datas = new List<omero.gateway.model.DatasetData>()

Definition at line 22 of file OMERO.cs.

◆ selectedIndex

int BioImager.OMERO.selectedIndex = 0

Definition at line 24 of file OMERO.cs.

Property Documentation

◆ Progress

int BioImager.OMERO.Progress
getset

Definition at line 26 of file OMERO.cs.

27 {
28 get { return progressBar.Value; }
29 set
30 {
31 if(value < 100)
32 progressBar.Value = value;
33
34 }
35 }

◆ Status

string BioImager.OMERO.Status
getset

Definition at line 37 of file OMERO.cs.

38 {
39 get { return statusLabel.Text; }
40 set { statusLabel.Text = value; }
41 }

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