6

I'm working with Nibabel to read some .nii files. I came across different examples and some of them use get_data() function while some of them use get_fdata() function. I could not find what the difference is in their documentation (nibabel manuel). Can anyone explain?

Thanks in advance.

umitkilic
  • 327
  • 1
  • 4
  • 17

1 Answers1

6

I found in their documentation the function-description.

Link to the documentation

get_data(caching='fill')

Return image data from image with any necessary scaling applied

get_fdata(caching='fill', dtype=)

Return floating point image data with necessary scaling applied

So to be short... the get_fdata function takes a float as parameter and return a floating point of that image data. Further informations about how they work are in the documentation.

tadashi
  • 116
  • 6
  • 1
    There is also a warning that says get_data will be deprecated in the future and get_fdata should be used. thanks for the answer. – umitkilic Feb 15 '19 at 09:04
  • Yep right. So if you want to use your application in long term i would recommend to use get_fdata. No problem! – tadashi Feb 15 '19 at 09:08
  • According to their [developer documentation](https://nipy.org/nibabel/devel/biaps/biap_0008.html), the developers of nibabel believe that loading the image with the original but possibly small data type (such as 16-bit integer) may silently cause some issues like overflow. – function2 Feb 17 '23 at 11:55