Registry / serialization / trx-python

trx-python

JSON →
library0.4.0pypypiunverified

A community-oriented Python library for reading and writing the TRX (Tractography) file format, designed for efficient storage of streamline tractography data. Current version 0.4.0, requires Python >=3.11, with an active development cadence on GitHub.

serializationdata
Install & Compatibility
Where this runs
tested against v0.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 106.5MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 5.8s · import 0.000s · 102MB
114MB installed
● package 114MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

from trx import TRXFile

Minimal example: create a TRX file with two streamlines and read them back.

# Create a simple TRX file with two streamlines import numpy as np from trx.file import TRXFile # Create two streamlines as arrays of 3D points streamlines = [ np.array([[0,0,0], [1,0,0], [2,0,0]], dtype=np.float32), np.array([[0,1,0], [1,1,0], [2,1,0]], dtype=np.float32) ] # Write to file with TRXFile('example.trx', mode='wb') as trx: trx.write_streamlines(streamlines) # Read back with TRXFile('example.trx', mode='rb') as trx: loaded = list(trx.read_streamlines()) print(f'Loaded {len(loaded)} streamlines')
Debug
Known footguns
breakingTRXFile now requires explicit binary mode ('wb' or 'rb') when opening. Omitting mode will raise a ValueError in version 0.4.0.
gotchaStreamline data must be float32 numpy arrays. Passing float64 or other dtypes may cause silent truncation or errors.
deprecatedThe function 'read_trx' and 'write_trx' from version 0.2 are deprecated and will be removed. Use TRXFile context manager instead.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
25 hits · last 30 days
petalbot
5
gptbot
4
ahrefsbot
4
claudebot
3
script
1
bingbot
1
mj12bot
1
Resources