BioLib  3.7.0
A GUI-less version of Bio .NET library for editing & annotating various microscopy image formats.
Loading...
Searching...
No Matches
BioLib.BioImage.ImageJDesc Class Reference

Public Member Functions

ImageJDesc FromImage (BioImage b)
 
string GetString ()
 
void SetString (string desc)
 

Public Attributes

string ImageJ
 
int images = 0
 
int channels = 0
 
int slices = 0
 
int frames = 0
 
bool hyperstack
 
string mode
 
string unit
 
double finterval = 0
 
double spacing = 0
 
bool loop
 
double min = 0
 
double max = 0
 
int count
 
bool bit8color = false
 

Member Function Documentation

◆ FromImage()

ImageJDesc BioLib.BioImage.ImageJDesc.FromImage ( BioImage b)

The function "FromImage" takes a BioImage object and sets the properties of an ImageJDesc object based on the properties of the BioImage object.

Parameters
BioImageThe BioImage parameter represents an object that contains information about a biological image, such as the number of images, channels, slices, and frames, as well as other properties like frame interval, physical size, and channel ranges.
Returns
The method is returning an instance of the ImageJDesc class.
2444 {
2445 ImageJ = "";
2446 images = b.ImageCount;
2447 channels = b.SizeC;
2448 slices = b.SizeZ;
2449 frames = b.SizeT;
2450 hyperstack = true;
2451 mode = "grayscale";
2452 unit = "micron";
2453 finterval = b.frameInterval;
2454 spacing = b.PhysicalSizeZ;
2455 loop = false;
2456 /*
2457 double dmax = double.MinValue;
2458 double dmin = double.MaxValue;
2459 foreach (Channel c in b.Channels)
2460 {
2461 if(dmax < c.Max)
2462 dmax = c.Max;
2463 if(dmin > c.Min)
2464 dmin = c.Min;
2465 }
2466 min = dmin;
2467 max = dmax;
2468 */
2469 min = b.Channels[0].RangeR.Min;
2470 max = b.Channels[0].RangeR.Max;
2471 return this;
2472 }

◆ GetString()

string BioLib.BioImage.ImageJDesc.GetString ( )

It returns a string that contains the values of all the variables in the imagej image

Returns
A string representation of the imagej image data.
2477 {
2478 string s = "";
2479 s += "ImageJ=" + ImageJ + "\n";
2480 s += "images=" + images + "\n";
2481 s += "channels=" + channels.ToString() + "\n";
2482 s += "slices=" + slices.ToString() + "\n";
2483 s += "frames=" + frames.ToString() + "\n";
2484 s += "hyperstack=" + hyperstack.ToString() + "\n";
2485 s += "mode=" + mode.ToString() + "\n";
2486 s += "unit=" + unit.ToString() + "\n";
2487 s += "finterval=" + finterval.ToString() + "\n";
2488 s += "spacing=" + spacing.ToString() + "\n";
2489 s += "loop=" + loop.ToString() + "\n";
2490 s += "min=" + min.ToString() + "\n";
2491 s += "max=" + max.ToString() + "\n";
2492 return s;
2493 }

◆ SetString()

void BioLib.BioImage.ImageJDesc.SetString ( string desc)

It sets the string to the value of the parameter.

Parameters
descThe description of the string.
2498 {
2499 string[] lines = desc.Split(new string[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
2500 int maxlen = 20;
2501 for (int i = 0; i < lines.Length; i++)
2502 {
2503 if (i < maxlen)
2504 {
2505 string[] sp = lines[i].Split('=');
2506 if (sp[0] == "ImageJ")
2507 ImageJ = sp[1];
2508 if (sp[0] == "images")
2509 images = int.Parse(sp[1], CultureInfo.InvariantCulture);
2510 if (sp[0] == "channels")
2511 channels = int.Parse(sp[1], CultureInfo.InvariantCulture);
2512 if (sp[0] == "slices")
2513 slices = int.Parse(sp[1], CultureInfo.InvariantCulture);
2514 if (sp[0] == "frames")
2515 frames = int.Parse(sp[1], CultureInfo.InvariantCulture);
2516 if (sp[0] == "hyperstack")
2517 hyperstack = bool.Parse(sp[1]);
2518 if (sp[0] == "mode")
2519 mode = sp[1];
2520 if (sp[0] == "unit")
2521 unit = sp[1];
2522 if (sp[0] == "finterval")
2523 finterval = double.Parse(sp[1], CultureInfo.InvariantCulture);
2524 if (sp[0] == "spacing")
2525 spacing = double.Parse(sp[1], CultureInfo.InvariantCulture);
2526 if (sp[0] == "loop")
2527 loop = bool.Parse(sp[1]);
2528 if (sp[0] == "min")
2529 min = double.Parse(sp[1], CultureInfo.InvariantCulture);
2530 if (sp[0] == "max")
2531 max = double.Parse(sp[1], CultureInfo.InvariantCulture);
2532 if (sp[0] == "8bitcolor")
2533 bit8color = bool.Parse(sp[1]);
2534 }
2535 else
2536 return;
2537 }
2538
2539 }

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