%global _empty_manifest_terminate_build 0 Name: python-compressed-segmentation Version: 2.2.0 Release: 1 Summary: Neuroglancer compressed_segmentation codec. License: LICENSE.txt URL: https://github.com/janelia-flyem/compressedseg Source0: https://mirrors.nju.edu.cn/pypi/web/packages/bb/2d/f68952c7a3c808e44654e3402f5fa6d2c8c58b8652dc34ed9fbd1de0636a/compressed_segmentation-2.2.0.tar.gz Requires: python3-click Requires: python3-numpy Requires: python3-pytest %description [![PyPI version](https://badge.fury.io/py/compressed-segmentation.svg)](https://badge.fury.io/py/compressed-segmentation) # Compress Seg [![Picture](https://raw.github.com/janelia-flyem/janelia-flyem.github.com/master/images/HHMI_Janelia_Color_Alternate_180x40.png)](http://www.janelia.org) ## Library for compressing and decompressing image segmentation (adapted from [neuroglancer](https://github.com/google/neuroglancer)) ```python import compressed_segmentation as cseg sx, sy, sz = (128,128,128) dtype = np.uint64 order = 'C' labels = np.arange(0, sx*sy*sz, dtype=dtype).reshape((sx,sy,sz), order=order) compressed = cseg.compress(labels, order=order) recovered = cseg.decompress( compressed, (sx,sy,sz) dtype=dtype, order=order ) arr = CompressedSegmentationArray( compressed, shape=(sx,sy,sz), dtype=dtype ) label = arr[54,32,103] # random access to single voxels w/o decompressing uniq_labels = arr.labels() # get all distinct values w/o decompressing binary2 = arr.remap({ 1: 2 }, preserve_missing_labels=False) # remap labels in segmentation w/o decompressing recovered = arr.numpy() # decompress to a numpy array, same as decompress 124213 in arr # test if a value is in the array ``` ```bash cseg compress connectomics.npy cseg decompress connectomics.npy.cseg --volume-size 512,512,512 --bytes 4 ```` NOTE: This repository is the PyPI distribution repo but is based on work done by Jeremy Maitin-Shepard (Google), Stephen Plaza (Janelia Research Campus), and William Silversmith (Princeton) here: https://github.com/janelia-flyem/compressedseg This library contains routined to decompress and compress segmentation and to manipulate compressed segmentation data defined by the [neuroglancer project](https://github.com/google/neuroglancer/blob/master/src/neuroglancer/sliceview/compressed_segmentation/README.md). compressed_segmentation essentially renumbers large bit width labels to smaller ones in chunks. This provides for large reductions in memory usage and higher compression. Note that limitations in the compressed_segmentation format restrict the size of the chunk that can be compressed. As this limitation is data dependent, for example a random array with 1024 labels passes testing at 256x256x128, but 256x256x256 often does not. ### Features * Compression and decompression * Random access to voxels without decompression * Read out unique values without decompression * Remap labels without decompression * Command line interface for numpy files * (TBD) Interface to relabel and manipulate segmentation from the compressed data * C++, Python, and Go interface (see original repo for Golang) ### C++ Compilation Compiling as a shared library. Feel free to subsititute e.g. clang for the C++ compiler. ```bash g++ -std=c++11 -O3 -fPIC -shared -I./include src/compress_segmentation.cc src/decompress_segmentation.cc -o compress_segmentation.so ``` ### Python Installation #### `pip` Binary Installation ```bash $ pip install compressed-segmentation $ python >>> import compressed_segmentation as cseg >>> help(cseg) ``` If there are pre-built binaries available for your architecture this should just work. #### `pip` Source Installation If you need to build from source, you will need to have a C++ compiler installed: ```bash $ 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. ```bash $ sudo apt-get install g++ python3-dev $ pip install -r requirements.txt $ python setup.py install $ python >>> import compressed_segmentation as cseg >>> help(cseg) ``` ### License Please see the licenses in this repo. %package -n python3-compressed-segmentation Summary: Neuroglancer compressed_segmentation codec. Provides: python-compressed-segmentation BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip BuildRequires: python3-cffi BuildRequires: gcc BuildRequires: gdb %description -n python3-compressed-segmentation [![PyPI version](https://badge.fury.io/py/compressed-segmentation.svg)](https://badge.fury.io/py/compressed-segmentation) # Compress Seg [![Picture](https://raw.github.com/janelia-flyem/janelia-flyem.github.com/master/images/HHMI_Janelia_Color_Alternate_180x40.png)](http://www.janelia.org) ## Library for compressing and decompressing image segmentation (adapted from [neuroglancer](https://github.com/google/neuroglancer)) ```python import compressed_segmentation as cseg sx, sy, sz = (128,128,128) dtype = np.uint64 order = 'C' labels = np.arange(0, sx*sy*sz, dtype=dtype).reshape((sx,sy,sz), order=order) compressed = cseg.compress(labels, order=order) recovered = cseg.decompress( compressed, (sx,sy,sz) dtype=dtype, order=order ) arr = CompressedSegmentationArray( compressed, shape=(sx,sy,sz), dtype=dtype ) label = arr[54,32,103] # random access to single voxels w/o decompressing uniq_labels = arr.labels() # get all distinct values w/o decompressing binary2 = arr.remap({ 1: 2 }, preserve_missing_labels=False) # remap labels in segmentation w/o decompressing recovered = arr.numpy() # decompress to a numpy array, same as decompress 124213 in arr # test if a value is in the array ``` ```bash cseg compress connectomics.npy cseg decompress connectomics.npy.cseg --volume-size 512,512,512 --bytes 4 ```` NOTE: This repository is the PyPI distribution repo but is based on work done by Jeremy Maitin-Shepard (Google), Stephen Plaza (Janelia Research Campus), and William Silversmith (Princeton) here: https://github.com/janelia-flyem/compressedseg This library contains routined to decompress and compress segmentation and to manipulate compressed segmentation data defined by the [neuroglancer project](https://github.com/google/neuroglancer/blob/master/src/neuroglancer/sliceview/compressed_segmentation/README.md). compressed_segmentation essentially renumbers large bit width labels to smaller ones in chunks. This provides for large reductions in memory usage and higher compression. Note that limitations in the compressed_segmentation format restrict the size of the chunk that can be compressed. As this limitation is data dependent, for example a random array with 1024 labels passes testing at 256x256x128, but 256x256x256 often does not. ### Features * Compression and decompression * Random access to voxels without decompression * Read out unique values without decompression * Remap labels without decompression * Command line interface for numpy files * (TBD) Interface to relabel and manipulate segmentation from the compressed data * C++, Python, and Go interface (see original repo for Golang) ### C++ Compilation Compiling as a shared library. Feel free to subsititute e.g. clang for the C++ compiler. ```bash g++ -std=c++11 -O3 -fPIC -shared -I./include src/compress_segmentation.cc src/decompress_segmentation.cc -o compress_segmentation.so ``` ### Python Installation #### `pip` Binary Installation ```bash $ pip install compressed-segmentation $ python >>> import compressed_segmentation as cseg >>> help(cseg) ``` If there are pre-built binaries available for your architecture this should just work. #### `pip` Source Installation If you need to build from source, you will need to have a C++ compiler installed: ```bash $ 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. ```bash $ sudo apt-get install g++ python3-dev $ pip install -r requirements.txt $ python setup.py install $ python >>> import compressed_segmentation as cseg >>> help(cseg) ``` ### License Please see the licenses in this repo. %package help Summary: Development documents and examples for compressed-segmentation Provides: python3-compressed-segmentation-doc %description help [![PyPI version](https://badge.fury.io/py/compressed-segmentation.svg)](https://badge.fury.io/py/compressed-segmentation) # Compress Seg [![Picture](https://raw.github.com/janelia-flyem/janelia-flyem.github.com/master/images/HHMI_Janelia_Color_Alternate_180x40.png)](http://www.janelia.org) ## Library for compressing and decompressing image segmentation (adapted from [neuroglancer](https://github.com/google/neuroglancer)) ```python import compressed_segmentation as cseg sx, sy, sz = (128,128,128) dtype = np.uint64 order = 'C' labels = np.arange(0, sx*sy*sz, dtype=dtype).reshape((sx,sy,sz), order=order) compressed = cseg.compress(labels, order=order) recovered = cseg.decompress( compressed, (sx,sy,sz) dtype=dtype, order=order ) arr = CompressedSegmentationArray( compressed, shape=(sx,sy,sz), dtype=dtype ) label = arr[54,32,103] # random access to single voxels w/o decompressing uniq_labels = arr.labels() # get all distinct values w/o decompressing binary2 = arr.remap({ 1: 2 }, preserve_missing_labels=False) # remap labels in segmentation w/o decompressing recovered = arr.numpy() # decompress to a numpy array, same as decompress 124213 in arr # test if a value is in the array ``` ```bash cseg compress connectomics.npy cseg decompress connectomics.npy.cseg --volume-size 512,512,512 --bytes 4 ```` NOTE: This repository is the PyPI distribution repo but is based on work done by Jeremy Maitin-Shepard (Google), Stephen Plaza (Janelia Research Campus), and William Silversmith (Princeton) here: https://github.com/janelia-flyem/compressedseg This library contains routined to decompress and compress segmentation and to manipulate compressed segmentation data defined by the [neuroglancer project](https://github.com/google/neuroglancer/blob/master/src/neuroglancer/sliceview/compressed_segmentation/README.md). compressed_segmentation essentially renumbers large bit width labels to smaller ones in chunks. This provides for large reductions in memory usage and higher compression. Note that limitations in the compressed_segmentation format restrict the size of the chunk that can be compressed. As this limitation is data dependent, for example a random array with 1024 labels passes testing at 256x256x128, but 256x256x256 often does not. ### Features * Compression and decompression * Random access to voxels without decompression * Read out unique values without decompression * Remap labels without decompression * Command line interface for numpy files * (TBD) Interface to relabel and manipulate segmentation from the compressed data * C++, Python, and Go interface (see original repo for Golang) ### C++ Compilation Compiling as a shared library. Feel free to subsititute e.g. clang for the C++ compiler. ```bash g++ -std=c++11 -O3 -fPIC -shared -I./include src/compress_segmentation.cc src/decompress_segmentation.cc -o compress_segmentation.so ``` ### Python Installation #### `pip` Binary Installation ```bash $ pip install compressed-segmentation $ python >>> import compressed_segmentation as cseg >>> help(cseg) ``` If there are pre-built binaries available for your architecture this should just work. #### `pip` Source Installation If you need to build from source, you will need to have a C++ compiler installed: ```bash $ 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. ```bash $ sudo apt-get install g++ python3-dev $ pip install -r requirements.txt $ python setup.py install $ python >>> import compressed_segmentation as cseg >>> help(cseg) ``` ### License Please see the licenses in this repo. %prep %autosetup -n compressed-segmentation-2.2.0 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-compressed-segmentation -f filelist.lst %dir %{python3_sitearch}/* %files help -f doclist.lst %{_docdir}/* %changelog * Wed May 10 2023 Python_Bot - 2.2.0-1 - Package Spec generated