BioGTK 3.8.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package BioGTK --version 3.8.1
NuGet\Install-Package BioGTK -Version 3.8.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BioGTK" Version="3.8.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BioGTK --version 3.8.1
#r "nuget: BioGTK, 3.8.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install BioGTK as a Cake Addin
#addin nuget:?package=BioGTK&version=3.8.1

// Install BioGTK as a Cake Tool
#tool nuget:?package=BioGTK&version=3.8.1

BioGTK

alt text

A .NET application & library for editing & annotating various microscopy image formats. Supports all bioformats supported images. Integrates with ImageJ, running ImageJ filters & macro functions. Check out the wiki for library usage. or check out the documentation. Supports Windows, Linux and Mac. For Windows & Mac see installation instructions. For Discussion check out the new Discord Server. https://discord.gg/tdeyc6fgpv

NuGet version (BioGTK) NuGet version (BioGTK) DOI

Features

  • C# scripting with sample tool-script and other sample scripts in "/Scripts/" folder. See samples

  • Supports running ImageJ macro commands on images open in Bio. Console to run ImageJ macro commands and Bio C# scripts.

  • Supports viewing & creating pyramidal images with multiple resolutions. Like whole slide images.

  • Stitch images at varying resolutions into single pyramidal image with multiple resolutions.

  • Multiple view modes like Emission, and Filtered. ROI's shown for each channel can be configured in ROI Manager.

  • Supports drawing shapes & colors onto 16 bit & 48 bit images, unlike System.Drawing.Graphics.

  • Convenient viewing of image stacks with scroll wheel moving Z-plane and mouse side buttons scrolling C-planes.

  • Editing & saving ROI's in images to OME format image stacks.

  • Copy & Paste to quickly annotate images and name them easily by right click.

  • Select multiple points by holding down control key, and move them by holding down control key.

  • Exporting ROI's from each OME image in a folder of images to CSV.

  • Easy segmentation with Segment Anything (SAM). Required model files downloadable from Releases.

Dependencies

Licenses

