Focus Annotator - a tool for annotation the focal plane of a part of an image

Overview

Focus Annotator

Focus Annotator is a tool for annotation the focal plane of a part of an image. It is a tool I built in rust as part of my master's thesis to make image focus annotations for z-stack images quicker.

image

Installation

You can either download the latest release here or compile from source.

Compilation Instructions

Docker

The tool can be compiled with docker-compose:

  • Linux Version docker-compose up (compiles to AppImage)
  • Windows Version: docker-compose -f docker-compose.windows.yml up (the resulting file is packaged as package.zip, dependencies included)

Native

The prerequisits can be installed as described in the gtk4-rs book:

After the prerequisits are installed you can run/build the tool as is usual for rust:

cargo run

Usage

When opening the program open a .json file that describes where to find the images. The file should look as follows.

[
    {
        "images": [
            {
                "image_path": "img/30_753da05d-cd1e-45c5-8593-003323e0bb69_I00243_X013_Y003_Z4648.jpg",
                "neighbours": [
                    "img/30_753da05d-cd1e-45c5-8593-003323e0bb69_I00243_X013_Y003_Z4648.jpg",
                    "img/30_753da05d-cd1e-45c5-8593-003323e0bb69_I00243_X013_Y003_Z4648.jpg",
                    "img/30_753da05d-cd1e-45c5-8593-003323e0bb69_I00243_X013_Y003_Z4648.jpg",
                    "img/30_753da05d-cd1e-45c5-8593-003323e0bb69_I00243_X013_Y003_Z4648.jpg",
                    "img/30_753da05d-cd1e-45c5-8593-003323e0bb69_I00243_X013_Y003_Z4648.jpg",
                    "img/30_753da05d-cd1e-45c5-8593-003323e0bb69_I00243_X013_Y003_Z4648.jpg",
                    "img/30_753da05d-cd1e-45c5-8593-003323e0bb69_I00243_X013_Y003_Z4648.jpg",
                    "img/30_753da05d-cd1e-45c5-8593-003323e0bb69_I00243_X013_Y003_Z4648.jpg"
                ]
            }
        ],
        "best_index": 0
    }
    {
        "images": [
            {
                "image_path": "img/31/I03987/I03987_X008_Y026_Z5498_0_1200.jpg",
                "neighbours": [
                    null,
                    null,
                    null,
                    "img/31/I03987/I03987_X008_Y026_Z5498_0_1125.jpg",
                    null,
                    "img/31/I03987/I03987_X008_Y026_Z5498_75_1125.jpg",
                    "img/31/I03987/I03987_X008_Y026_Z5498_75_1200.jpg",
                    null
                ]
            },
            {
                "image_path": "img/31/I03988/I03988_X008_Y026_Z5566_0_1200.jpg",
                "neighbours": [
                    null,
                    null,
                    null,
                    "img/31/I03988/I03988_X008_Y026_Z5566_0_1125.jpg",
                    null,
                    "img/31/I03988/I03988_X008_Y026_Z5566_75_1125.jpg",
                    "img/31/I03988/I03988_X008_Y026_Z5566_75_1200.jpg",
                    null
                ]
            },
            {
                "image_path": "img/31/I03989/I03989_X008_Y026_Z5703_0_1200.jpg",
                "neighbours": [
                    null,
                    null,
                    null,
                    "img/31/I03989/I03989_X008_Y026_Z5703_0_1125.jpg",
                    null,
                    "img/31/I03989/I03989_X008_Y026_Z5703_75_1125.jpg",
                    "img/31/I03989/I03989_X008_Y026_Z5703_75_1200.jpg",
                    null
                ],
            }
        ],
        "best_index": null
    }
]

The json file contains a list of unamed objets. Each object corresponds to one focus stack. Best index is set to null for non annotated images and is a number corresponding to the image in focus once annotated. The array image present in each focus stack contains objects tat represents the individual images.

Each individual image has an image_path (mandatory) which is relative to the position of the json file, and 8 (!) neighbours (which are allowed to be set to null). Neighbours are represented indexed the following way:

0 1 2
3 - 4
5 6 7

You are allowed to store additional data in focus stack objects (and image objects) and this should be preserved when using the tool, however, make sure to back up the metadata file before using the tool.

Keyboard shortcuts

The tool supports keyboard shortcuts:

  • w - move up in the focus stack
  • s - move down in the focus stack
  • b - back - go back one image
  • n - next - skip image
  • m - mark - mark current image in the z-stack as in focus and go to next image

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

You might also like...
A simple image average color extractor written in 🦀 Rust

A simple image average color extractor written in 🦀 Rust

A simple command-line utility (and Rust crate!) for converting from a conventional image file (e.g. a PNG file) into a pixel-art version constructed with emoji
A simple command-line utility (and Rust crate!) for converting from a conventional image file (e.g. a PNG file) into a pixel-art version constructed with emoji

EmojiPix This is a simple command-line utility (and Rust crate!) for converting from a conventional image file (e.g. a PNG file) into a pixel-art vers

A Simple Image to Ascii converter in Rust
A Simple Image to Ascii converter in Rust

Image to Ascii A Simple Image to Ascii converter in Rust Brief 📖 In my way to learn Rust i decided to make this converter. Challenges 🐢 new to Rust

