Commit 93ea7ed7560c27cf82baf7f69e0076ef590d73e5

Authored by Paulo Henrique Junqueira Amorim
1 parent a9883a09

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 45 self.image_windows = []
46 46 # The layout from image_window, the first is number of cols, the second
47 47 # is the number of rows
48   - self.layout = (2, 2)
  48 + self.layout = (1, 1)
49 49  
50 50 self.__init_gui()
51 51  
... ... @@ -460,11 +460,13 @@ class Viewer(wx.Panel):
460 460  
461 461 def __update_camera(self, ren, actor, pos):
462 462 orientation = self.orientation
463   -
  463 + proj = project.Project()
  464 + orig_orien = proj.original_orientation
  465 +
464 466 cam = ren.GetActiveCamera()
465 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 470 cam.ComputeViewPlaneNormal()
469 471 cam.OrthogonalizeViewUp()
470 472 cam.ParallelProjectionOn()
... ... @@ -476,10 +478,21 @@ class Viewer(wx.Panel):
476 478  
477 479 def __update_display_extent(self, actor, render, pos):
478 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 497 actor.SetDisplayExtent(new_extent[self.orientation])
485 498 render.ResetCameraClippingRange()
... ...