Skip to content

tee-ar-ex/SlicerTractographyTRX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

SlicerTractographyTRX

A 3D Slicer extension for loading TRX tractography files (.trx) directly into Slicer as FiberBundleNode objects.

Features

  • Drag-and-drop or Add Data dialog support for .trx files
  • 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

Dependencies

  • trx-python — install inside Slicer's Python environment:
    pip_install("trx-python")
    
    or from the Slicer Python interactor:
    import pip; pip.main(["install", "trx-python"])

Installation

From the Extension Manager (not yet submitted)

  1. Open 3D Slicer
  2. Go to Edit → Application Settings → Extensions
  3. Search for "TractographyTRX" and install

Development install

  1. Clone this repository
  2. In Slicer go to Edit → Application Settings → Modules → Additional module paths
  3. Add the path to Modules/Scripted/TractographyTRX
  4. Restart Slicer

Build from source

mkdir build && cd build
cmake .. -DSlicer_DIR=/path/to/Slicer-build
cmake --build .

Usage

After installation, .trx files can be opened via:

  • File → Add Data — select a .trx file; each group becomes a node
  • Drag and drop a .trx file onto the Slicer window
  • From the Python interactor:
    from TractographyTRX import TractographyTRXLogic
    nodes = TractographyTRXLogic().loadTRX("/path/to/file.trx")

Coordinate systems

TRX stores positions in RAS+. Slicer's world coordinate system is also RAS+, so no coordinate transformation is needed.

Viewing streamlines in the 3D window

After loading a .trx file:

  1. 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.
  2. 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 — or filename.groupname if the file had bundle groups.
  3. 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).
  4. Fit the 3D view to your data: right-click anywhere in the 3D view and choose "Reset field of view", or press b while the 3D view is focused, to zoom the camera to fit all visible content.
  5. Rotate / pan / zoom with left-drag / middle-drag / scroll in the 3D view.

Live slice intersection filter

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:

  1. Open Modules → Tractography → TractographyTRX.
  2. In Live slice intersection, select the bundle node and slice plane (Red/Yellow/Green).
  3. Adjust Slab thickness (default 2 mm — the full width of the slab).
  4. Click Enable live filter. The 3D view updates as you move the slice.
  5. 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.

Relation to ITKTractographyTRX

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.

License

Apache 2.0

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors