{"id":27951769,"url":"https://github.com/sspathak/bactiscan","last_synced_at":"2025-05-07T16:26:24.875Z","repository":{"id":175176181,"uuid":"653458747","full_name":"sspathak/BactiScan","owner":"sspathak","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-18T21:21:00.000Z","size":3202,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-18T22:27:20.569Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sspathak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-06-14T05:14:19.000Z","updated_at":"2024-04-18T22:27:20.570Z","dependencies_parsed_at":"2023-07-09T22:01:01.639Z","dependency_job_id":"fccd12a8-432b-43df-8172-715de47179b6","html_url":"https://github.com/sspathak/BactiScan","commit_stats":null,"previous_names":["sspathak/bactiscan"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sspathak%2FBactiScan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sspathak%2FBactiScan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sspathak%2FBactiScan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sspathak%2FBactiScan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sspathak","download_url":"https://codeload.github.com/sspathak/BactiScan/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252914425,"owners_count":21824381,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-07T16:26:24.103Z","updated_at":"2025-05-07T16:26:24.865Z","avatar_url":"https://github.com/sspathak.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BactiScan\nAre you a passionate researcher seeking a powerful and efficient solution to count bacteria in microscope images? Look no further! Introducing BactiScan - the cutting-edge app designed exclusively for scientists like you.\n\n\n🔍 Explore Features:\n\n✔️ Import images from your gallery or capture them with your camera for instant analysis.\\\n✔️ Effortlessly rename and organize your scans, making retrieval a breeze.\\\n✔️ Swiftly search for specific scans based on names for enhanced productivity.\\\n✔️ Utilize the power of ImageJ.JS for unrivaled image processing, all within your device.\\\n✔️ Rest assured, your data remains secure - no uploads to external servers!\n\n📸 Seamless Export:\nAfter processing, effortlessly export your results to the gallery for further analysis and seamless integration with your workflow.\n\n🌟 User-Friendly Interface:\nExperience the epitome of user-friendly design with BactiScan's minimalist and sleek UI. Navigate through functions with ease and concentrate on what truly matters - your research!\n\nUnleash the full potential of your scientific endeavors with BactiScan. Download now and experience the joy of precise bacterial analysis at your fingertips!\n\n# Design Decisions:\n\n## API:\n\n[//]: # (Decided to go for webview-based app. Some advantages of doing so include  - no need to have server running constantly, images are not sent to any external service and all computation happens on the device)\n\nAPI provided by imjoy is a WASM based JavaScript port of the ImageJ Java API. It is a very powerful API and can be \nused to perform almost everything that ImageJ can do. \\\nThe API uses CheerpJ to compile Java code to JavaScript. The best way to use the API is to refer to the Java documentation \nfor ImageJ and then use the JavaScript API to perform the tasks by using CheerpJ's functions to run Java code. \n\n\n## Mobile App:\n\nThe app is built using React Native. The app uses a webview to load the Imjoy API.\n\n### Why webview?\n\nI decided to use a webview for the app because the ImageJ.JS API does not have a React Native implementation. \nThe other option was to use a server to run the API and then make calls to the server from the app. However, this would\nrequire the server to be running constantly and would also require the images to be sent to the server. Furthermore, it \nwouldn't have made full use of the API as the API is very powerful and can be used to perform a lot of tasks and is \ndesigned to run in the browser. \n\n\n### Why React Native?\n\nReact Native is a cross-platform framework that allows us to build native apps for both Android and iOS using JavaScript. \\\nIt is a very powerful framework and is used by a lot of companies to build their apps. \\\nIt is also very easy to use and has a lot of community support.\n\n### Communication between React Native and webview:\n\nThe communication between React Native and the webview is done using the `react-native-webview` library. Transferring \ndata between the webview and React Native can be tricky. The `react-native-webview` library provides a `postMessage` \nfunction that can be used to send data from the webview to React Native. However, the `postMessage` function can only\nsend strings. To send objects, we need to use the `injectJavaScript` function. This function can be used to run\nJavaScript code in the webview. We can use this function to run a function in the webview that can then use the\n`postMessage` function to send the data to React Native. \n\nThe `react-native-webview` library provides an `onMessage` function that can be used to listen for messages from\nthe webview. However, this function can only listen for strings. To listen for objects, we need to use the \n`onMessageReceived` function. This function can be used to run a function in the webview that can then use the\n`postMessage` function to send the data to React Native. \n\nAn RPC-like design was chosen for communication between React Native and the webview. At first, the react native\nside injects a javascript function into the webview which listens for messages posted to the webview. Now we have \nessentially created a channel of communication capable of sending messages from react native and receiving messages on\nthe webview end. This function is designed in such a way that responses from the function are sent back to the webview \nusing the \"postMessage\" function and the react native app listens for these messages using the \"onMessageReceived\" \nfunction. \n\nThe documentation for the Imjoy API is extensive but can be challenging to navigate. Furthermore, some of the early version of \nthe API are very buggy. The API is available as a javascript module as well as a python package that you can simply pip install. \nHowever, I faced some challenges with using the Python API.\n\nSome future improvements to the app are listed below:\n\nUI Improvements:\n1. Create a folder structure so that researchers can create a folder for every bacterium group they are monitoring instead of having all scans in one folder\n2. Allow researchers to add tags to scans and allow for searching for tags\n3. The order of images displayed after the scan is processed needs to be fixed so that the particle analysis output is displayed first instead of the mask image\n4. Ability to save processed images to Google Drive as backup\n5. Ability to modify the macro that the API runs in the backend -- ideally we want to allow researchers to record a macro they would like to run and simply copy-paste the macro into the app and have to run the macro for input images and also capture intermediate images and display them on the app\n\nPerformance improvements:\n1. As of Jul 25, 2023, a new webview is created every time a new scan is opened in the app and only one image is processed at a time. This is done only for development purposes and ease of debugging and is not a limitation of the API. More work needs to be put in to parallelize the image processing\n2. The imageJ webview can be kept permanently connected and hidden in the background. This way operations can be performed on the webview in the background.\n3. The entire app can be rewritten as a progressive web app (PWA), installed on devices using Safari (for iPhones), and can completely avoid having to go through the App store. PWA capabilities need to be evaluated carefully before making this decision. \n4. Currently, the app does not run when the device is not connected to the internet. But, with a few modifications, it should be possible to make the app run offline. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsspathak%2Fbactiscan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsspathak%2Fbactiscan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsspathak%2Fbactiscan/lists"}