Mouse-Imaging-Centre / pyminc

A python interface to the MINC 2 library, allowing use of numpy arrays to access MINC data, and other such similar goodies, developed by Jason Lerch
http://en.wikibooks.org/wiki/MINC/Tutorials
Other
13 stars 8 forks source link

fix getHyperslab and create a function getHyperslabNormalized #7

Open mcvaneede opened 10 years ago

mcvaneede commented 10 years ago

Currently the function getHyperslab if the data of an object is not loaded yet, you could get some unexpected results if your dtype is not float or double. In that case, the function miget_hyperslab_normalized is called, and the actual range of your input data is mapped onto the range of your dtype. For example, if your input file has float values from 1.0 to 3.0, and your dtype is ubyte, the value 1.0 will be mapped to 0 and 3.0 to 255. This is probably not what you would have expected from this function. That functionality should be implemented in a function called getHyperslabNormalized, and this function should simply return values between 1 and 3