Rust library for fast image resizing with using of SIMD instructions.

fast_image_resize Rust library for fast image resizing with using of SIMD instructions. CHANGELOG Supported pixel formats and available optimisations:

Experimental vectorized-raster image editor

Sverg Sverg is an experimental image editor that leverages the power of modern hardware so that you can create images as if they were raster images (e

Rust port of the Quite Okay Image format

qoi_rs What is this? A pretty boring Rust translation of qoi. Status What's there Encode & Decode works Results agree with the C implementation for al

A Rust encoder/decoder for Dominic Szablewski's QOI format for fast, lossless image compression.

QOI - The “Quite OK Image” format This is a Rust encoder and decoder for Dominic Szablewski's QOI format for fast, lossless image compression. See the

An advanced image processing library for Rust.

ImageProc Maintainers: @chyh1990 Note: this project is under active depvelopment, API may change! imageproc is a advanced image proccessing library fo

Web-app that simulates different types of color blindness from a user-provided input image.

What is Dalted? Web-app that simulates different types of color blindness from a user-provided input image. Resources The color blindness simulation i

Comments
  • Opening a file on windows crashes the program

    Opening a file on windows crashes the program

    Possibly this is an issue related to joining of paths as it gives the following error:

    "stream did not contain valid UTF-8", src:main.rs:110:73
    
    bug windows 
    opened by 13hannes11 1
  • Opening another file causes a panic

    Opening another file causes a panic

    This is most likely due to the ways state currently is kept in the program. A cleaner way would be to use a separate thread that manages the state and is communicated to by using channels:

    A channel example from this blog:

    use rand::Rng;
    use std::{collections::HashMap, sync::mpsc};
    
    fn do_work(tx: mpsc::Sender<u64>) {
        let mut rng = rand::thread_rng();
        for _ in 0..100_000 {
            let key: u64 = rng.gen_range(0..10);
            tx.send(key).unwrap();
        }
    }
    
    fn main() {
        let mut m: HashMap<u64, u64> = Default::default();
    
        crossbeam::scope(|s| {
            let (tx1, rx) = mpsc::channel();
            let tx2 = tx1.clone();
            let m = &mut m;
    
            s.spawn(move |_| {
                while let Ok(key) = rx.recv() {
                    *m.entry(key).or_default() += 1
                }
            });
            s.spawn(move |_| do_work(tx1));
            s.spawn(move |_| do_work(tx2));
        })
        .unwrap();
    
        println!("map = {m:#?}");
        println!("sum = {}", m.values().copied().sum::<u64>());
    }
    
    bug 
    opened by 13hannes11 1
  • CICD avoid running twice on tagged commits

    CICD avoid running twice on tagged commits

    This can be done by either only running on tags to build a release or by having separate actions.

    Not doing this can result in issues regarding artefact uploads when the tag is pushed at the same time as the original commit.

    CI/CD 
    opened by 13hannes11 0
Releases(v0.1.1)
Owner
Hannes Kuchelmeister
Student at Uppsala University
Hannes Kuchelmeister
Lust is a static image server designed to automatically convert uploaded image to several formats and preset sizes

What is Lust? Lust is a static image server designed to automatically convert uploaded image to several formats and preset sizes with scaling in mind.

Harrison Burt 242 Dec 22, 2022
Takes a folder of images (as a palette), and an image, and figures out how to tile the palette to resemble the image!

Takes a folder of images (as a palette), and an image, and figures out how to tile the palette to resemble the image!

Jacob 258 Dec 30, 2022
Rust Lean Image Viewer - Fast and configurable image viewer inspired by JPEGView by David Kleiner

Rust Lean Image Viewer - Fast and configurable image viewer inspired by JPEGView by David Kleiner

3top1a 4 Apr 9, 2022
tai (Terminal Ascii Image) tool to convert images to ascii written in Rust

TAI Terminal Ascii Image A tool to convert images to ascii art written in Rust ?? Notes This tool is still in development stage. Contributions All Con

Mustafa Salih 258 Dec 5, 2022
Signed distance field font and image command line tool based on OpenCL.

SDFTool Signed distance field font and image command line tool based on OpenCL. Build Windows Run cargo build --release in Visual Studio developer x64

弦语蝶梦 7 Oct 16, 2022
Image processing operations

imageproc An image processing library, based on the image library. There may initially be overlap between the functions in this library and those in i

image-rs 512 Jan 8, 2023
Image Compression Algorithm

Image Compression Algorithm ?? A new lossless image compression algorithm. In the newest version the algorithm performs rather good, but manages to su

Hannes 31 May 10, 2022
Artsy pixel image to vector graphics converter

inkdrop inkdrop is an artsy bitmap to vector converter. Command line interface The CLI binary is called inkdrop-cli and reads almost any image bitmap

Matthias Vogelgesang 62 Dec 26, 2022
Automated image compression for efficiently distributing images on the web.

Imager Apparently this project made it into the GitHub Archive Program. About Imager is a tool for automated image compression, and can competitively

Imager IO 487 Dec 25, 2022
Open Graphic Image Writer

Open Graphic Image Writer Documentation You can generate Open Graphic Image dynamically. A CSS-like API. You can generate image by using template imag

keiya sasaki 46 Dec 15, 2022