Skip to content

Conversation

@mattcieslak
Copy link

This is a minor addition to tckconvert that doesn't address any of the deep issues discussed in #2241, but it does

  1. Add the TRX c++ library to the mrtrix build
  2. Adds official TRX testing data to the test data repo (Add TRX test data test_data#6)
  3. Edits tckconvert to read/write trx files
  4. Adds tests to confirm that round-trip conversion works

I am successfully building and testing locally, but may need some help getting the build working cleanly here. Despite not fully integrating TRX into mrtrix, I think this is a great foot in the door that will let us tckconvert TRX files directly within mrtrix3.

Tagging @arokem, @frheault

@frheault
Copy link

Hi, that's great !
Would you be able to provide instructions here for building TRX c++ library and how you made it work with mrtrix to see if I can reproduce (and leave a trace in case this information should make its way into the README.md).

@mattcieslak
Copy link
Author

mattcieslak commented Jan 27, 2026

Sure! On my mac I do

WD=${PWD}
brew install libzip nlohmann-json spdlog
# homebrew's eigen is too new. I downloaded 3.4.0 elsewhere
export EIGEN_CFLAGS="-isystem /path/to/eigen-3.4.0"

git clone git@github.com:tee-ar-ex/trx-cpp.git
cmake -S trx-cpp -B trx-build
cmake --build trx-build

git clone git@github.com:mrtrix3/mrtrix3.git
cd mrtrix3
gh pr checkout 3262
export TRX_CFLAGS="-I${WD}/trx-cpp/third_party/mio/include -I${WD}/trx-cpp/third_party/json11 -I/opt/homebrew/include -I${WD}/trx-cpp/include"
export TRX_LINKFLAGS="-L${WD}/trx-build -ltrx \
  -L/opt/homebrew/opt/libzip/lib -lzip \
  -L/opt/homebrew/opt/fmt/lib -lfmt"

export EIGEN_CFLAGS="-isystem $HOME/deps/eigen-3.4.0"
./configure -nogui
./build bin/tckconvert

@arokem
Copy link

arokem commented Jan 28, 2026

Cross-linking to #2241

@jdtournier
Copy link
Member

Thanks for the contribution, @mattcieslak! We've been meaning to look into implementing TRX, but bandwidth is seriously limited these days...

Any chance you could rebase this onto our dev branch? It should be relatively easy to make the changes - the main difference is that code now lives in the cpp folder. But it may take a bit of work to figure out the changes required for CMake to pick up the TRX library - @daljit46 can hopefully help with that bit.

Also: any reason you're not using a std::unique_ptr to handle the trxmmap::TrxFile objects?

@daljit46
Copy link
Member

Another thing worth mentioning is that the dev branch uses C++17 as the default standard, so changes like tee-ar-ex/trx-cpp#11 shouldn't be required.

@mattcieslak
Copy link
Author

Thanks @jdtournier and @daljit46! Wow, I missed some very nicely documented info about your development methods. I think I will close this PR and open a new one after switching trx-cpp to target c++17 as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants