Skip to content

Improve log message when tiled image isn't displayed #316

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions uwsift/view/tile_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,7 @@ def calc_view_extents(image_extents_box: Box, canvas_point, image_point, canvas_
top = clip(top, image_extents_box.bottom, image_extents_box.top)

if (right - left) < CANVAS_EXTENTS_EPSILON or (top - bot) < CANVAS_EXTENTS_EPSILON:
# they are viewing essentially nothing or the image isn't in view
raise ValueError("Image can't be currently viewed")
raise ValueError("Image is outside of canvas or empty")

return Box(left=left, right=right, bottom=bot, top=top)

Expand Down
5 changes: 3 additions & 2 deletions uwsift/view/visuals.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,9 @@ def assess(self):
view_box = self.get_view_box()
preferred_stride = self._get_stride(view_box)
tile_box = self.calc.visible_tiles(view_box, stride=preferred_stride, extra_tiles_box=Box(1, 1, 1, 1))
except ValueError:
LOG.error("Could not determine viewable image area for '{}'".format(self.name))
except ValueError as e:
# If image is outside of canvas, then an exception will be raised
LOG.warning("Could not determine viewable image area for '{}': {}".format(self.name, e))
return False, self._stride, self._latest_tile_box

num_tiles = (tile_box.bottom - tile_box.top) * (tile_box.right - tile_box.left)
Expand Down