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