amazinghaha commited on
Commit
8e6e33b
1 Parent(s): 96648e9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -133,19 +133,30 @@ def get_ROI(input_file):
133
 
134
  def change_image_slice_x(slice):
135
  image_slice = Image_3D[:, :, slice - 1]
 
 
 
 
136
  return image_slice
137
 
138
 
139
  def change_image_slice_y(slice):
140
  image_slice = Image_3D[:, slice - 1, :]
 
 
 
 
 
141
  return image_slice
142
 
143
 
144
  def change_image_slice_z(slice):
145
  image_slice = Image_3D[slice - 1, :, :]
146
- return image_slice
147
-
 
148
 
 
149
  def get_medical_message():
150
  global Current_name
151
  if Current_name == None:
 
133
 
134
  def change_image_slice_x(slice):
135
  image_slice = Image_3D[:, :, slice - 1]
136
+ cut_thre = np.percentile(image_slice, 99.9) # 直方图99.9%右侧值不要
137
+ image_slice[image_slice >= cut_thre] = cut_thre
138
+ image_slice = (((np.max(image_slice) -image_slice)/(np.max(image_slice) - np.min(image_slice)))*255).astype(np.int16)
139
+ a = 5
140
  return image_slice
141
 
142
 
143
  def change_image_slice_y(slice):
144
  image_slice = Image_3D[:, slice - 1, :]
145
+ cut_thre = np.percentile(image_slice, 99.9) # 直方图99.9%右侧值不要
146
+ image_slice[image_slice >= cut_thre] = cut_thre
147
+ image_slice = (((np.max(image_slice) - image_slice) / (np.max(image_slice) - np.min(image_slice))) * 255).astype(
148
+ np.int16)
149
+
150
  return image_slice
151
 
152
 
153
  def change_image_slice_z(slice):
154
  image_slice = Image_3D[slice - 1, :, :]
155
+ cut_thre = np.percentile(image_slice, 99.9) # 直方图99.9%右侧值不要
156
+ image_slice[image_slice >= cut_thre] = cut_thre
157
+ image_slice = (((np.max(image_slice) - image_slice) / (np.max(image_slice) - np.min(image_slice))) * 255).astype(np.int16)
158
 
159
+ return image_slice
160
  def get_medical_message():
161
  global Current_name
162
  if Current_name == None: