Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

nibabel get_data vs get_fdata #55

Open
akeshavan opened this issue Dec 18, 2018 · 5 comments
Open

nibabel get_data vs get_fdata #55

akeshavan opened this issue Dec 18, 2018 · 5 comments

Comments

@akeshavan
Copy link
Collaborator

for some odd reason img.get_fdata kills my python kernel, but the deprecated get_data does not. I'm not sure how to debug this because everything just dies!

@akeshavan
Copy link
Collaborator Author

but we could just use img_data = np.asarray(img.dataobj) in the drop_outliers_fn function

@arokem
Copy link
Member

arokem commented Dec 18, 2018

Seems like something the nibabel developers might want to know.

@matthew-brett
Copy link
Member

We know :) - when I changed the default, I knew it would be a problem for some people. I'm sure what's happening is that the floating point version of the image is too large to fit into memory along with everything else. get_fdata is meant to be a safe high-level method, in the sense that it's behavior is predictable, but sometimes you'll need to optimize for memory by using workarounds like np.array(img.dataobj).

@arokem
Copy link
Member

arokem commented Dec 18, 2018

Thanks Matthew! So np.array(img.dataobj) is prefereable to get_data for long-term?

@matthew-brett
Copy link
Member

Yes, get_data will go away eventually. np.array(img.dataobj) also gives the correct impression of being something a bit dark and advanced.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants