Skip to content

Commit

Permalink
move hover coords to pixel space (#168)
Browse files Browse the repository at this point in the history
* move hover coords to pixel space

* move test coordinates to pixel space
  • Loading branch information
alessandrofelder authored Dec 10, 2024
1 parent 9a24190 commit efac552
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions brainrender_napari/napari_atlas_representation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_unit/test_napari_atlas_representation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
],
)
Expand Down

0 comments on commit efac552

Please sign in to comment.