Skip to content

Commit

Permalink
Remove annotate dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
k034b363 committed Oct 11, 2024
1 parent bf10338 commit b72e3c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 0 additions & 1 deletion plantcv/geospatial/points_to_geojson.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import geojson
import rasterio
import plantcv.annotate as an
from plantcv.plantcv import fatal_error


Expand Down
14 changes: 11 additions & 3 deletions tests/test_geospatial_points_to_geojson.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,23 @@

import pytest
import os
import plantcv.annotate as an
import napari
from plantcv.geospatial import read_geotif
from plantcv.geospatial import points_to_geojson

# Set up fake class just for testing the annotate output
# Don't want to have to have annotate as a dependency

class FakePoints:
def __init__(self):
self.coords = {}

def test_geospatial_points_to_geojson_napari(test_data, tmpdir):
"""Test for plantcv-geospatial."""
cache_dir = tmpdir.mkdir("cache")
img = read_geotif(filename=test_data.rgb_tif, bands="R,G,B")
viewer = an.napari_open(img=img.pseudo_rgb, show=False)
viewer = napari.Viewer(show=False)
viewer.add_image(img)
viewer.add_points()
filename = os.path.join(cache_dir, 'test_out.geojson')
points_to_geojson(img, viewer, output=filename)
Expand All @@ -20,7 +28,7 @@ def test_geospatial_points_to_geojson_an(test_data, tmpdir):
"""Test for plantcv-geospatial."""
cache_dir = tmpdir.mkdir("cache")
img = read_geotif(filename=test_data.rgb_tif, bands="R,G,B")
viewer = an.Points(img=img.pseudo_rgb)
viewer = FakePoints()
filename = os.path.join(cache_dir, 'test_out.geojson')
points_to_geojson(img, viewer, output=filename)
assert os.path.exists(filename)
Expand Down

0 comments on commit b72e3c5

Please sign in to comment.