Skip to content

Commit

Permalink
changed assertion failing on wrong rotations to a warning
Browse files Browse the repository at this point in the history
  • Loading branch information
csachs committed Apr 6, 2018
1 parent 222fa80 commit 1141bb1
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion molyso/mm/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from __future__ import division, unicode_literals, print_function

import math
import warnings

from ..generic.signal import fit_to_type
from ..generic.rotation import find_rotation, apply_rotate_and_cleanup
from ..generic.registration import translation_2x1d
Expand Down Expand Up @@ -125,7 +127,15 @@ def autorotate(self):
self.image, self.angle, self.crop_height, self.crop_width = \
apply_rotate_and_cleanup(self.image, self.angle)

assert self.image.size > 0
if self.image.size == 0:
warnings.warn(
"Autorotation failed. This likely means that the image is unsuitable for use with molyso.",
RuntimeWarning
)

self.image = self.original_image.copy()
self.angle = 0.0
self.crop_height = self.crop_width = 0


# noinspection PyUnresolvedReferences
Expand Down

0 comments on commit 1141bb1

Please sign in to comment.