NIfTI-Image-Converter
NIfTI-Image-Converter copied to clipboard
Normalizing image brightness implemented
I fixed a bug, that was caused by using nibabel.load(inputfile).get_data(). Instead nibabel.load(inputfile).get_fdata() should be used (get_fdata() instead of get_data()).
Besides that, I implemented the normalization of the input image brightness. This way, all output images have the same brightness and contrast, resulting in a heterogeneous image sequence. The issue was caused by the fact, that NIFTI images have brightness values from -3000 to 3000, but PNGs only from 0 to 255. This was solved with a basic linear transformation.
Hi! I was checking your code, and there's something interesting I don't understand. Why do you normalize images using numpy.vectorize()? Why not call normalize function directly? What does np.vectorize do?
Thanks!
Hi! I was checking your code, and there's something interesting I don't understand. Why do you normalize images using numpy.vectorize()? Why not call normalize function directly? What does np.vectorize do?
Thanks!
Hi, it is basically an inline loop. It is needed, because my normalize() function only normalises one image at a time the way I implemented it. Feel free to change it, there are surely cleaner ways of implementing this :)