{"id":21022442,"url":"https://github.com/biologytools/biogtk","last_synced_at":"2025-05-15T08:32:35.294Z","repository":{"id":65556993,"uuid":"593492439","full_name":"BiologyTools/BioGTK","owner":"BiologyTools","description":"A cross platform version of Bio library \u0026 program. Bio is a library \u0026 program for annotating, \u0026 editing various microscopy imaging formats using Bioformats supported images. including whole slide, pyramidal \u0026 series.","archived":false,"fork":false,"pushed_at":"2025-01-21T16:11:26.000Z","size":153302,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-05T06:41:39.721Z","etag":null,"topics":["bio-formats","biology","cross-platform","geojson","gtk","image-stacks","imagej","imagej-roi","imagej-tiff","microscopy","omero","openslide","plugins","qupath","roi","sam-2","segment-anything","segment-anything-model","whole-slide-image"],"latest_commit_sha":null,"homepage":"https://github.com/BiologyTools/BioGTK","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BiologyTools.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-26T05:58:12.000Z","updated_at":"2025-04-13T11:45:19.000Z","dependencies_parsed_at":"2023-04-09T11:02:11.897Z","dependency_job_id":"44343e12-81e2-49eb-b543-d9e69e4fe330","html_url":"https://github.com/BiologyTools/BioGTK","commit_stats":{"total_commits":158,"total_committers":2,"mean_commits":79.0,"dds":"0.13291139240506333","last_synced_commit":"8b6477e088272b7922bc8921f03afec4a52fec5f"},"previous_names":[],"tags_count":60,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BiologyTools%2FBioGTK","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BiologyTools%2FBioGTK/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BiologyTools%2FBioGTK/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BiologyTools%2FBioGTK/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BiologyTools","download_url":"https://codeload.github.com/BiologyTools/BioGTK/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254304643,"owners_count":22048446,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bio-formats","biology","cross-platform","geojson","gtk","image-stacks","imagej","imagej-roi","imagej-tiff","microscopy","omero","openslide","plugins","qupath","roi","sam-2","segment-anything","segment-anything-model","whole-slide-image"],"created_at":"2024-11-19T11:11:59.109Z","updated_at":"2025-05-15T08:32:30.246Z","avatar_url":"https://github.com/BiologyTools.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BioGTK\n![BioGTK](https://github.com/BiologyTools/Bio/blob/master/banner.jpg)\n\nA .NET application \u0026 library for editing \u0026 annotating various microscopy image formats. Supports all bioformats supported images. Integrates with ImageJ, running ImageJ filters \u0026 macro functions. Check out the wiki for [library usage.](https://github.com/BiologyTools/BioGTK/#Usage) or check out the [documentation.](https://biologytools.github.io/) Supports Windows, Linux and Mac. For Windows \u0026 Mac see installation instructions. For Discussion check out the new Discord Server. https://discord.gg/tdeyc6fgpv\n\n[![NuGet version (BioGTK)](https://img.shields.io/nuget/v/BioGTK.svg?style=flat-square)](https://www.nuget.org/packages/BioGTK/3.9.0)\n[![NuGet version (BioGTK)](https://img.shields.io/nuget/dt/BioGTK?color=g)](https://www.nuget.org/packages/BioGTK/3.9.0) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.8122239.svg)](https://doi.org/10.5281/zenodo.8122239)\n## Features\n\n- C# scripting with sample tool-script and other sample scripts in \"/Scripts/\" folder. [See samples.](https://github.com/BiologyTools/Bio-Scripts)\n\n- Supports running ImageJ macro commands on images open in Bio. Console to run ImageJ macro commands and Bio C# scripts.\n\n- Supports viewing \u0026 creating pyramidal images with multiple resolutions. Like whole slide images.\n\n- Stitch images at varying resolutions into single pyramidal image with multiple resolutions.\n\n- Multiple view modes like Emission, and Filtered. ROI's shown for each channel can be configured in ROI Manager.\n\n- Supports drawing shapes \u0026 colors onto 16 bit \u0026 48 bit images, unlike System.Drawing.Graphics.\n\n- Convenient viewing of image stacks with scroll wheel moving Z-plane and mouse side buttons scrolling C-planes.\n\n- Editing \u0026 saving ROI's in images to OME format image stacks.\n\n- Copy \u0026 Paste to quickly annotate images and name them easily by right click.\n\n- Select multiple points by holding down control key, and move them by holding down control key. \n\n- Exporting ROI's from each OME image in a folder of images to CSV.\n\n- Easy segmentation with Segment Anything (SAM). Required model files downloadable from [Releases.](https://github.com/BiologyTools/BioGTK/releases/tag/SAM-Models)\n\n## Dependencies\n- [BioFormats.NET8](https://github.com/BiologyTools/BioFormatsNET8) [GPL3](https://www.gnu.org/licenses/gpl-3.0.en.html)\n- [IKVM](http://www.ikvm.net/) [License](https://github.com/gluck/ikvm/blob/master/LICENSE)\n- [AForge](http://www.aforgenet.com/) [LGPL](http://www.aforgenet.com/framework/license.html)\n- [LibTiff.Net](https://bitmiracle.com/libtiff/) [BSD](https://bitmiracle.com/libtiff/)\n- [Cs-script](https://github.com/oleg-shilo/cs-script/blob/master/LICENSE) [MIT](https://github.com/oleg-shilo/cs-script/blob/master/LICENSE)\n- [ImageJ](https://imagej.nih.gov/ij/) (Only needed when running ImageJ macro commands)\n- [ScottPlot](https://oxyplot.github.io/) [MIT](https://github.com/ScottPlot/ScottPlot/blob/main/LICENSE)\n- [LibVips](https://www.libvips.org/install.html) (Optional) [LGPL]([https://www.libvips.org/install.html](https://github.com/libvips/libvips/blob/master/LICENSE))\n- [Segment-Anything-CSharp](https://github.com/AIDajiangtang/Segment-Anything-CSharp) (Optional) [Apache License 2.0](https://github.com/AIDajiangtang/Segment-Anything-CSharp/blob/main/LICENSE)\n- [OpenSlideGTK](https://github.com/BiologyTools/OpenSlideSharp) (Optional) [MIT](https://github.com/BiologyTools/OpenSlideSharp/blob/master/LICENSE)\n\n## Scripting\n-  Save scripts into \"StartupPath/Scripts\" with \".cs\" ending.\n-  Open script editor and recorder from menu.\n-  Scripts saved in Scripts folder will be loaded into script runner.\n-  Use Script recorder to record program function calls and script runner to turn recorder text into working scripts. (See sample [scripts](https://github.com/BioMicroscopy/BioImage-Scripts)\n\n## Plugins\n- Save plugin DLL's into \"StartupPath/Plugins\"\n- Add plugins from Github repositories by clicking Update and add the url of the repository which you want to add.\n- See [example plugin](https://github.com/BiologyTools/PluginExample) to create your own plugins.\n- Add the BioGTK plugin repository \"https://github.com/BiologyTools/BioGTK-Plugins\" to your updater list.\n\n## Models\n- Save models into \"StartupPath/Models\" supports [BioImage.IO](https://bioimage.io/) models.\n- 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.\n\n## Mac Installation\n- Install Mac package manager [homebrew.](https://brew.sh/)\n- From brew install [GTK3.](https://formulae.brew.sh/formula/gtk+3#default)\n- Download the BioGTK application for either OSX-x64 or OSX-Arm from releases.\n- Make the .app bundle executable by opening terminal in the Contents/MacOS folder then run \"chmod 755 BioGTKApp\"\n- Optionally install [OpenSlide](https://formulae.brew.sh/formula/openslide) for better navigation of whole-slide-images.\n- Optionally install [LibVips](https://www.libvips.org/install.html) for increased performance and functions with whole-slide-images.\n- Optionally for SAM install ONNX Runtime by running \"brew install onnxruntime\".\n\n## Windows Installation\n- Install package manager [MSYS2.](https://github.com/GtkSharp/GtkSharp/wiki/Installing-Gtk-on-Windows) to install package GTK3. (Required for GTK Apps.)\n- Download the BioGTK Windows installer from releases.\n- Optionally install [OpenSlide](https://openslide.org/docs/windows/) for better navigation of whole-slide-images. Be sure to set the PATH variable correctly.\n- Optionally install [CUDA](https://developer.nvidia.com/cuda-downloads) for hardware accelerated stitching as well as tile cache in graphics card memory instead of RAM. \n\n## Linux Installation\n- Download the latest tarball(tar.gz) from Releases as linux already includes GTK3 package.\n- Extract the tarball and go to the \"Glade\" folder and select all the glade files and change permissions to read-write.\n- Optionally install [LibVips](https://www.libvips.org/install.html) for increased performance and functions with whole-slide-images.\n- Optionally install [OpenSlide](http://openslide.org/) for better navigation of whole-slide-images.\n- Optionally install [CUDA](https://developer.nvidia.com/cuda-downloads) for hardware accelerated stitching as well as tile cache in graphics card memory instead of RAM. \n\n## Examples\nFirst you need to setup your project as a GTK project with .NET 8.0 as the target. \nThen in between Gtk.Application.Init() and Gtk.Application.Run() use the library as you please.\nHere is an example for opening a new NodeView from BioGTKApp program.cs.\n```\nConsole.WriteLine(\"Initializing GTK.\");\nGtk.Application.Init();\nConsole.WriteLine(\"Creating NodeView.\");\nBioGTK.NodeView node = BioGTK.NodeView.Create(args);\nnode.Show();\nGtk.Application.Run();\n```\nAnother example on how to open an image with a new ImageView\n```\nGtk.Application.Init();\n//Since we will be using the GUI we call App.Initialize();\nApp.Initialize();\nBioImage bm = BioImage.OpenFile(\"F:\\\\TESTIMAGES\\\\CZI\\\\16Bit-ZStack.czi\");\nImageView v = ImageView.Create(bm);\nv.Show();\nGtk.Application.Run();\n```\n## Usage\n```\n//If you want to initialize the application call app initialize. \n//This will initialize Bioformats library as well as the rest of the application.\nApp.Initialize();\n\n//Or you can create a new NodeView which will initialize the application\n//as well as parse any command line arguments.\nNodeView nodes = NodeView.Create(new string[]{\"file\"});\n\n//You can also call BioImage.Initialize to \n//initialize just the Bioformats library.\nBioImage.Initialize();\n\n//Once initialized you can open OME, ImageJ tiff files, and Bio Tiff files with:\nBioImage b = BioImage.OpenFile(\"file\");\n\n//Or if you want to use specifically the OME image reader you can use BioImage.OpenOME\nBioImage b = BioImage.OpenOME(\"file\");\n\n//If you are working with a pyramidal image you can open a portion of a tiled image with OpenOME.\n//BioImage.OpenOME(string file, int serie, bool tab, bool addToImages, bool tile, int tilex, int tiley, int tileSizeX, int tileSizeY)\n\n//You can specify whether to open in a newtab as well as whether to add the image to \n//the Images.images table. As well as specify whether to open as a tile with the specified \n//tile X,Y position \u0026 tile width \u0026 height.    \nBioImage.OpenOME(\"file\",0,false,false,true,0,0,600,600);\n//This will open a portion of the image as a tile and won't add it to the Images table.\n\n//Once you have opened a tiled image with BioImage.OpenOME you can call the \n//GetTile(BioImage b, ZCT coord, int serie, int tilex, int tiley, int tileSizeX, int tileSizeY) method\n// to quickly get another tile from different portion of the image. For BioGTK \u0026 BioLib\nBitmap bm = GetTile(b, new ZCT(0,0,0), 0, 100, 100, 600, 600);\n\n//You can display an image with the ImageView control which can display\n// Pyramidal, Whole-Slide, and Series of images.\nImageView v = ImageView.Create(b);\n\n//To get the current coordinate of the ImageView you can call GetCoordinate.\nZCT cord = v.GetCoordinate();\n//or to set the current coordinate\nv.SetCoordinate(new ZCT(1,1,1));\n\n//To create a point as well as any other ROI type you can call the ROI create methods.\nROI p = ROI.CreatePoint(cord, 0, 0);\nROI rect = ROI.CreateRectangle(cord, 0, 0, 100, 100);\n\n//Usage of Graphics class for 16 \u0026 48 bit images as well as regular bit depth images\n//is very similar to System.Graphics.\n//We create a new Graphics object by passing the Bitmap for BioGTK \u0026 BioLib and BufferInfo for BioCore\nGraphics g = Graphics.FromImage(b.Buffers[0]);\n\n//Then we create a pen by passing a ColorS which represent a Color with, \n//a higher bit depth (unsigned short) rather than a byte.\ng.pen = new Pen(new ColorS(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue));\n\n//Then we can call the familiar methods DrawLine, DrawPolygon, FillPolygon etc.\ng.DrawLine(0,0,100,100);\n//Finally we dispose the Graphics object.\ng.Dispose();\n\n//Then to update the image in the viewer once we have made changes to the image we call:\nv.UpdateImage();\n//This will update the images of the viewer in the current coordinate plane.\nv.UpdateView();\n\n//We can also save the resulting image given the ID of the image in the Images table.\n//All images opened with BioImage.OpenFile or BioImage.OpenOME are added to the \n//Images.images table with the filename as an ID.\nBioImage.SaveFile(\"file\",\"path\");\n\n//To convert between different pixel formats we can call for example To24Bit.\nb.To24Bit();\n```\n## Sample Plugin\n\n```\nusing AForge;\nusing BioGTK;\nusing Gdk;\nusing Gtk;\nusing SkiaSharp.Views.Desktop;\nnamespace PluginExample\n{\n    public class PluginExample : BioGTK.Plugin.IPlugin\n    {\n        public string Name =\u003e \"PluginExample\";\n        public string MenuPath =\u003e \"Tools/\" + Name + \".dll\";\n        public bool ContextMenu =\u003e false;\n        public void Execute(string[] args)\n        {\n        }\n        public void KeyUpEvent(object o, KeyPressEventArgs e)\n        {\n        }\n        public void KeyDownEvent(object o, KeyPressEventArgs e)\n        {\n        }\n        public void ScrollEvent(object o, ScrollEventArgs args)\n        {\n        }\n        public void Render(object sender, SKPaintSurfaceEventArgs e)\n\t\t{\n\t\t}\n        public void MouseMove(object o, PointD e, MotionNotifyEventArgs buts)\n        {\n        }\n        public void MouseUp(object o, PointD e, ButtonReleaseEventArgs buts)\n        {\n        }\n        public void MouseDown(object o, PointD e, ButtonPressEventArgs buts)\n        {\n        }\n        \n    }\n}\n```\n\n## Sample Tool Script\n```\n//css_reference BioGTK.dll; \nusing System; \nusing BioGTK;\nusing System.Threading;\nusing AForge;\nusing Gdk;\npublic class Loader {\n\n//Point ROI Tool Example\npublic string Load()\n{\n\tint ind = 1;\n\tdo\n\t{\n\t\tBioGTK.Scripting.State s = BioGTK.Scripting.GetState();\n\t\tif (s != null)\n\t\t{\n\t\t\tif (!s.processed)\n\t\t\t{\n\t\t\t\tif (s.type == BioGTK.Scripting.Event.Down \u0026\u0026 s.buts == 1)\n\t\t\t\t{\n\t\t\t\t\tZCT cord = BioGTK.App.viewer.GetCoordinate();\n\t\t\t\t\tBioGTK.Scripting.LogLine(cord.ToString() + \" Coordinate\");\n\t\t\t\t\tBioGTK.ROI an = BioGTK.ROI.CreatePoint(cord, s.p.X, s.p.Y);\n\t\t\t\t\tBioGTK.ImageView.SelectedImage.Annotations.Add(an);\n\t\t\t\t\tBioGTK.Scripting.LogLine(cord.ToString() + \" Coordinate\");\n\t\t\t\t\tan.Text = \"Point\" + ind;\n\t\t\t\t\tind++;\n\t\t\t\t\tBioGTK.Scripting.LogLine(s.ToString() + \" Point\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif (s.type == BioGTK.Scripting.Event.Up)\n\t\t\t\t{\n\t\t\t\t\tBioGTK.Scripting.LogLine(s.ToString());\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif (s.type == BioGTK.Scripting.Event.Move)\n\t\t\t\t{\n\t\t\t\t\tBioGTK.Scripting.LogLine(s.ToString());\n\t\t\t\t}\n\t\t\t\tif(s.key == Key.r)\n\t\t\t\t{\n\t\t\t\t\tBioGTK.Scripting.LogLine(\"KeyDown\");\n\t\t\t\t}\n\t\t\t\ts.processed = true;\n\t\t\t}\n\t\t}\n\t\tif(BioGTK.Scripting.Exit(\"test.cs\"))\n\t\t{\t\n\t\t\treturn \"OK\";\n\t\t}\n\t} while (true);\n\treturn \"OK\";\n}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiologytools%2Fbiogtk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbiologytools%2Fbiogtk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiologytools%2Fbiogtk/lists"}