Skip to content

Commit

Permalink
Update docs using MkDocs (#21)
Browse files Browse the repository at this point in the history
* added basic docs and config

* added docs worflow
  • Loading branch information
mese79 authored Dec 1, 2024
1 parent 97d880d commit 72d611b
Show file tree
Hide file tree
Showing 15 changed files with 152 additions and 112 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: mkdocs
on:
push:
branches:
- main
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install mkdocs-material
- run: mkdocs gh-deploy --force
Binary file added docs/assets/fig1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/images/extract_process.jpg
Binary file not shown.
Binary file removed docs/images/extractor_widget.png
Binary file not shown.
Binary file removed docs/images/prediction_process.jpg
Binary file not shown.
Binary file removed docs/images/sam_predictor_widget.png
Binary file not shown.
Binary file removed docs/images/sam_prompt_widget.png
Binary file not shown.
Binary file removed docs/images/sam_rf_widget_1.png
Binary file not shown.
Binary file removed docs/images/sam_rf_widget_2.png
Binary file not shown.
Binary file removed docs/images/training_process.jpg
Binary file not shown.
24 changes: 11 additions & 13 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# Documentation
---
title: Welcome
---

# Welcome to Feature Forest Documentation

Feature Forest (**FF**) is a *[napari]* plugin for creating image annotations with less manual work, utilizing image embeddings (*features*) of vision transformer models like *[SAM2]* and training a *Random Forest* model using a little scribble labels provided by the user.

### Overview
![figure 1](assets/fig1.png)

## How to use the plugin
This plugin provides four widgets; one for extracting the SAM embeddings and three for segmentation using different methods:
- [SAM Embedding Extractor](./widgets.md#sam-embedding-extractor-widget)
- [SAM-RF Widget](./widgets.md#sam-rf-widget)
- [Notes](./widgets.md#notes)
- [SAM Prompt Segmentation Widget](./widgets.md#sam-prompt-segmentation-widget)
- [SAM Predictor Widget](./widgets.md#sam-predictor-widget)
<br><br>

## Overview of SAM-RF Segmentation
![extraction process](images/extract_process.jpg)

![training process](images/training_process.jpg)

![prediction process](images/prediction_process.jpg)
[napari]: https://napari.org/
[SAM2]: https://ai.meta.com/sam2/
55 changes: 55 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
title: Installation
---

## Easy Way!
To install this plugin you need to use [mamba] or [conda] to create a environment and install the requirements. Use the commands below to create the environment and install the plugin:
```bash
# for GPU
mamba env create -f ./env_gpu.yml
```
```bash
# if you don't have a GPU
mamba env create -f ./env_cpu.yml
```

### Note
You need to install `sam-2` which can be installed easily using mamba (or conda). To install `sam-2` using `pip` please refer to the official [sam-2](https://github.com/facebookresearch/sam2) repository.

## Requirements
- `python >= 3.10`
- `numpy==1.24.4`
- `opencv-python`
- `scikit-learn`
- `scikit-image`
- `matplotlib`
- `pyqt`
- `magicgui`
- `qtpy`
- `napari`
- `h5py`
- `pytorch=2.3.1`
- `torchvision=0.18.1`
- `timm=1.0.9`
- `pynrrd`
- `segment-anything`
- `sam-2`

If you want to install the plugin manually using GPU, please follow the pytorch installation instruction [here](https://pytorch.org/get-started/locally/).
For detailed napari installation see [here](https://napari.org/stable/tutorials/fundamentals/installation).

## Installing Only The Plugin
If you use the provided conda environment yaml files, the plugin will be installed automatically. But in case you already have the environment setup,
you can just install the plugin. First clone the repository:
```bash
git clone https://github.com/juglab/featureforest
```
Then run the following commands:
```bash
cd ./featureforest
pip install .
```

[PyPI]: https://pypi.org/
[conda]: https://conda.io/projects/conda/en/latest/index.html
[mamba]: https://mamba.readthedocs.io/en/latest/installation/mamba-installation.html
4 changes: 4 additions & 0 deletions docs/stylesheets/extra.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.md-typeset code {
font-size: 90%;
font-weight: 600;
}
99 changes: 0 additions & 99 deletions docs/widgets.md

This file was deleted.

54 changes: 54 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
site_name: Feature Forest Documents
site_url: https://juglab.github.io/featureforest
extra_css:
- stylesheets/extra.css
theme:
name: material
features:
- navigation.footer
- navigation.sections
- navigation.instant
- navigation.instant.progress
- content.code.copy
# logo: assets/logo.png
# favicon: images/favicon.png
icon:
repo: fontawesome/brands/git-alt
font:
text: Parkinsans
code: Fira Code
palette:
# Palette toggle for dark mode
- scheme: slate
primary: green
accent: cyan
toggle:
icon: material/brightness-4
name: Switch to light mode

# Palette toggle for light mode
- scheme: default
primary: green
accent: cyan
toggle:
icon: material/brightness-7
name: Switch to dark mode

extra:
version:
provider: mike
social:
- icon: fontawesome/brands/github-alt
link: https://github.com/juglab/featureforest

repo_url: https://github.com/juglab/featureforest
repo_name: juglab/featureforest

markdown_extensions:
- pymdownx.highlight:
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
- pymdownx.inlinehilite
- pymdownx.snippets
- pymdownx.superfences

0 comments on commit 72d611b

Please sign in to comment.