Code Monkey home page Code Monkey logo

labelslide's Introduction

LabelSlide

LabelSlide is a slide annotation tool and label object bounding boxes in virtual slides (generally used in pathology)

example

Feature

LabelSlide is based on B/S structure and written in Python.
Using OpenSlide to read the virtual slides and create DeepZoom Image.
Then view the zoomable image in browser by OpenSeadragon.
Adding Fabric.js canvas to draw label box overlaying the OpenSeadragon viewer.
The webpage build with Bootstrap

Installation

Build from source

Python

pip install -r requirements.txt
python label_slide.py

access 127.0.0.1:5000 (as default)

If show error "Could not find module 'libopenslide-0.dll'". Please download libvips and unzip to bin folder

Usage

Config

There's two config file.

app_config.py
Including HOST, PORT for the app and the SLIDE_CONFIG for slide config(the file path of config.yaml).
ps: parameter name must be uppercase

config.yaml
Containing the following parameters
slide_dir: the directory where slides are kept. label_dir: the directory where the annotation will be saved to.
class: pre-defined classes including id, name and color.

For example:

slide_dir: D:\Dataset\slides
label_dir: D:\Dataset\labels
class:
- id: 0
  name: A
  color: '#2196f3'
- id: 1
  name: B
  color: '#0014a8'

ps: the class id must be integer and the color must be hex format.
All content in config.yaml could be modified from webpage

Slide

In theory, the tool can read virtual slides in several formats because using OpenSlide:

But only try MIRAX(.mrxs) under development.
If you want to read slide in other formats, you should modify code in label_tool.py by yourself.

Annotation

Support rectangle box and polygon box currently.

Hotkeys

Key Function
q View Mode
e Create new rectangle box
r Create new polygon box
del Delete the selected rect box

Annotation file
One slide corresponds to one annotation file.
Take annotation for MIRAX (.mrxs) as an example

slide: C20200174
boxes:
- class: 0
  type:rect
  x: 30749
  y: 70121
  w: 468
  h: 434
- class: 1
  type: poly
  points:
  - x: 33813
    y: 62176
  - x: 33931
    y: 62571
  - x: 34099
    y: 62308

x,y is the top left pixel and w,h is the region size in the level 0 reference frame(highest resolution)

Related

License

LGPL-2.1 License

labelslide's People

Contributors

steven22tom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.