NifTK / NiftyNet

[unmaintained] An open-source convolutional neural networks platform for research in medical image analysis and image-guided therapy
http://niftynet.io
Apache License 2.0
1.36k stars 404 forks source link

Float comparison in histogram normalisation layer #472

Open fepegar opened 4 years ago

fepegar commented 4 years ago

This float comparison can be problematic.

https://github.com/NifTK/NiftyNet/blob/9b12da455dd8ed0a5e8e5060c4e939aa62d68c5a/niftynet/utilities/histogram_standardisation.py#L189

I was getting -inf in the output of the function because 1.6e-41 == 0 was returning False. I think an epsilon should be used instead: diff_perc[diff_perc < epsilon] = np.inf.