Reputation: 359
I have a .tif file from a CT scan which I want to visualize as an image. And later use for training a Convolutional Neural Network.
I would like to preserve as much as possible the original format.
import numpy as np import tifffile as tiff a = tiff.imread(local_path+'demd122000_MLO_Left.tif')
a.shape
Out[16]: (227, 227, 3)
np.max(a)
Out[6]: 3590
a.dtype
Out[19]: dtype('uint16')
Which library can show this kind of images?
How could I normalize it without losing information?
Upvotes: 0
Views: 409
Reputation: 359
This code fixes the issue but is reducing the range (normalizing) of the values of the original if file.
cv2.imshow('Title', a.astype(np.float32)/np.max(a))
Upvotes: 1