tee-ar-ex / trx-python

Python implementation of the TRX file format
https://tee-ar-ex.github.io/trx-python/
BSD 2-Clause "Simplified" License
20 stars 16 forks source link

(WIP) TRX integration to Scilpy #50

Closed frheault closed 1 year ago

frheault commented 1 year ago

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:

https://github.com/frheault/dipy/tree/trx_integration https://github.com/frheault/scilpy/tree/trx_integration

arokem commented 1 year ago

Could you please link to the relevant scilpy PR, when you have that up?

frheault commented 1 year ago

@arokem Here are the relevant PR https://github.com/scilus/scilpy/pull/675 https://github.com/dipy/dipy/pull/2723