skillfed

trx-python

A community-oriented file format for tractography

trx-python v0.4.0 100.1K downloads/30d#13,000 on PyPI26
Permissive license BSD License Active released

What it is and what it does

trx-python is a Python library for working with TRX, a community-oriented file format for tractography data used in neuroimaging research. It provides both a programmatic API and a unified command-line interface for loading, saving, converting, validating, and concatenating tractography files. The library supports multiple input formats (TRX, TRK, TCK, VTK, FIB, DPY) and can export to any of these formats, making it useful for interoperability across neuroimaging pipelines.

The package depends on numpy for numerical operations, nibabel for neuroimaging file I/O, deepdiff for data comparison, and typer for CLI argument parsing. It uses memory-mapped files to handle large tractography datasets efficiently without loading entire files into RAM. The project is actively maintained, supports Python 3.11–3.13, and is licensed under the permissive BSD License.

Use it for:

  • Convert brain fiber tract data between TRX and legacy formats (TRK, TCK, VTK) in neuroimaging pipelines.
  • Validate TRX tractography files for data integrity before processing or sharing with collaborators.
  • Merge multiple tractography datasets into a single file using the concatenate command.
  • Inspect TRX file metadata, headers, groups, and archive contents via the CLI info command.
  • Integrate tractography I/O into Python-based neuroimaging analysis workflows.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Reads, writes, and manipulates TRX tractography files in Python, supporting conversion between TRX and other formats (TRK, TCK, VTK, FIB, DPY) with command-line tools for validation and concatenation.

Yes. trx-python is worth installing if you work with tractography data in neuroimaging. It has low install friction, active maintenance, no known vulnerabilities, a permissive license, and fills a clear need for TRX format support. The CLI tools are convenient for one-off conversions and validation; the Python API integrates well into larger pipelines. The Alpha status reflects the format's maturity, not instability.

Install

trx-python on PyPI

pip

pip install trx-python

uv

uv add trx-python

poetry

poetry add trx-python

Installing trx-python

Before you install

Low friction: pure Python wheel with four runtime dependencies (deepdiff, nibabel, numpy, typer). Active maintenance with a recent commit on 2026-08-11 and a release on 2026-03-05.

License in practice

BSD License (permissive) — you can use, modify, and distribute this package freely in both open and closed projects with minimal restrictions.

Quickstart

pip install trx-python

from trx.io import load, save

trx = load("tractogram.trx")
save(trx, "output.trk")

Requires Python 3.11 or later. Large tractography files use memory-mapped temporary storage; ensure adequate disk space (several gigabytes possible) and set TRX_TMPDIR if default temp location is insufficient.

Verify before relying

  • Whether nibabel and numpy versions have known compatibility constraints with the supported Python versions.
  • Performance characteristics and memory overhead when processing very large tractography files.
  • Completeness of format support across all advertised file types (TRK, TCK, VTK, FIB, DPY) in practice.

Package facts

License BSD License (permissive)
Python support supports the current Python release (>=3.11)
Install friction low — pure-Python wheel
Runtime dependencies 4 — deepdiff, nibabel, numpy, typer
Maintenance actively maintained — 162 days since the last release
Last repo commit
First released
Downloads 100,126/month — #13,000 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: trx_python-0.4.0-py3-none-any.whl

Development Status :: 3 - AlphaEnvironment :: ConsoleIntended Audience :: Science/ResearchLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Topic :: Scientific/Engineering

Tags

tractography file format pythontrx file reader writerneuroimaging fiber tract toolsconvert tractogram formatstrx cli command linebrain fiber tract processingtractogram validation concatenation
neuroimagingtractographyfile-format

More Scientific/Engineering packages