BioLib  3.9.1
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.
2510 {
2511 ImageJ = "";
2512 images = b.ImageCount;
2513 channels = b.SizeC;
2514 slices = b.SizeZ;
2515 frames = b.SizeT;
2516 hyperstack = true;
2517 mode = "grayscale";
2518 unit = "micron";
2519 finterval = b.frameInterval;
2520 spacing = b.PhysicalSizeZ;
2521 loop = false;
2522 /*
2523 double dmax = double.MinValue;
2524 double dmin = double.MaxValue;
2525 foreach (Channel c in b.Channels)
2526 {
2527 if(dmax < c.Max)
2528 dmax = c.Max;
2529 if(dmin > c.Min)
2530 dmin = c.Min;
2531 }
2532 min = dmin;
2533 max = dmax;
2534 */
2535 min = b.Channels[0].RangeR.Min;
2536 max = b.Channels[0].RangeR.Max;
2537 return this;
2538 }

◆ 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.
2543 {
2544 string s = "";
2545 s += "ImageJ=" + ImageJ + "\n";
2546 s += "images=" + images + "\n";
2547 s += "channels=" + channels.ToString() + "\n";
2548 s += "slices=" + slices.ToString() + "\n";
2549 s += "frames=" + frames.ToString() + "\n";
2550 s += "hyperstack=" + hyperstack.ToString() + "\n";
2551 s += "mode=" + mode.ToString() + "\n";
2552 s += "unit=" + unit.ToString() + "\n";
2553 s += "finterval=" + finterval.ToString() + "\n";
2554 s += "spacing=" + spacing.ToString() + "\n";
2555 s += "loop=" + loop.ToString() + "\n";
2556 s += "min=" + min.ToString() + "\n";
2557 s += "max=" + max.ToString() + "\n";
2558 return s;
2559 }

◆ SetString()

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

It sets the string to the value of the parameter.

Parameters
descThe description of the string.
2564 {
2565 string[] lines = desc.Split(new string[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
2566 int maxlen = 20;
2567 for (int i = 0; i < lines.Length; i++)
2568 {
2569 if (i < maxlen)
2570 {
2571 string[] sp = lines[i].Split('=');
2572 if (sp[0] == "ImageJ")
2573 ImageJ = sp[1];
2574 if (sp[0] == "images")
2575 images = int.Parse(sp[1], CultureInfo.InvariantCulture);
2576 if (sp[0] == "channels")
2577 channels = int.Parse(sp[1], CultureInfo.InvariantCulture);
2578 if (sp[0] == "slices")
2579 slices = int.Parse(sp[1], CultureInfo.InvariantCulture);
2580 if (sp[0] == "frames")
2581 frames = int.Parse(sp[1], CultureInfo.InvariantCulture);
2582 if (sp[0] == "hyperstack")
2583 hyperstack = bool.Parse(sp[1]);
2584 if (sp[0] == "mode")
2585 mode = sp[1];
2586 if (sp[0] == "unit")
2587 unit = sp[1];
2588 if (sp[0] == "finterval")
2589 finterval = double.Parse(sp[1], CultureInfo.InvariantCulture);
2590 if (sp[0] == "spacing")
2591 spacing = double.Parse(sp[1], CultureInfo.InvariantCulture);
2592 if (sp[0] == "loop")
2593 loop = bool.Parse(sp[1]);
2594 if (sp[0] == "min")
2595 min = double.Parse(sp[1], CultureInfo.InvariantCulture);
2596 if (sp[0] == "max")
2597 max = double.Parse(sp[1], CultureInfo.InvariantCulture);
2598 if (sp[0] == "8bitcolor")
2599 bit8color = bool.Parse(sp[1]);
2600 }
2601 else
2602 return;
2603 }
2604
2605 }

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