--- id: fastremap version: "1.20.0" license: LGPL-3.0 license_treatment: copyleft maintenance: active --- # fastremap — Remap, mask, renumber, unique, and in-place transposition of 3D labeled images. Point cloud too. License: copyleft · Maintenance: active · Downloads: 172.9K/mo ## What it is and what it does fastremap is a C++-accelerated library for fast array manipulation on labeled NumPy arrays, designed for image processing and connectomics workflows. It provides optimized implementations of common operations like finding unique values, remapping labels via dictionary, renumbering to smaller data types, and extracting point clouds—operations that would be slow in pure Python or inefficient in NumPy for large sparse label spaces. The package trades install complexity (compiled extension) for speed on bulk array operations. Its main use case is handling large labeled images (hundreds of megabytes to gigabytes) where Python loops or naive NumPy indexing become impractical. It also offers in-place transposition and memory-efficient array format conversions (C to Fortran order), useful when moving data between CPU, GPU, or disk. Use it for: - Renumber a 64-bit segmentation label array down to 8-bit to save memory and fit smaller data types. - Remap arbitrary label values via dictionary on huge arrays without materializing an intermediate lookup table. - Extract coordinates of all voxels belonging to each label in a 3D image as a point cloud. - Count unique labels and their frequencies much faster than np.unique on large labeled arrays. - Physically transpose rectangular arrays in-place to convert between C and Fortran memory order before GPU upload or serialization. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Remap, renumber, and relabel NumPy arrays at C++ speed, plus perform in-place transposition and extract point clouds from labeled images. Yes, if you work with large labeled NumPy arrays (segmentations, connectomics, image analysis) and need fast remapping, renumbering, or transposition. The LGPL-3.0 copyleft license is permissive for open-source use but requires careful review in proprietary contexts. Install friction is moderate due to the C++ extension, but pre-built wheels cover common platforms. No known security vulnerabilities. ## Install pip install fastremap uv add fastremap poetry add fastremap ## Installing fastremap Before you install: Medium install friction due to compiled C++ extension; pre-built wheels available for Python 3.10–3.13 on macOS, Linux, and Windows. Actively maintained with a recent release (64 days ago). License in practice: LGPL-3.0 copyleft license requires derivative works to be distributed under the same license and provide source code; acceptable for most open-source projects but may conflict with proprietary software licensing. Quickstart: pip install fastremap import fastremap import numpy as np labels = np.array([1, 3, 5, 5, 10]) uniq, cts = fastremap.unique(labels, return_counts=True) labels, remapping = fastremap.renumber(labels, in_place=True) Requires NumPy; if pre-built wheels are unavailable for your platform, a C++ compiler is needed to build from source. Verify before relying: - Whether the performance gains over NumPy operations scale predictably with array size or are most significant for specific data types or dimensions. - Compatibility and performance characteristics on platforms beyond the listed wheel distributions. ## Package facts - License: LGPL-3.0 (copyleft) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 172.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags fast array remapping, renumber labeled arrays, numpy label relabeling, in-place array transpose, point cloud extraction, fast unique values, array masking operations, image-processing, array-optimization, connectomics [View on SkillFed](https://skillfed.io/packages/fastremap) · [View on PyPI](https://pypi.org/project/fastremap/)