diff --git a/plantcv/geospatial/napari_save_points.py b/plantcv/geospatial/napari_save_points.py index f29adf0..cf9efc0 100644 --- a/plantcv/geospatial/napari_save_points.py +++ b/plantcv/geospatial/napari_save_points.py @@ -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 diff --git a/tests/test_geospatial_napari_save_points.py b/tests/test_geospatial_napari_save_points.py index 0de326f..d9a4ace 100644 --- a/tests/test_geospatial_napari_save_points.py +++ b/tests/test_geospatial_napari_save_points.py @@ -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): @@ -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()