Skip to content

Conversation

@dvnie1
Copy link

@dvnie1 dvnie1 commented Aug 25, 2023

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 added 2 commits August 25, 2023 14:06
…ay = nibabel.load(inputfile).get_fdata() [get_data() -> get_fdata()], because prev version caused an error, with the changes it works
…l output images is the same, resulting in a heterogeneous image sequence
@vcasellesb
Copy link
Contributor

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!

@dvnie1
Copy link
Author

dvnie1 commented May 16, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants