Library for compressing and decompressing image segmentation (adapted from neuroglancer)
This library contains routined to decompress and compress segmentation and to manipulate compressed segmentation data defined by the neuroglancer project.
- Compression and decompression
- (TBD) Interface to relabel and manipulate segmentation from the compressed data
- C++, Python, and Go interface
Compiling as a shared library. Feel free to subsititute e.g. clang for the C++ compiler.
g++ -std=c++11 -O3 -fPIC -shared -I./include src/compress_segmentation.cc src/decompress_segmentation.cc -o compress_segmentation.so
pip
Binary Installation
$ pip install compressed-segmentation
$ python
>>> import compressed_segmentation as cseg
>>> help(cseg)
If there are pre-built binaries available this should just work.
pip
Source Installation
If you need to build from source, you will need to have a C++ compiler installed and do the following:
$ sudo apt-get install g++ python3-dev
$ pip install numpy
$ pip install compressed-segmentation
$ python
>>> import compressed_segmentation as cseg
>>> help(cseg)
Direct Installation
Requires a C++ compiler such as g++ or clang.
Works with both Python 2 and 3. Encodes from / decodes to 3D or 4D numpy ndarrays.
$ sudo apt-get install g++ python3-dev
$ pip install -r requirements.txt
$ python setup.py install
$ python
>>> import compressed_segmentation as cseg
>>> help(cseg)
Please see the licenses in this repo.