andreped commited on
Commit
0c25746
1 Parent(s): cd631f2

Demo improvements

Browse files
Files changed (2) hide show
  1. demo/src/gui.py +4 -4
  2. demo/src/utils.py +2 -2
demo/src/gui.py CHANGED
@@ -11,7 +11,7 @@ class WebUI:
11
  self.pred_images = []
12
 
13
  # @TODO: This should be dynamically set based on chosen volume size
14
- self.nb_slider_items = 100
15
 
16
  self.class_name = class_name
17
  self.cwd = cwd
@@ -34,9 +34,9 @@ class WebUI:
34
  def load_mesh(self, mesh_file_name):
35
  path = mesh_file_name.name
36
  run_model(path)
37
- nifti_to_glb("prediction-livermask.nii")
38
  self.images = load_ct_to_numpy(path)
39
- self.pred_images = load_pred_volume_to_numpy("./prediction-livermask.nii")
40
  self.slider = self.slider.update(value=2)
41
  return "./prediction.obj"
42
 
@@ -74,7 +74,7 @@ class WebUI:
74
 
75
  with gr.Row():
76
  gr.Examples(
77
- examples=[self.cwd + "test-volume.nii"],
78
  inputs=file_output,
79
  outputs=file_output,
80
  fn=self.upload_file,
 
11
  self.pred_images = []
12
 
13
  # @TODO: This should be dynamically set based on chosen volume size
14
+ self.nb_slider_items = 160
15
 
16
  self.class_name = class_name
17
  self.cwd = cwd
 
34
  def load_mesh(self, mesh_file_name):
35
  path = mesh_file_name.name
36
  run_model(path)
37
+ nifti_to_glb("./prediction.nii.gz")
38
  self.images = load_ct_to_numpy(path)
39
+ self.pred_images = load_pred_volume_to_numpy("./prediction.nii.gz")
40
  self.slider = self.slider.update(value=2)
41
  return "./prediction.obj"
42
 
 
74
 
75
  with gr.Row():
76
  gr.Examples(
77
+ examples=[self.cwd + "lung_001.nii.gz"],
78
  inputs=file_output,
79
  outputs=file_output,
80
  fn=self.upload_file,
demo/src/utils.py CHANGED
@@ -11,8 +11,8 @@ def load_ct_to_numpy(data_path):
11
 
12
  data = np.rot90(data, k=1, axes=(0, 1))
13
 
14
- data[data < -150] = -150
15
- data[data > 250] = 250
16
 
17
  data = data - np.amin(data)
18
  data = data / np.amax(data) * 255
 
11
 
12
  data = np.rot90(data, k=1, axes=(0, 1))
13
 
14
+ data[data < -1024] = 1024
15
+ data[data > 1024] = 1024
16
 
17
  data = data - np.amin(data)
18
  data = data / np.amax(data) * 255