-
Notifications
You must be signed in to change notification settings - Fork 262
Selecting on data_per_streamline
#729
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
Comments
In case you are wondering, also:
|
Surely, I am not supposed to do the following?
Though it does seem to have the expected behavior (at least in this case). |
Just to be clear, it looks like you're in the situation where you load a large number of streamlines, want to make a copy of a subset, and release the memory for all of the rest? From a quick glance through the code, this use case wasn't really coded for. Perhaps it would be best to add a method to allow for making a pruned copy? I'll note that the nibabel/nibabel/streamlines/array_sequence.py Lines 120 to 122 in ad0b13f
If that's a bug, it may be that, after fixing, you could do something like the following: new_tgram = sl.Tractogram(tgram.streamlines.data) I'll rope @MarcCote in again, in hopes he can shine some light here. I'm only familiar with this API from a few recent PRs. |
That was the intended behavior but I agree it might be unexpected when looking under the hood. The advanced indexing on
I think we want with that approach (i.e. explicitly calling |
Thanks! That actually seems rather reasonable. More generally, I think that a documentation tutorial on streamlines would be useful to have. Maybe that's something I could do at the DIPY workshop in a couple of weeks. |
That would be awesome. I'd be happy to review it. Sadly, I can't make the Dipy workshop but maybe I can set some time aside and join remotely. |
I am trying to use the
data_per_streamline
attribute to select streamlines from within aTractogram
object. I am running into the following behavior.I initialize a very simple tractogram object. The first streamline has the
data_per_streamline
foo
key set to0
and the other two streamlines have this set to1
:I can find the right streamlines using
np.where
:It even looks like it's doing the right thing when I use this for indexing:
But under the hood:
Why is it still holding onto all of the data? Is there some way to drop the data for the first (not selected) streamline?
The text was updated successfully, but these errors were encountered: