Spaces:
Running
on
T4
Running
on
T4
Update mono/utils/transform.py
Browse files- mono/utils/transform.py +6 -1
mono/utils/transform.py
CHANGED
@@ -399,7 +399,12 @@ def gray_to_colormap(img, cmap='rainbow'):
|
|
399 |
|
400 |
img[img<0] = 0
|
401 |
mask_invalid = img < 1e-10
|
402 |
-
img = img / (img.max() + 1e-8)
|
|
|
|
|
|
|
|
|
|
|
403 |
norm = matplotlib.colors.Normalize(vmin=0, vmax=1.1)
|
404 |
cmap_m = matplotlib.cm.get_cmap(cmap)
|
405 |
map = matplotlib.cm.ScalarMappable(norm=norm, cmap=cmap_m)
|
|
|
399 |
|
400 |
img[img<0] = 0
|
401 |
mask_invalid = img < 1e-10
|
402 |
+
#img = img / (img.max() + 1e-8)
|
403 |
+
|
404 |
+
img_ = img.flatten()
|
405 |
+
max_value = np.percentile(img_, q=98)
|
406 |
+
img = img / (max_value + 1e-8)
|
407 |
+
|
408 |
norm = matplotlib.colors.Normalize(vmin=0, vmax=1.1)
|
409 |
cmap_m = matplotlib.cm.get_cmap(cmap)
|
410 |
map = matplotlib.cm.ScalarMappable(norm=norm, cmap=cmap_m)
|