Skip to content

Commit

Permalink
Change viewer close in napari save points
Browse files Browse the repository at this point in the history
  • Loading branch information
k034b363 committed Dec 5, 2024
1 parent 90160d2 commit c5ad265
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 3 additions & 0 deletions plantcv/geospatial/napari_save_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ def napari_save_points(images, num_points, outdir="./", bands="R,G,B", block=Tru
redo_list.append(image_path)
warn('Image ' + str(image_path) + ' collected incorrect number of points. ' +
'Added to redo list.')
# Close the viewer in case it wasn't shown
if not show:
viewer.close()
# Reset debug
pcv.params.debug = debug
return redo_list
2 changes: 0 additions & 2 deletions tests/test_geospatial_napari_save_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ def test_geospatial_napari_save_points(test_data, tmpdir):
images = [test_data.rgb_tif]
redo_list = napari_save_points(images, num_points=4, outdir=cache_dir, block=False, show=False)
assert len(redo_list) == 1
viewer.close()


def test_geospatial_napari_save_points_output(test_data, tmpdir):
Expand All @@ -23,4 +22,3 @@ def test_geospatial_napari_save_points_output(test_data, tmpdir):
images = [os.path.join(cache_dir, "rgb.png")]
_ = napari_save_points(images, num_points=0, outdir=cache_dir, block=False, show=False)
assert os.path.exists(os.path.join(cache_dir, "rgb_warp.txt"))
viewer.close()

0 comments on commit c5ad265

Please sign in to comment.