Skip to content

Commit

Permalink
Remove affogato as a dependency.
Browse files Browse the repository at this point in the history
also update README with updated installation instructions.
affogato was removed as a python dependency because there is a different
package on pypi also called affogato that we do not want. This is also
breaking the conda recipe tests since pip check does not recognize the
conda version of affogato as satisfying the dependency
  • Loading branch information
pattonw committed Sep 9, 2022
1 parent c097fd1 commit b5fd5b8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ https://napari.org/plugins/stable/index.html

## Installation

Pre-requisites:

1) Install lsds with: `pip install git+https://github.com/pattonw/lsd.git@no-convenience-imports` (This is necessary since we need lsds but the package name `lsd` is already taken on pypi. While we resolve this the specific lsd version needs to be specified)
You will need a conda environment for everything to run
smoothly. Supported python versions are 3.7, 3.8, 3.9.

### pip
You can install `napari-affinities` via [pip]:

`pip install napari-affinities`
Expand All @@ -43,6 +43,15 @@ Install conda requirements:

conda install -c conda-forge affogato

### conda

If you install via conda, there are fewer steps since
affogato and pytorch will be installed for you.

You can install `napari-affinities` via [conda]:

`conda install -c conda-forge napari-affinities`

### Download example model:

#### 2D:
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ install_requires =
magicgui
bioimageio.core
gunpowder
affogato
matplotlib


Expand Down
13 changes: 12 additions & 1 deletion src/napari_affinities/widgets/mutex_watershed.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
from napari.types import LabelsData, LayerDataTuple
from napari.layers import Labels, Image

from affogato.segmentation import MWSGridGraph, compute_mws_clustering
try:
from affogato.segmentation import MWSGridGraph, compute_mws_clustering
except ImportError as e:
raise ImportError(
"To use mutex watershed please install affogato via: "
"conda install -c conda-forge affogato"
) from e

import numpy as np
from typing import Optional
Expand All @@ -13,6 +19,7 @@
import napari
from napari.qt.threading import FunctionWorker, thread_worker


def toggle_interactivity_callback(widget, interactive_callbacks):
def callback(live):
# remove old callbacks
Expand All @@ -23,14 +30,17 @@ def callback(live):
if live:
# add callback for seed_layer change
if seed_layer is not None:

def change(*args, **kwargs):
# this sets off the auto run
widget.toggle.value = 1 - widget.toggle.value

cb = seed_layer.events.set_data.connect(change)
interactive_callbacks.append(cb)

return callback


def add_interactive_callback(widget, interactive_callbacks):
def callback(seed_layer):
if seed_layer is not None:
Expand All @@ -47,6 +57,7 @@ def change(*args, **kwargs):
# add new callback
cb = seed_layer.events.set_data.connect(change)
interactive_callbacks.append(cb)

return callback


Expand Down

0 comments on commit b5fd5b8

Please sign in to comment.