From 9524a720e57be9e32e995c9897d7da2a1ce47426 Mon Sep 17 00:00:00 2001 From: Jeremy Maitin-Shepard Date: Sat, 20 Jan 2024 15:26:00 -0800 Subject: [PATCH] fix(write_annotations): fix type annotations --- python/neuroglancer/write_annotations.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/python/neuroglancer/write_annotations.py b/python/neuroglancer/write_annotations.py index a63cf1693..272cd80cf 100644 --- a/python/neuroglancer/write_annotations.py +++ b/python/neuroglancer/write_annotations.py @@ -108,7 +108,7 @@ def __init__( ) self.related_annotations = [{} for _ in self.relationships] - def add_point(self, point: Sequence[int], id: Optional[int] = None, **kwargs): + def add_point(self, point: Sequence[float], id: Optional[int] = None, **kwargs): if self.annotation_type != "point": raise ValueError( f"Expected annotation type point, but received: {self.annotation_type}" @@ -124,8 +124,8 @@ def add_point(self, point: Sequence[int], id: Optional[int] = None, **kwargs): def add_axis_aligned_bounding_box( self, - point_a: Sequence[int], - point_b: Sequence[int], + point_a: Sequence[float], + point_b: Sequence[float], id: Optional[int] = None, **kwargs, ): @@ -137,8 +137,8 @@ def add_axis_aligned_bounding_box( def add_line( self, - point_a: Sequence[int], - point_b: Sequence[int], + point_a: Sequence[float], + point_b: Sequence[float], id: Optional[int] = None, **kwargs, ): @@ -150,8 +150,8 @@ def add_line( def _add_two_point_obj( self, - point_a: Sequence[int], - point_b: Sequence[int], + point_a: Sequence[float], + point_b: Sequence[float], id: Optional[int] = None, **kwargs, ): @@ -168,9 +168,9 @@ def _add_two_point_obj( self.lower_bound = np.minimum(self.lower_bound, point_a) self.upper_bound = np.maximum(self.upper_bound, point_b) coords = np.concatenate((point_a, point_b)) - self._add_obj(cast(Sequence[int], coords), id, **kwargs) + self._add_obj(cast(Sequence[float], coords), id, **kwargs) - def _add_obj(self, coords: Sequence[int], id: Optional[int], **kwargs): + def _add_obj(self, coords: Sequence[float], id: Optional[int], **kwargs): encoded = np.zeros(shape=(), dtype=self.dtype) encoded[()]["geometry"] = coords