Commit 93ea7ed7560c27cf82baf7f69e0076ef590d73e5
1 parent
a9883a09
Exists in
master
and in
68 other branches
ADD: Viewer Slice Coronal and Sagital Orientations correct
Showing
1 changed file
with
21 additions
and
8 deletions
Show diff stats
invesalius/data/viewer_slice.py
@@ -45,7 +45,7 @@ class Viewer(wx.Panel): | @@ -45,7 +45,7 @@ class Viewer(wx.Panel): | ||
45 | self.image_windows = [] | 45 | self.image_windows = [] |
46 | # The layout from image_window, the first is number of cols, the second | 46 | # The layout from image_window, the first is number of cols, the second |
47 | # is the number of rows | 47 | # is the number of rows |
48 | - self.layout = (2, 2) | 48 | + self.layout = (1, 1) |
49 | 49 | ||
50 | self.__init_gui() | 50 | self.__init_gui() |
51 | 51 | ||
@@ -460,11 +460,13 @@ class Viewer(wx.Panel): | @@ -460,11 +460,13 @@ class Viewer(wx.Panel): | ||
460 | 460 | ||
461 | def __update_camera(self, ren, actor, pos): | 461 | def __update_camera(self, ren, actor, pos): |
462 | orientation = self.orientation | 462 | orientation = self.orientation |
463 | - | 463 | + proj = project.Project() |
464 | + orig_orien = proj.original_orientation | ||
465 | + | ||
464 | cam = ren.GetActiveCamera() | 466 | cam = ren.GetActiveCamera() |
465 | cam.SetFocalPoint(0, 0, 0) | 467 | cam.SetFocalPoint(0, 0, 0) |
466 | - cam.SetPosition(const.CAM_POSITION[self.orientation]) | ||
467 | - cam.SetViewUp(const.CAM_VIEW_UP[self.orientation]) | 468 | + cam.SetViewUp(const.SLICE_POSITION[orig_orien][0][self.orientation]) |
469 | + cam.SetPosition(const.SLICE_POSITION[orig_orien][1][self.orientation]) | ||
468 | cam.ComputeViewPlaneNormal() | 470 | cam.ComputeViewPlaneNormal() |
469 | cam.OrthogonalizeViewUp() | 471 | cam.OrthogonalizeViewUp() |
470 | cam.ParallelProjectionOn() | 472 | cam.ParallelProjectionOn() |
@@ -476,10 +478,21 @@ class Viewer(wx.Panel): | @@ -476,10 +478,21 @@ class Viewer(wx.Panel): | ||
476 | 478 | ||
477 | def __update_display_extent(self, actor, render, pos): | 479 | def __update_display_extent(self, actor, render, pos): |
478 | e = self.imagedata.GetWholeExtent() | 480 | e = self.imagedata.GetWholeExtent() |
479 | - | ||
480 | - new_extent = {"SAGITAL": (pos, pos, e[2], e[3], e[4], e[5]), | ||
481 | - "CORONAL": (e[0], e[1], pos, pos, e[4], e[5]), | ||
482 | - "AXIAL": (e[0], e[1], e[2], e[3], pos, pos)} | 481 | + proj = project.Project() |
482 | + | ||
483 | + if (proj.original_orientation == const.AXIAL): | ||
484 | + new_extent = {"SAGITAL": (pos, pos, e[2], e[3], e[4], e[5]), | ||
485 | + "CORONAL": (e[0], e[1], pos, pos, e[4], e[5]), | ||
486 | + "AXIAL": (e[0], e[1], e[2], e[3], pos, pos)} | ||
487 | + elif(proj.original_orientation == const.SAGITAL): | ||
488 | + new_extent = {"SAGITAL": (e[0], e[1], e[2], e[3], pos, pos), | ||
489 | + "CORONAL": (pos, pos, e[2], e[3], e[4], e[5]), | ||
490 | + "AXIAL": (e[0], e[1], pos, pos, e[4], e[5])} | ||
491 | + elif(proj.original_orientation == const.CORONAL): | ||
492 | + new_extent = {"SAGITAL": (pos, pos, e[2], e[3], e[4], e[5]), | ||
493 | + "CORONAL": (e[0], e[1], e[2], e[3], pos, pos), | ||
494 | + "AXIAL": (e[0], e[1], pos, pos, e[4], e[5])} | ||
495 | + | ||
483 | 496 | ||
484 | actor.SetDisplayExtent(new_extent[self.orientation]) | 497 | actor.SetDisplayExtent(new_extent[self.orientation]) |
485 | render.ResetCameraClippingRange() | 498 | render.ResetCameraClippingRange() |