Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorporate TRX #1006

Merged
merged 26 commits into from
Sep 9, 2023
Merged

Incorporate TRX #1006

merged 26 commits into from
Sep 9, 2023

Conversation

arokem
Copy link
Collaborator

@arokem arokem commented Aug 23, 2023

This supersedes #818, because the rebase became too complicated.

bundles)
bundles,
reference=reference)

seg_sft.sft.to_rasmm()
for bundle_name in seg_sft.bundle_names:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be able to use the fact that the trx has groups here in a more sophisticated manner.

@@ -7,6 +7,10 @@
import nibabel as nib
from dipy.io.streamline import save_tractogram
from dipy.io.stateful_tractogram import StatefulTractogram

from trx.trx_file_memmap import TrxFile
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imports from trx need to be optional

@arokem arokem changed the title WIP: incorporate TRX incorporate TRX Aug 23, 2023
@arokem arokem changed the title incorporate TRX Incorporate TRX Aug 23, 2023
@arokem arokem marked this pull request as ready for review August 23, 2023 13:47
@arokem
Copy link
Collaborator Author

arokem commented Aug 23, 2023

This is now ready for review. It is working on my laptop with the option of running it as usual with trk outputs, or, by adding trx=True to the tracking parameters, it can produce trx files. I am not sure that it is making full use of the advantages of trx as currently written, but it's a start.

@36000
Copy link
Collaborator

36000 commented Aug 31, 2023

What if we made this as optional for storing the results of bundle recognition, but always used for the results of the initial tractogaphy. This would save disk space and I think would have no downsides (we don't load the entire tractographies into MRtrix except on rare occasions, and we can just convert it then).

@36000
Copy link
Collaborator

36000 commented Sep 7, 2023

If these pass, this is good to merge

AFQ/tasks/tractography.py Outdated Show resolved Hide resolved
@arokem arokem added this to the pyAFQ 1.1 milestone Sep 8, 2023
@arokem arokem modified the milestones: pyAFQ 1.1, pyAFQ 1.1.1 Sep 8, 2023
@36000 36000 merged commit e9dfc21 into yeatmanlab:master Sep 9, 2023
8 checks passed
elif streamlines.endswith(".trx"):
is_trx = True
trx = load_trx(streamlines, img)
trx.streamlines._data = trx.streamlines._data.astype(np.float32)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to cast to float32 here? If the trx is saved at float16 this would double memory usage of this without increasing precision.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was so it would play nice with certain dipy cipy functions which I guess assume float32. We will have to make these functions compatible with float16 in the long run, but I figured this was good for now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense!

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.

2 participants