Skip to content

Commit

Permalink
Merge branch 'master' into desktop/misc_adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
geneva-miller committed Aug 3, 2020
2 parents 93d05ef + d87d1a6 commit f5d8f45
Show file tree
Hide file tree
Showing 58 changed files with 4,557 additions and 2,938 deletions.
29 changes: 29 additions & 0 deletions .coveragerc
@@ -0,0 +1,29 @@
# .coveragerc to control coverage.py
[report]
# Regexes for lines to exclude from consideration
exclude_lines =
except ImportError

# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError

ignore_errors = True
# fail_under = 70
show_missing = True

omit =
**/*_test.py
env/**/*.py
venv/**/*.py
ENV/**/*.py
VENV/**/*.py
desktop/env/**/*.py
desktop/venv/**/*.py
desktop/ENV/**/*.py
desktop/VENV/**/*.py
browser/env/**/*.py
browser/venv/**/*.py
browser/ENV/**/*.py
browser/VENV/**/*.py
browser/conftest.py
36 changes: 36 additions & 0 deletions .github/workflows/browser-tests.yaml
@@ -0,0 +1,36 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: browser

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
python-version: [3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r browser/requirements.txt
pip install -r browser/requirements-test.txt
- name: Test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pytest browser --cov browser --pep8
coveralls
7 changes: 7 additions & 0 deletions .gitignore
Expand Up @@ -6,7 +6,14 @@ __pycache__/
# C extensions
*.so

# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Distribution / packaging
.Python
Expand Down
17 changes: 8 additions & 9 deletions README.md
@@ -1,4 +1,5 @@
# Caliban: Data Curation Tools for DeepCell.
[![Actions Status](https://github.com/vanvalenlab/caliban/workflows/browser/badge.svg)](https://github.com/vanvalenlab/caliban/actions)

Caliban is a segmentation and tracking tool used for human-in-the-loop data curation. It displays lineage data along with raw and annotated images. The output files prepare this information as training data for DeepCell.

Expand Down Expand Up @@ -62,7 +63,7 @@ You can use *esc* to return back to a state where no labels are selected.

Keybinds in pixel editing mode are different from those in the label-editing mode.

Annotation mode focuses on using an adjustable brush to modify annotations on a pixel level, rather than using operations that apply to every instance of a label within a frame or set of frames. The brush tool will only make changes to the currently selected value. Ie, a brush set to edit label 5 will only add or erase "5" to the annotated image.
Annotation mode focuses on using an adjustable brush to modify annotations on a pixel level, rather than using operations that apply to every instance of a label within a frame or set of frames. The brush tool will only make changes to the currently selected value. Ie, a brush set to edit label 5 will only add or erase "5" to the annotated image.

*[ (left bracket) / ] (right bracket)* - decrement/increment value that brush is applying

Expand All @@ -76,7 +77,7 @@ Annotation mode focuses on using an adjustable brush to modify annotations on a

*r* - turn on "conversion brush" setting, which changes brush behavior so that one label value is overwritten with another label value. No other labels are affected, and conversion brush will not draw on background. After turning on conversion brush, click on cell labels as prompted to set brush values.

*t* - threshold to predict annotations based on brightness. After turning this on, click and drag to draw a bounding box around the cell you wish to threshold. Make sure to include some background in the bounding box for accurate threshold predictions. Whatever was thresholded as foreground within the bounding box will be added to the annotation as a new cell with unique label.
*t* - threshold to predict annotations based on brightness. After turning this on, click and drag to draw a bounding box around the cell you wish to threshold. Make sure to include some background in the bounding box for accurate threshold predictions. Whatever was thresholded as foreground within the bounding box will be added to the annotation as a new cell with unique label.


### Viewing Options:
Expand All @@ -90,7 +91,7 @@ Annotation mode focuses on using an adjustable brush to modify annotations on a
*h* - switch between highlighted mode and non-highlighted mode (highlight exists in label- and pixel-editing modes but is displayed differently; label-editing highlighting recolors solid label with red, pixel-editing highlighting adds white or red outline around label in image). Once highlight mode is on, use *[ (left bracket) / ] (right bracket)* to decrement/increment selected cell label number.

*shift+h* - switch between showing and hiding annotation masks in the pixel editor

*z* - switch between annotations and raw images (outside of pixel editor)

*i* - invert greyscale raw image (viewing raw image or in pixel editor)
Expand All @@ -116,7 +117,7 @@ Annotation mode focuses on using an adjustable brush to modify annotations on a

### To Save:

Once done, use the following key to save the changed file.
Once done, use the following key to save the changed file.
The tool will also save the original file in the same folder.
In npz mode, a new npz file will be saved with a version number. An npz can be saved as a trk file (select "t" in response to save prompt). This will bundle together the current channel and feature of the npz along with a generated lineage file, which will contain label and frame information and empty parent/daughter entries for each cell. The new trk file can then be edited in Caliban's trk mode to add relationship information.

Expand All @@ -125,7 +126,7 @@ In npz mode, a new npz file will be saved with a version number. An npz can be s

## Instructions for Running Caliban in a Docker Container

In addition to having Docker, you will also need to have a VNC viewer to view the application inside the container.
In addition to having Docker, you will also need to have a VNC viewer to view the application inside the container.

To install one, you can go to http://realvnc.com to download a free VNC viewer.
[Direct Link to Download Page](https://www.realvnc.com/en/connect/download/viewer/)
Expand All @@ -142,7 +143,7 @@ docker build -t caliban .
```bash
docker run \
-p 5900:5900 \
-v $PWD/caliban/desktop:/usr/src/app/desktop \
-v $PWD/desktop:/usr/src/app/desktop \
--privileged \
caliban:latest
```
Expand All @@ -160,11 +161,9 @@ cd desktop
python3 caliban.py [input file location]
```

To see an immediate example with a sample .trk file, you can run
To see an immediate example with a sample .trk file, you can run

```bash
cd desktop
python3 caliban.py examples/trackfile1.trk
```


4 changes: 4 additions & 0 deletions browser/.ebextensions/healthcheckurl.config
@@ -0,0 +1,4 @@
option_settings:
- namespace: aws:elasticbeanstalk:application
option_name: Application Healthcheck URL
value: /health
3 changes: 1 addition & 2 deletions browser/.ebextensions/options.config
@@ -1,5 +1,4 @@
option_settings:
- namespace: aws:elasticbeanstalk:container:python
option_name: WSGIPath
value: eb_application.py

value: application.py
11 changes: 11 additions & 0 deletions browser/.env.example
@@ -0,0 +1,11 @@
# Flask settings
DEBUG=
TEMPLATES_AUTO_RELOAD=

# AWS credentials
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=

# SQL Alchemy settings
SQLALCHEMY_DATABASE_URI=
SQLALCHEMY_TRACK_MODIFICATIONS=
13 changes: 13 additions & 0 deletions browser/Dockerfile
@@ -0,0 +1,13 @@
FROM python:3.7

WORKDIR /usr/src/app

COPY requirements.txt requirements.txt

RUN pip install --no-cache-dir -r requirements.txt

COPY . .

EXPOSE 5000

CMD ["/bin/sh", "-c", "python application.py"]
32 changes: 31 additions & 1 deletion browser/README.md
Expand Up @@ -18,6 +18,32 @@ pip install -r requirements.txt
```bash
python3 application.py
```
## To use docker-compose for local development
Add your AWS credentials to ```docker-compose.yaml```.

From the ```caliban/browser``` folder, run:
```bash
sudo docker-compose up --build -d
```
Wait a minute for the database to finish setting up before running:
```
sudo docker-compose restart app
```
You can now go to 0.0.0.0:5000 in a browser window to access the local version of the tool.

To interact with the local mysql database:
```
sudo docker exec -it browser_db_1 bash
mysql -p
```
When finished:
```
sudo docker-compose down
```
(optional)
```
sudo docker system prune --volumes
```

## Structure of Browser Version

Expand Down Expand Up @@ -81,7 +107,7 @@ Keybinds in pixel editing mode are different from those in the label-editing mod

Annotation mode focuses on using an adjustable brush to modify annotations on a pixel level, rather than using operations that apply to every instance of a label within a frame or set of frames. The brush tool will only make changes to the currently selected value. Ie, a brush set to edit cell 5 will only add or erase "5" to the annotated image.

*-/=* - increment value that brush is applying
*[ (left bracket) / ] (right bracket)* - increment value that brush is applying

*↓ ↑* - change size of brush tool

Expand All @@ -100,6 +126,10 @@ Annotation mode focuses on using an adjustable brush to modify annotations on a

### Viewing Options:

*spacebar + click and drag* - pan across canvas

*-/= keys or alt + scroll wheel* - zoom in and out

*c* - cycle between different channels when no cells are selected

*e* - toggle annotation mode (when nothing else selected)
Expand Down

0 comments on commit f5d8f45

Please sign in to comment.