Commit a9726ae0806c3530e3cbc2d85625446f4bd3476d

Authored by Thiago Franco de Moraes
1 parent bf04c2ac
Exists in master

Fix: Reorient image tool not work after open project (Closes #115)

invesalius/data/slice_.py
... ... @@ -1450,7 +1450,8 @@ class Slice(object):
1450 1450 self.center = [(s * d/2.0) for (d, s) in zip(self.matrix.shape[::-1], self.spacing)]
1451 1451  
1452 1452 self.__clean_current_mask(None)
1453   - self.current_mask.matrix[:] = 0
  1453 + if self.current_mask:
  1454 + self.current_mask.matrix[:] = 0
1454 1455  
1455 1456 for o in self.buffer_slices:
1456 1457 self.buffer_slices[o].discard_buffer()
... ...
invesalius/data/styles.py
... ... @@ -1651,7 +1651,8 @@ class ReorientImageInteractorStyle(DefaultInteractorStyle):
1651 1651 Publisher.sendMessage('Update reorient angles', (ax, ay, az))
1652 1652  
1653 1653 self._discard_buffers()
1654   - self.viewer.slice_.current_mask.clear_history()
  1654 + if self.viewer.slice_.current_mask:
  1655 + self.viewer.slice_.current_mask.clear_history()
1655 1656 Publisher.sendMessage('Reload actual slice %s' % self.viewer.orientation)
1656 1657 self.p0 = self.get_image_point_coord(x, y, z)
1657 1658  
... ...