Commit b5d8f652771ad448ca51dda4c50bf3c45741e350

Authored by Thiago Franco de Moraes
1 parent 68b4d2a5

Setting image buffer

Showing 1 changed file with 6 additions and 1 deletions   Show diff stats
invesalius/data/slice_.py
@@ -563,7 +563,6 @@ class Slice(object): @@ -563,7 +563,6 @@ class Slice(object):
563 mask = None 563 mask = None
564 564
565 self.buffer_slices[orientation].index = slice_number 565 self.buffer_slices[orientation].index = slice_number
566 - self.buffer_slices[orientation].image = n_image  
567 self.buffer_slices[orientation].mask = n_mask 566 self.buffer_slices[orientation].mask = n_mask
568 self.buffer_slices[orientation].vtk_image = image 567 self.buffer_slices[orientation].vtk_image = image
569 self.buffer_slices[orientation].vtk_mask = mask 568 self.buffer_slices[orientation].vtk_mask = mask
@@ -582,6 +581,7 @@ class Slice(object): @@ -582,6 +581,7 @@ class Slice(object):
582 if self.buffer_slices[orientation].index == slice_number \ 581 if self.buffer_slices[orientation].index == slice_number \
583 and self.buffer_slices[orientation].image is not None: 582 and self.buffer_slices[orientation].image is not None:
584 n_image = self.buffer_slices[orientation].image 583 n_image = self.buffer_slices[orientation].image
  584 + # print "BUFFER IMAGE"
585 else: 585 else:
586 if self._type_projection == const.PROJECTION_NORMAL: 586 if self._type_projection == const.PROJECTION_NORMAL:
587 number_slices = 1 587 number_slices = 1
@@ -744,6 +744,7 @@ class Slice(object): @@ -744,6 +744,7 @@ class Slice(object):
744 else: 744 else:
745 n_image = np.array(self.matrix[:, :, slice_number]) 745 n_image = np.array(self.matrix[:, :, slice_number])
746 746
  747 + self.buffer_slices[orientation].image = n_image
747 return n_image 748 return n_image
748 749
749 def get_mask_slice(self, orientation, slice_number): 750 def get_mask_slice(self, orientation, slice_number):
@@ -861,6 +862,7 @@ class Slice(object): @@ -861,6 +862,7 @@ class Slice(object):
861 self.current_mask.matrix[n+1, 1:, 1:] = m 862 self.current_mask.matrix[n+1, 1:, 1:] = m
862 else: 863 else:
863 slice_ = self.buffer_slices[orientation].image 864 slice_ = self.buffer_slices[orientation].image
  865 + print ">>>", slice_, index
864 self.buffer_slices[orientation].mask = (255 * ((slice_ >= thresh_min) & (slice_ <= thresh_max))).astype('uint8') 866 self.buffer_slices[orientation].mask = (255 * ((slice_ >= thresh_min) & (slice_ <= thresh_max))).astype('uint8')
865 867
866 # Update viewer 868 # Update viewer
@@ -1391,6 +1393,9 @@ class Slice(object): @@ -1391,6 +1393,9 @@ class Slice(object):
1391 self.__clean_current_mask(None) 1393 self.__clean_current_mask(None)
1392 self.current_mask.matrix[:] = 0 1394 self.current_mask.matrix[:] = 0
1393 1395
  1396 + for o in self.buffer_slices:
  1397 + self.buffer_slices[o].discard_buffer()
  1398 +
1394 Publisher.sendMessage('Reload actual slice') 1399 Publisher.sendMessage('Reload actual slice')
1395 1400
1396 def __undo_edition(self, pub_evt): 1401 def __undo_edition(self, pub_evt):