i am trying to convert nrrd file into jpg by reading that nrrd image using pynrrd and then using the pixel i am trying to form an image but the out i am getting is terrible contrast image. Below is waht i have tried
import numpy as np
import nrrd
from PIL import Image
import numpy as np
filename = "/content/drive/MyDrive/CT.nrrd"
readdata, header = nrrd.read(filename)
print(readdata.shape) # (512, 512, 504)
for i in range(504):
if i == 200:
img = np.array(readdata[:,:,i])
print(img.shape)
print(np.amax(img))
img = (np.maximum(img, 0) / img.max()) * 255.0
img = Image.fromarray(np.uint8(img), mode = "L")
img.save(f'/content/testrgb{i}.png')
break
The output i am getting is this 
Can someone please help me this
