Commit 117db004370c5fb9d1f7e6944387704532b9962a
1 parent
49bb72b7
Exists in
master
and in
68 other branches
ENH: Creating the slices_data in the correct position
Showing
1 changed file
with
14 additions
and
9 deletions
Show diff stats
invesalius/data/viewer_slice.py
... | ... | @@ -379,8 +379,10 @@ class Viewer(wx.Panel): |
379 | 379 | def load_renderers(self, image): |
380 | 380 | proportion_x = 1.0 / self.layout[0] |
381 | 381 | proportion_y = 1.0 / self.layout[1] |
382 | - for i in xrange(self.layout[0]): | |
383 | - for j in xrange(self.layout[1]): | |
382 | + # The (0,0) in VTK is in bottom left. So the creation from renderers | |
383 | + # must be # in inverted order, from the top left to bottom right | |
384 | + for j in xrange(self.layout[1]-1, -1, -1): | |
385 | + for i in xrange(self.layout[0]): | |
384 | 386 | position = ((i*proportion_x, j * proportion_y, |
385 | 387 | (i+1)*proportion_x, (j+1)*proportion_y)) |
386 | 388 | slice_data = self.create_slice_window(image) |
... | ... | @@ -573,15 +575,18 @@ class Viewer(wx.Panel): |
573 | 575 | if pos < max: |
574 | 576 | slice_data.number = pos |
575 | 577 | self.__update_display_extent(slice_data) |
578 | + ren.AddActor(actor) | |
579 | + else: | |
580 | + ren.RemoveActor(actor) | |
576 | 581 | |
577 | - position = {"SAGITAL": {0: slice_data.number}, | |
578 | - "CORONAL": {1: slice_data.number}, | |
579 | - "AXIAL": {2: slice_data.number}} | |
582 | + position = {"SAGITAL": {0: slice_data.number}, | |
583 | + "CORONAL": {1: slice_data.number}, | |
584 | + "AXIAL": {2: slice_data.number}} | |
580 | 585 | |
581 | - if 'DEFAULT' in self.modes: | |
582 | - ps.Publisher().sendMessage( | |
583 | - 'Update cursor single position in slice', | |
584 | - position[self.orientation]) | |
586 | + if 'DEFAULT' in self.modes: | |
587 | + ps.Publisher().sendMessage( | |
588 | + 'Update cursor single position in slice', | |
589 | + position[self.orientation]) | |
585 | 590 | |
586 | 591 | def ChangeSliceNumber(self, pubsub_evt): |
587 | 592 | index = pubsub_evt.data | ... | ... |