Skip to content

Commit

Permalink
Add warning for different length
Browse files Browse the repository at this point in the history
  • Loading branch information
maweigert committed Jul 17, 2024
1 parent 9ba9484 commit e4f175e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/napari_trackastra/_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1"
from pathlib import Path

import warnings
import napari
import npe2
import numpy as np
Expand Down Expand Up @@ -30,6 +30,11 @@

def _track_function(model, imgs, masks, mode="greedy", **kwargs):
print(f"Tracking with mode {mode}...")

if len(imgs) != len(masks):
warnings.warn("Number of images and masks do not match, cropping to the minimum")
imgs, masks = imgs[: len(masks)], masks[: len(imgs)]

track_graph = model.track(
imgs,
masks,
Expand Down

0 comments on commit e4f175e

Please sign in to comment.