add code
Browse files
app.py
CHANGED
|
@@ -82,12 +82,9 @@ def select_frame(frame_idx, volume):
|
|
| 82 |
img_uint8 = (norm_img * 255).astype(np.uint8)
|
| 83 |
return img_uint8
|
| 84 |
|
| 85 |
-
|
| 86 |
def plot_pixel_histogram(evt, volume):
|
| 87 |
-
|
| 88 |
-
return None
|
| 89 |
-
x, y = evt.index # evt.index 是 (col, row)
|
| 90 |
-
# 注意 volume shape是 (H, W, T),索引为 [y, x, :]
|
| 91 |
values = volume[y, x, :]
|
| 92 |
fig = go.Figure()
|
| 93 |
fig.add_trace(go.Scatter(y=values, mode="lines+markers"))
|
|
@@ -114,8 +111,6 @@ with gr.Blocks() as demo:
|
|
| 114 |
# 点击图像像素,绘制强度曲线
|
| 115 |
# image_display.select(plot_pixel_histogram, inputs=[gr.EventData(), volume_state], outputs=histogram)
|
| 116 |
|
| 117 |
-
|
| 118 |
-
image_display.select(plot_pixel_histogram, inputs=[gr.SelectData(), volume_state], outputs=histogram)
|
| 119 |
-
|
| 120 |
|
| 121 |
demo.launch()
|
|
|
|
| 82 |
img_uint8 = (norm_img * 255).astype(np.uint8)
|
| 83 |
return img_uint8
|
| 84 |
|
| 85 |
+
|
| 86 |
def plot_pixel_histogram(evt, volume):
|
| 87 |
+
x, y = evt.index
|
|
|
|
|
|
|
|
|
|
| 88 |
values = volume[y, x, :]
|
| 89 |
fig = go.Figure()
|
| 90 |
fig.add_trace(go.Scatter(y=values, mode="lines+markers"))
|
|
|
|
| 111 |
# 点击图像像素,绘制强度曲线
|
| 112 |
# image_display.select(plot_pixel_histogram, inputs=[gr.EventData(), volume_state], outputs=histogram)
|
| 113 |
|
| 114 |
+
image_display.select(plot_pixel_histogram, inputs=[volume_state], outputs=histogram)
|
|
|
|
|
|
|
| 115 |
|
| 116 |
demo.launch()
|