SkillAgentSearch skills...

BioGTK

A cross platform version of Bio library & program. Bio is a library & program for annotating, & editing various microscopy imaging formats using Bioformats supported images. including whole slide, pyramidal & series.

Install / Use

/learn @BiologyTools/BioGTK

README

BioGTK

BioGTK

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.

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 2 (SAM-2) or Micro-SAM. Download required model files from here for SAM-2. and here for Micro-SAM placing them in the "StartUpPath" folder of the program.

Dependencies

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

Plugins

  • Save plugin DLL's into "StartupPath/Plugins"
  • Add plugins from Github repositories by clicking Update and add the url of the repository which you want to add.
  • See example plugin to create your own plugins.
  • Add the BioGTK plugin repository "https://github.com/BiologyTools/BioGTK-Plugins" to your updater list.

Models

  • Save models into "StartupPath/Models" supports BioImage.IO models.
  • Supports ONNX (".onnx") and PyTorch models (".pt"). For PyTorch models include the ".yaml" metadata file with the same name as the model file in the models folder.

.NET Runtime Install

  • First intall .NET 10 runtime from here.

Mac installation,

  • See this video or follow the instructions below.
  • Install Mac package manager homebrew.
  • From brew install GTK3.
  • Download the BioGTK application for either OSX-x64 or OSX-Arm from releases.
  • Make the .app bundle executable by opening terminal in the Contents/MacOS folder then run "chmod 755 BioGTKApp" then drag it into the applications folder.
  • Then run xattr -dr com.apple.quarantine /Applications/BioGTK.app to remove Apple quarantine.
  • Optionally install OpenSlide for better navigation of whole-slide-images.
  • Optionally install LibVips for increased performance and functions with whole-slide-images.
  • Optionally for SAM install ONNX Runtime by running "brew install onnxruntime".

Windows Installation

  • See this video or follow the instructions below.
  • Install package manager MSYS2. to install package GTK3. (Required for GTK Apps.)
  • Download the BioGTK Windows installer from releases.
  • Optionally install OpenSlide for better navigation of whole-slide-images. Be sure to set the PATH variable correctly.
  • Optionally install CUDA for hardware accelerated stitching as well as tile cache in graphics card memory instead of RAM.
  • Optionally install PyTorch for running BioImage.io models.

Linux Installation

  • See this video or follow the instructions below.
  • Download the latest tarball(tar.gz) from Releases as linux already includes GTK3 package.
  • Extract the tarball and go to the "Glade" folder and select all the glade files and change permissions to read-write.
  • Optionally install LibVips for increased performance and functions with whole-slide-images.
  • Optionally install OpenSlide for better navigation of whole-slide-images. By running each line below as sudo. sudo apt install software-properties-common sudo add-apt-repository ppa:openslide/openslide sudo apt install openslide-tools
  • Optionally install CUDA for hardware accelerated stitching as well as tile cache in graphics card memory instead of RAM.
  • Optionally install PyTorch for running BioImage.io models.

Examples

First you need to setup your project as a GTK project with .NET 8.0 as the target. Then in between Gtk.Application.Init() and Gtk.Application.Run() use the library as you please. Here is an example for opening a new NodeView 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();

Another example on how to open an image with a new ImageView

Gtk.Application.Init();
//Since we will be using the GUI we call App.Initialize();
App.Initialize();
BioImage bm = BioImage.OpenFile("F:\\TESTIMAGES\\CZI\\16Bit-ZStack.czi");
ImageView v = ImageView.Create(bm);
v.Show();
Gtk.Application.Run();

Usage

//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 til

Related Skills

View on GitHub
GitHub Stars14
CategoryCustomer
Updated4h ago
Forks2

Languages

C#

Security Score

95/100

Audited on Mar 30, 2026

No findings