Spaces:
Sleeping
Sleeping
amazinghaha
commited on
Commit
·
722f094
1
Parent(s):
6d0dd24
Update app.py
Browse files
app.py
CHANGED
@@ -119,8 +119,12 @@ def get_Image_reslice(input_file):
|
|
119 |
'''得到图像 返回随即层'''
|
120 |
global Image_3D
|
121 |
global Current_name
|
122 |
-
|
123 |
-
|
|
|
|
|
|
|
|
|
124 |
Image_3D = (np.max(Image_3D)-Image_3D)/(np.max(Image_3D)-np.min(Image_3D))
|
125 |
random_z = np.random.randint(0, Image_3D.shape[0])
|
126 |
image_slice_z = Image_3D[random_z,:,:]
|
@@ -213,7 +217,7 @@ class App:
|
|
213 |
gr.Examples(
|
214 |
#examples=r'F:\WorkSpacing\XS_data\FenQi\chuli_data\ALL\358small_exp4_cut_128_256_128\1093978_A_L_MRI.nii.gz',
|
215 |
examples=[os.path.join(os.path.dirname(__file__), "1093978_A_L_MRI.nii.gz")],
|
216 |
-
inputs=
|
217 |
outputs=[out1, out2, out3,slider1,slider2,slider3],
|
218 |
fn=get_Image_reslice,
|
219 |
cache_examples=True,
|
|
|
119 |
'''得到图像 返回随即层'''
|
120 |
global Image_3D
|
121 |
global Current_name
|
122 |
+
if isinstance(input_file, str):
|
123 |
+
input_file=input_file
|
124 |
+
else:
|
125 |
+
input_file=input_file.name
|
126 |
+
Image_3D = sitk.GetArrayFromImage(sitk.ReadImage(input_file))
|
127 |
+
Current_name = input_file.split(os.sep)[-1].split('.')[0].rsplit('_',1)[0]
|
128 |
Image_3D = (np.max(Image_3D)-Image_3D)/(np.max(Image_3D)-np.min(Image_3D))
|
129 |
random_z = np.random.randint(0, Image_3D.shape[0])
|
130 |
image_slice_z = Image_3D[random_z,:,:]
|
|
|
217 |
gr.Examples(
|
218 |
#examples=r'F:\WorkSpacing\XS_data\FenQi\chuli_data\ALL\358small_exp4_cut_128_256_128\1093978_A_L_MRI.nii.gz',
|
219 |
examples=[os.path.join(os.path.dirname(__file__), "1093978_A_L_MRI.nii.gz")],
|
220 |
+
inputs="text",
|
221 |
outputs=[out1, out2, out3,slider1,slider2,slider3],
|
222 |
fn=get_Image_reslice,
|
223 |
cache_examples=True,
|