Read data from image associated with files
Parameters : | img : SpatialImage
prefer : str, optional
|
---|---|
Returns : | arr : ndarray
|
Notes
Summary: please use the get_data method of img instead of this function unless you are sure what you are doing.
In general, you will probably prefer prefer='scaled', because this gives the data as the image format expects to return it.
Use prefer == ‘unscaled’ with care; the modified Analyze-type formats such as SPM formats, and nifti1, specify that the image data array is given by the raw data on disk, multiplied by a scalefactor and maybe with the addition of a constant. This function, with unscaled returns the data on the disk, without these format-specific scalings applied. Please use this funciton only if you absolutely need the unscaled data, and the magnitude of the data, as given by the scalefactor, is not relevant to your application. The Analyze-type formats have a single scalefactor +/- offset per image on disk. If you do not care about the absolute values, and will be removing the mean from the data, then the unscaled values will have preserved intensity ratios compared to the mean-centered scaled data. However, this is not necessarily true of other formats with more complicated scaling - such as MINC.