Skip to content

Commit

Permalink
Wrap motile import
Browse files Browse the repository at this point in the history
  • Loading branch information
constantinpape committed Jan 1, 2025
1 parent 5f0e55b commit 961e2a8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions elf/tracking/motile_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
from copy import deepcopy
from typing import Dict, List, Optional, Tuple, Union

import motile
import networkx as nx
import numpy as np

from motile import costs, constraints
try:
import motile
from motile import costs, constraints
except ImportError:
motile, costs, constraints = None, None, None

from nifty.tools import takeDict
from skimage.measure import regionprops

Expand Down Expand Up @@ -255,6 +259,9 @@ def track_with_motile(
The track graph, a directed graph that connects segmentation ids across time points.
Map of track ids to segmentation ids.
"""
if motile is None:
raise RuntimeError("You have to install motile to use track_with_motile")

solver, graph, segmentation = _track_with_motile_impl(
segmentation, relabel_segmentation, node_cost_function, edge_cost_function,
node_selection_cost, **problem_kwargs,
Expand Down

0 comments on commit 961e2a8

Please sign in to comment.