In order to actually be useful in real-life, I had to include a system to indicate how to change datatype.
An example of this in scilpy is tracking when using LazyTractogram, we are also saving the initial seed position (N, 3) in the data_per_streamline.
The problem was that Nibabel was storing everything in float64, at save time everything is saved as float32 (in TRK/TCK)
But then the TRX was just saving it as it was stored (float64) so I had to include a way "for the user" to say what should be saved how.
This was already ok when creating a TRX from scratch, but when converting from StatefulTractogram in Dipy, or Tractogram in Nibabel to TrxFile it was not trivial to do .astype() on everything easily.
This comes with a big PR in Scilpy since we have like 150 scripts, but also it comes with a tiny change in Dipy so StatefulTractogram could hide a record of the dtype by itself.
This is evolving:
[x] Make a command line script that will take a TRX as input and a TRX as output and a bunch of tag to change the dtype of any specific file inside the TRX (easier than extracting it, loading and saving every array manually and re-generating from scratch again)
[ ] Double check all scripts involving streamlines in Scilpy to make sure they keep the right dtype (if possible)
[ ] Check the performance of using TRX on a script using QBx or Recobundles on a whole brain
[ ] Doing a PR in Dipy (so one day we can do a clean Dipy install of the next tag)
[ ] Doing a PR in Scilpy for basic support of TRX (no crazy memmapping, just load/save without loosing info)
[ ] Add test for load/save with a mix of to_* and from_* function (sft, memory, tractogram, etc.)
In order to actually be useful in real-life, I had to include a system to indicate how to change datatype.
An example of this in scilpy is tracking when using LazyTractogram, we are also saving the initial seed position (N, 3) in the data_per_streamline.
The problem was that Nibabel was storing everything in float64, at save time everything is saved as float32 (in TRK/TCK) But then the TRX was just saving it as it was stored (float64) so I had to include a way "for the user" to say what should be saved how.
This was already ok when creating a TRX from scratch, but when converting from StatefulTractogram in Dipy, or Tractogram in Nibabel to TrxFile it was not trivial to do
.astype()
on everything easily.This comes with a big PR in Scilpy since we have like 150 scripts, but also it comes with a tiny change in Dipy so StatefulTractogram could hide a record of the dtype by itself.
This is evolving:
to_*
andfrom_*
function (sft, memory, tractogram, etc.)https://github.com/frheault/dipy/tree/trx_integration https://github.com/frheault/scilpy/tree/trx_integration