From efac552fc62d117af2564ebe8961d145f2e9de5f Mon Sep 17 00:00:00 2001 From: Alessandro Felder Date: Tue, 10 Dec 2024 15:12:26 +0000 Subject: [PATCH] move hover coords to pixel space (#168) * move hover coords to pixel space * move test coordinates to pixel space --- brainrender_napari/napari_atlas_representation.py | 4 ++-- tests/test_unit/test_napari_atlas_representation.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/brainrender_napari/napari_atlas_representation.py b/brainrender_napari/napari_atlas_representation.py index 36944fb..2222f5c 100644 --- a/brainrender_napari/napari_atlas_representation.py +++ b/brainrender_napari/napari_atlas_representation.py @@ -126,13 +126,13 @@ def _on_mouse_move(self, layer, event): self._tooltip.move(QCursor.pos().x() + 20, QCursor.pos().y() + 20) try: structure_acronym = self.bg_atlas.structure_from_coords( - cursor_position, microns=True, as_acronym=True + cursor_position, microns=False, as_acronym=True ) structure_name = self.bg_atlas.structures[structure_acronym][ "name" ] hemisphere = self.bg_atlas.hemisphere_from_coords( - cursor_position, as_string=True, microns=True + cursor_position, as_string=True, microns=False ).capitalize() tooltip_text = f"{structure_name} | {hemisphere}" self._tooltip.setText(tooltip_text) diff --git a/tests/test_unit/test_napari_atlas_representation.py b/tests/test_unit/test_napari_atlas_representation.py index 76905db..64d4c0d 100644 --- a/tests/test_unit/test_napari_atlas_representation.py +++ b/tests/test_unit/test_napari_atlas_representation.py @@ -142,7 +142,7 @@ def test_add_additional_reference(make_napari_viewer): @pytest.mark.parametrize( "cursor_position, expected_tooltip_text", [ - ((6500.0, 4298.5, 9057.6), "Caudoputamen | Left"), + ((65, 43, 91), "Caudoputamen | Left"), ((-1000, 0, 0), ""), # outside image ], )