/hierarchical_agglom

A package for parallelized hierarchical-merge-tree-based image segmentation, built on MongoDB and C++

Primary LanguagePythonApache License 2.0Apache-2.0

hglom

A package for parallelized hierarchical-merge-tree-based image segmentation, built on MongoDB and C++.

  • Free software: Apache 2.0 License

Installation

A full installation script can be found in install.sh, or line-by-line installs can be ran as follows:

Install C++ dependencies:

sudo apt install libboost-dev

Install MongoDB:

curl -fsSL https://pgp.mongodb.com/server-6.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-6.0.gpg --dearmor

And initialize a MongoDB server in a screen on your machine:

screen
mongod

Install graph_tool

conda install -c conda-forge -c ostrokach-forge -c pkgw-forge graph-tool

Install hglom:

pip install git+https://github.com/brianreicher/hierarchical_agglom.git

Features

  • A hierarchical-merge-tree implementation to go from affininities to a full segmentation
  • Pipeline utilizes a MongoDB RAG to produce successive iterations of segmentations
  • Should handle up to 6 dimensional arrays of fragments (7 dimensions if you include offsets in affinities) but only tested on 2 and 3 dimensions

Usage

Example usage for generating a post-processing segmentation from affinities:

import hglom

pp: hglom.PostProcessor = hglom.PostProcessor(
            affs_file="../data/raw_predictions.zarr",
            affs_dataset="pred_affs_latest",
        )
pp.segment()

where:

  • affs_file is a path (relative or absolute) to the zarr file containing predicted affinities to generate fragments for.
  • affs_dataset is the name of the affinities dataset in the affs_file to read from.

Credits

This package builds upon waterz, developed at the Funke Lab.