Scripting

  • Save scripts into "StartupPath/Scripts" with ".cs" ending.
  • Open script editor and recorder from menu.
  • Scripts saved in Scripts folder will be loaded into script runner.
  • Use Script recorder to record program function calls and script runner to turn recorder text into working scripts. (See sample scripts

Mac Installation

  • Install Mac package manager homebrew.
  • From brew install GTK3.
  • Download the BioGTK application for either OSX-x64 or OSX-Arm from releases.
  • Make the file executable by opening terminal in the extracted folder and running "chmod 755 BioGTKApp"
  • Optionally install LibVips package for whole-slide support with homebrew.
  • Optionally install Onnx Runtime by running "brew install onnxruntime" for running SAM.

Windows Installation

  • Install package manager MSYS2. to install package GTK3. (Required for GTK Apps.)
  • Download the BioGTK Windows installer from releases.
  • Optionally install LibVips for increased performance when opening pyramidal images. Make sure to define environmental variable $VIPS_HOME as instructed here.

Linux Installation

  • Just download the latest tarball(tar.gz) from Releases as linux already includes GTK3 package.
  • Optionally install LibVips for increased performance when opening pyramidal images.

Usage

//First you need to setup your project as a GTK project with .NET 6.0 as the target. 
//Then in between Gtk.Application.Init() and Gtk.Application.Run() use the library as you please.
//Here is an example from BioGTKApp program.cs.

Console.WriteLine("Initializing GTK.");
Gtk.Application.Init();
Console.WriteLine("Creating NodeView.");
BioGTK.NodeView node = BioGTK.NodeView.Create(args);
node.Show();
Gtk.Application.Run();


//If you want to initialize the application call app initialize. 
//This will initialize Bioformats library as well as the rest of the application.
App.Initialize();

//Or you can create a new NodeView which will initialize the application
//as well as parse any command line arguments.
NodeView nodes = NodeView.Create(new string[]{"file"});

//You can also call BioImage.Initialize to 
//initialize just the Bioformats library.
BioImage.Initialize();

//Once initialized you can open OME, ImageJ tiff files, and Bio Tiff files with:
BioImage b = BioImage.OpenFile("file");

//Or if you want to use specifically the OME image reader you can use BioImage.OpenOME
BioImage b = BioImage.OpenOME("file");

//If you are working with a pyramidal image you can open a portion of a tiled image with OpenOME.
//BioImage.OpenOME(string file, int serie, bool tab, bool addToImages, bool tile, int tilex, int tiley, int tileSizeX, int tileSizeY)

//You can specify whether to open in a newtab as well as whether to add the image to 
//the Images.images table. As well as specify whether to open as a tile with the specified 
//tile X,Y position & tile width & height.    
BioImage.OpenOME("file",0,false,false,true,0,0,600,600);
//This will open a portion of the image as a tile and won't add it to the Images table.

//Once you have opened a tiled image with BioImage.OpenOME you can call the 
//GetTile(BioImage b, ZCT coord, int serie, int tilex, int tiley, int tileSizeX, int tileSizeY) method
// to quickly get another tile from different portion of the image. For BioGTK & BioLib
Bitmap bm = GetTile(b, new ZCT(0,0,0), 0, 100, 100, 600, 600);

//You can display an image with the ImageView control which can display
// Pyramidal, Whole-Slide, and Series of images.
ImageView v = ImageView.Create(b);

//To get the current coordinate of the ImageView you can call GetCoordinate.
ZCT cord = v.GetCoordinate();
//or to set the current coordinate
v.SetCoordinate(new ZCT(1,1,1));

//To create a point as well as any other ROI type you can call the ROI create methods.
ROI p = ROI.CreatePoint(cord, 0, 0);
ROI rect = ROI.CreateRectangle(cord, 0, 0, 100, 100);

//Usage of Graphics class for 16 & 48 bit images as well as regular bit depth images
//is very similar to System.Graphics.
//We create a new Graphics object by passing the Bitmap for BioGTK & BioLib and BufferInfo for BioCore
Graphics g = Graphics.FromImage(b.Buffers[0]);

//Then we create a pen by passing a ColorS which represent a Color with, 
//a higher bit depth (unsigned short) rather than a byte.
g.pen = new Pen(new ColorS(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue));

//Then we can call the familiar methods DrawLine, DrawPolygon, FillPolygon etc.
g.DrawLine(0,0,100,100);
//Finally we dispose the Graphics object.
g.Dispose();

//Then to update the image in the viewer once we have made changes to the image we call:
v.UpdateImage();
//This will update the images of the viewer in the current coordinate plane.
v.UpdateView();

//We can also save the resulting image given the ID of the image in the Images table.
//All images opened with BioImage.OpenFile or BioImage.OpenOME are added to the 
//Images.images table with the filename as an ID.
BioImage.SaveFile("file","path");

//To convert between different pixel formats we can call for example To24Bit.
b.To24Bit();

Sample Tool Script

//css_reference BioGTK.dll; 
using System; 
using BioGTK;
using System.Threading;
using AForge;
public class Loader {

//Point ROI Tool Example
public string Load()
{
	int ind = 1;
	do
	{
		BioGTK.Scripting.State s = BioGTK.Scripting.GetState();
		if (s != null)
		{
			if (!s.processed)
			{
				if (s.type == BioGTK.Scripting.Event.Down && s.buts == 1)
				{
					ZCT cord = BioGTK.App.viewer.GetCoordinate();
					BioGTK.Scripting.LogLine(cord.ToString() + " Coordinate");
					BioGTK.ROI an = BioGTK.ROI.CreatePoint(cord, s.p.X, s.p.Y);
					BioGTK.ImageView.SelectedImage.Annotations.Add(an);
					BioGTK.Scripting.LogLine(cord.ToString() + " Coordinate");
					an.Text = "Point" + ind;
					ind++;
					BioGTK.Scripting.LogLine(s.ToString() + " Point");
					//ImageView.viewer.UpdateOverlay();
				}
				else
				if (s.type == BioGTK.Scripting.Event.Up)
				{
					BioGTK.Scripting.LogLine(s.ToString());
				}
				else
				if (s.type == BioGTK.Scripting.Event.Move)
				{
					BioGTK.Scripting.LogLine(s.ToString());
				}
				s.processed = true;
			}
		}
		if(BioGTK.Scripting.Exit("points.cs"))
		{	
			return "OK";
		}
	} while (true);
	return "OK";
}
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.6.0 62 2/19/2024
4.5.2 76 2/17/2024
4.5.1 79 2/15/2024
4.5.0 84 2/13/2024
4.4.0 74 2/10/2024
4.3.0 67 2/2/2024
4.2.0 104 1/14/2024
4.1.0 127 1/4/2024
4.0.0 110 12/26/2023
3.9.1 102 12/2/2023
3.9.0 87 12/1/2023
3.8.1 111 11/8/2023
3.8.0 83 11/2/2023
3.7.1 199 10/26/2023
3.7.0 223 10/22/2023
3.6.2 213 8/30/2023
3.6.1 217 8/22/2023
3.6.0 269 8/19/2023
3.5.3 189 8/17/2023
3.5.1 237 8/12/2023
3.5.0 365 8/10/2023
3.4.0 255 8/6/2023
3.3.3 319 8/4/2023
3.3.2 272 8/1/2023
3.3.1 301 7/6/2023
3.3.0 262 7/4/2023
3.2.0 293 6/29/2023
3.1.1 223 6/28/2023
3.0.0 220 6/20/2023
2.9.0 239 6/13/2023
2.8.0 189 5/15/2023
2.7.2 227 5/5/2023
2.7.1 247 4/29/2023
2.7.0 232 4/29/2023
2.6.2 400 4/3/2023
2.6.1 363 4/1/2023
2.6.0 365 3/12/2023
2.5.0 397 3/7/2023
2.4.1 334 3/4/2023
2.4.0 449 2/28/2023
2.3.0 421 2/27/2023
2.2.0 219 2/23/2023
2.1.1 197 2/17/2023
2.1.0 213 2/15/2023
1.2.0 252 1/31/2023
1.1.0 236 1/29/2023
1.0.0 241 1/29/2023

Added missing glade files & images to nuget package.