diff --git a/public/plugins/ufish.imjoy.html b/public/plugins/ufish.imjoy.html
index add189b..1229026 100644
--- a/public/plugins/ufish.imjoy.html
+++ b/public/plugins/ufish.imjoy.html
@@ -121,7 +121,8 @@
)
self.image = None
- def load_image_from_bytes(self, file_name, img_bytes):
+ @staticmethod
+ def load_image_from_bytes(file_name, img_bytes):
_file = io.BytesIO(img_bytes)
_file.name = file_name
if file_name.endswith(".tif") or file_name.endswith(".tiff"):
@@ -134,24 +135,18 @@
image = image.squeeze()
else:
image = imageio.imread(_file)
- self.image = image
return image
- def save_image_to_bytes(self, image):
+ @staticmethod
+ def save_image_to_bytes(image):
_file = io.BytesIO()
with tifffile.TiffWriter(_file) as tif:
tif.save(image)
return _file.getvalue()
- async def predict_2d(self, image):
- image = scale_image(image)
- enh_img = await self.onnx_runner.infer_2d(image)
- df = call_spots_local_maxima(enh_img)
- coords = df.values
- return enh_img, coords
-
async def view_img_from_bytes(self, file_name, bytes_):
image = self.load_image_from_bytes(file_name, bytes_)
+ self.image = image
await self.viewer.view_image(image, name=file_name)
return image.shape
diff --git a/src/main.ts b/src/main.ts
index d7b26d1..c8b5ce0 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -12,6 +12,7 @@ import * as directives from 'vuetify/directives'
import App from './App.vue'
import router from './router'
import { isPluginMode } from './utils'
+import { useRunStore } from './stores/run'
window.app = {}
window.app.router = router
@@ -34,11 +35,15 @@ async function createApi() {
console.log("U-FISH is ready.")
}
+ async function run() {
+ const runStore = useRunStore()
+ await runStore.run()
+ }
+
return {
+ "run": async () => {},
"setup": setup,
- "run": () => {
- console.log("run")
- },
+ "runPredict": run,
}
}
@@ -50,6 +55,7 @@ async function initImJoy() {
window.app.imjoy_api = imjoy_api;
const ufish = await createApi();
window.app.ufish = ufish;
+ router.push("/predict")
await imjoy_api.export(ufish)
} else {
// start as an standalone app
diff --git a/src/stores/run.ts b/src/stores/run.ts
index ae42cfc..4d9a29d 100644
--- a/src/stores/run.ts
+++ b/src/stores/run.ts
@@ -26,6 +26,9 @@ export const useRunStore = defineStore("run", {
await waitRunable();
this.queryCount += 1;
await waitRunable();
+ },
+ setRunable(runable: boolean) {
+ this.runable = runable;
}
}
})
\ No newline at end of file
diff --git a/src/views/PredictView.vue b/src/views/PredictView.vue
index 1f554e6..25289ed 100644
--- a/src/views/PredictView.vue
+++ b/src/views/PredictView.vue
@@ -33,7 +33,8 @@