NIfTI-Image-Converter icon indicating copy to clipboard operation
NIfTI-Image-Converter copied to clipboard

Normalizing image brightness implemented

Open dvnie1 opened this issue 2 years ago • 2 comments

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.

dvnie1 avatar Aug 25 '23 12:08 dvnie1

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!

vcasellesb avatar May 08 '24 07:05 vcasellesb

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 :)

dvnie1 avatar May 16 '24 10:05 dvnie1