我正在从.rec文件中读取一些医学图像,这些图像在重塑后会得到很多不同的物体视角。当我将显示的图像作为第一视角(即矩阵的第一块)时,白色太浓了,这不是我想要的。当我将第50个(或更高级且具有更高灰度优势)切片作为显示的图像时,整个图像看起来都像我希望它们看起来Image 1st slice start vs 50th。有什么方法可以显示我的第一个切片并获得相同的结果?
我尝试标准化来自不同视图的矩阵,但是它没有用。有什么建议吗?
#Reading .img images and plotting them in Canvas
dtype = np.dtype('float32')
fid = open(images[0], 'r')
data = np.fromfile(fid, dtype)
image = data.reshape(201*313,558)
#Normalization of the matrix points
image_min = np.min(image)
image_max = np.max(image)
image_norm = image
image_norm = (((image_norm - image_min)/(image_max - image_min))*256)
#Iteration to display the different points of views of the object
image2 = []
for t in range(313):
img3 = image_norm[t*201:(t+1)*201,:]
image2.append(img3)
#Plotting of the image
f = Figure()
a = f.add_subplot(111)
img2 = a.imshow(image2[0], cmap='gray')
a.axis('off')
canvas = FigureCanvasTkAgg(f, root)
#Update of the image
def NextButton(self): #Button Control Next Image
global i
global a
if i>200:
i=0
img2.set_data(image2[i])
self.canvas.draw()
i+=1