BioLib  4.1.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.
2766 {
2767 ImageJ = "";
2768 images = b.ImageCount;
2769 channels = b.SizeC;
2770 slices = b.SizeZ;
2771 frames = b.SizeT;
2772 hyperstack = true;
2773 mode = "grayscale";
2774 unit = "micron";
2775 finterval = b.frameInterval;
2776 spacing = b.PhysicalSizeZ;
2777 loop = false;
2778 /*
2779 double dmax = double.MinValue;
2780 double dmin = double.MaxValue;
2781 foreach (Channel c in b.Channels)
2782 {
2783 if(dmax < c.Max)
2784 dmax = c.Max;
2785 if(dmin > c.Min)
2786 dmin = c.Min;
2787 }
2788 min = dmin;
2789 max = dmax;
2790 */
2791 min = b.Channels[0].RangeR.Min;
2792 max = b.Channels[0].RangeR.Max;
2793 return this;
2794 }

◆ 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.
2799 {
2800 string s = "";
2801 s += "ImageJ=" + ImageJ + "\n";
2802 s += "images=" + images + "\n";
2803 s += "channels=" + channels.ToString() + "\n";
2804 s += "slices=" + slices.ToString() + "\n";
2805 s += "frames=" + frames.ToString() + "\n";
2806 s += "hyperstack=" + hyperstack.ToString() + "\n";
2807 s += "mode=" + mode.ToString() + "\n";
2808 s += "unit=" + unit.ToString() + "\n";
2809 s += "finterval=" + finterval.ToString() + "\n";
2810 s += "spacing=" + spacing.ToString() + "\n";
2811 s += "loop=" + loop.ToString() + "\n";
2812 s += "min=" + min.ToString() + "\n";
2813 s += "max=" + max.ToString() + "\n";
2814 return s;
2815 }

◆ SetString()

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

It sets the string to the value of the parameter.

Parameters
descThe description of the string.
2820 {
2821 string[] lines = desc.Split(new string[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
2822 int maxlen = 20;
2823 for (int i = 0; i < lines.Length; i++)
2824 {
2825 if (i < maxlen)
2826 {
2827 string[] sp = lines[i].Split('=');
2828 if (sp[0] == "ImageJ")
2829 ImageJ = sp[1];
2830 if (sp[0] == "images")
2831 images = int.Parse(sp[1], CultureInfo.InvariantCulture);
2832 if (sp[0] == "channels")
2833 channels = int.Parse(sp[1], CultureInfo.InvariantCulture);
2834 if (sp[0] == "slices")
2835 slices = int.Parse(sp[1], CultureInfo.InvariantCulture);
2836 if (sp[0] == "frames")
2837 frames = int.Parse(sp[1], CultureInfo.InvariantCulture);
2838 if (sp[0] == "hyperstack")
2839 hyperstack = bool.Parse(sp[1]);
2840 if (sp[0] == "mode")
2841 mode = sp[1];
2842 if (sp[0] == "unit")
2843 unit = sp[1];
2844 if (sp[0] == "finterval")
2845 finterval = double.Parse(sp[1], CultureInfo.InvariantCulture);
2846 if (sp[0] == "spacing")
2847 spacing = double.Parse(sp[1], CultureInfo.InvariantCulture);
2848 if (sp[0] == "loop")
2849 loop = bool.Parse(sp[1]);
2850 if (sp[0] == "min")
2851 min = double.Parse(sp[1], CultureInfo.InvariantCulture);
2852 if (sp[0] == "max")
2853 max = double.Parse(sp[1], CultureInfo.InvariantCulture);
2854 if (sp[0] == "8bitcolor")
2855 bit8color = bool.Parse(sp[1]);
2856 }
2857 else
2858 return;
2859 }
2860
2861 }

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