A 3D Slicer extension for loading TRX tractography files (.trx) directly into Slicer as FiberBundleNode objects.
- Drag-and-drop or Add Data dialog support for
.trxfiles - Each named bundle group in the TRX file becomes a separate
vtkMRMLFiberBundleNode - RAS+ coordinate system is preserved (no axis flip required for Slicer)
- Per-streamline (DPS) and per-vertex (DPV) scalar field support planned
- trx-python — install inside Slicer's Python environment:
or from the Slicer Python interactor:
pip_install("trx-python")import pip; pip.main(["install", "trx-python"])
- Open 3D Slicer
- Go to Edit → Application Settings → Extensions
- Search for "TractographyTRX" and install
- Clone this repository
- In Slicer go to Edit → Application Settings → Modules → Additional module paths
- Add the path to
Modules/Scripted/TractographyTRX - Restart Slicer
mkdir build && cd build
cmake .. -DSlicer_DIR=/path/to/Slicer-build
cmake --build .After installation, .trx files can be opened via:
- File → Add Data — select a
.trxfile; each group becomes a node - Drag and drop a
.trxfile onto the Slicer window - From the Python interactor:
from TractographyTRX import TractographyTRXLogic nodes = TractographyTRXLogic().loadTRX("/path/to/file.trx")
TRX stores positions in RAS+. Slicer's world coordinate system is also RAS+, so no coordinate transformation is needed.
After loading a .trx file:
- Switch to the 3D view — the large rendering pane (top-right by default). Fiber bundles only render in 3D, not in the 2D slice views.
- Open the Data module (
Modules → Data, or click the folder/hierarchy icon in the toolbar). Your nodes appear in the Subject Hierarchy tree, named after the file — orfilename.groupnameif the file had bundle groups. - Toggle visibility by clicking the eye icon next to each node. All nodes are set to visible on load, so if nothing appears, check that SlicerDMRI is installed (see Dependencies above).
- Fit the 3D view to your data: right-click anywhere in the 3D view and choose "Reset field of view", or press
bwhile the 3D view is focused, to zoom the camera to fit all visible content. - Rotate / pan / zoom with left-drag / middle-drag / scroll in the 3D view.
The module includes a "Live slice intersection" panel that shows only streamlines passing through a slab around the current slice plane — similar to what ITKTractographyTRX's AABB query does:
- Open
Modules → Tractography → TractographyTRX. - In Live slice intersection, select the bundle node and slice plane (Red/Yellow/Green).
- Adjust Slab thickness (default 2 mm — the full width of the slab).
- Click Enable live filter. The 3D view updates as you move the slice.
- Click Disable live filter to restore all streamlines.
Tip: Link slice views to a loaded volume so the slice position has anatomical context: in the slice view toolbar, click the chain-link icon to link all slice views, then load a reference image.
ITKTractographyTRX is a compiled ITK remote module that provides lazy-loading,
spatial queries, and streaming writes — useful for large datasets or pipelines
requiring ITK image integration (e.g. TDI maps, parcellation labeling).
This Slicer extension uses trx-python (pure Python, no compilation) for
simplicity and ease of installation within Slicer's managed Python environment.
For workflows that need ITK's spatial query or parcellation features, the ITK
module wrappers (itk.TrxFileReader, etc.) can be used instead once
ITKTractographyTRX is available in the ITK Python wheels.
Apache 2.0