Commit dd2cd7d0f303dcce3bc4e0eecb7aed028eae733b

Authored by Paulo Henrique Junqueira Amorim
1 parent 47322b03

ENH: Update text orientation if spined

Showing 1 changed file with 45 additions and 77 deletions   Show diff stats
invesalius/data/viewer_slice.py
... ... @@ -431,6 +431,15 @@ class Viewer(wx.Panel):
431 431  
432 432 if((self.state == const.STATE_SPIN) and (self.spined_image)):
433 433 self.cam.SetViewUp(const.SLICE_POSITION[orig_orien][0][self.orientation])
  434 +
  435 + if self.orientation == 'AXIAL':
  436 + values = [_("A"), _("R"), _("P"), _("L")]
  437 + elif self.orientation == 'SAGITAL':
  438 + values = [_("T"), _("R"), _("B"), _("L")]
  439 + else:
  440 + values = [_("T"), _("P"), _("B"), _("A")]
  441 +
  442 + self.RenderTextDirection(values)
434 443 self.interactor.Render()
435 444 self.spined_image = False
436 445 elif((self.state == const.STATE_PAN) and (self.paned_image)):
... ... @@ -449,47 +458,6 @@ class Viewer(wx.Panel):
449 458 evt.OnRightButtonDown()
450 459  
451 460  
452   - def SetLabelImageOrientation(self, cam):
453   - croll = cam.GetRoll()
454   - if (self.orientation == 'AXIAL'):
455   - if (croll >= -2 and croll <= 1):
456   - print "A, R, P, L"
457   -
458   - elif(croll > 1 and croll <= 44):
459   - print "AL, RA, PR, LP"
460   -
461   - elif(croll > 44 and croll <= 88):
462   - print "LA, AR, RP, PL"
463   -
464   - elif(croll > 89 and croll <= 91):
465   - print "L, A, R, P"
466   -
467   - elif(croll > 91 and croll <= 135):
468   - print "LP, AL, RA, PR"
469   -
470   - elif(croll > 135 and croll <= 177):
471   - print "PL, LA, AR, RP"
472   -
473   - elif(croll >= -180 and croll <= -178) or (croll < 180 and croll > 177):
474   - print "P, L, A, R"
475   -
476   - elif(croll >= -177 and croll <= -133):
477   - print "PR, LP, AL, RA"
478   -
479   - elif(croll >= -132 and croll <= -101):
480   - print "RP, PL, LA, AR"
481   -
482   - elif(croll >= -101 and croll <= -87):
483   - print "R, P, L, A"
484   -
485   - elif(croll >= -86 and croll <= -42):
486   - print "RA, PR, LP, AL"
487   -
488   - elif(croll >= -41 and croll <= -2):
489   - print "AR, RP, PL, LA"
490   -
491   -
492   -
493 461 def OnSpinClick(self, evt, obj):
494 462 evt.StartSpin()
495 463  
... ... @@ -576,116 +544,116 @@ class Viewer(wx.Panel):
576 544 if (self.orientation == 'AXIAL'):
577 545  
578 546 if (croll >= -2 and croll <= 1):
579   - self.RenderTextDirection(["A", "R", "P", "L"])
  547 + self.RenderTextDirection([_("A"), _("R"), _("P"), _("L")])
580 548  
581 549 elif(croll > 1 and croll <= 44):
582   - self.RenderTextDirection(["AL", "RA", "PR", "LP"])
  550 + self.RenderTextDirection([_("AL"), _("RA"), _("PR"), _("LP")])
583 551  
584 552 elif(croll > 44 and croll <= 88):
585   - self.RenderTextDirection(["LA", "AR", "RP", "PL"])
  553 + self.RenderTextDirection([_("LA"), _("AR"), _("RP"), _("PL")])
586 554  
587 555 elif(croll > 89 and croll <= 91):
588   - self.RenderTextDirection(["L", "A", "R", "P"])
  556 + self.RenderTextDirection([_("L"), _("A"), _("R"), _("P")])
589 557  
590 558 elif(croll > 91 and croll <= 135):
591   - self.RenderTextDirection(["LP", "AL", "RA", "PR"])
  559 + self.RenderTextDirection([_("LP"), _("AL"), _("RA"), _("PR")])
592 560  
593 561 elif(croll > 135 and croll <= 177):
594   - self.RenderTextDirection(["PL", "LA", "AR", "RP"])
  562 + self.RenderTextDirection([_("PL"), _("LA"), _("AR"), _("RP")])
595 563  
596 564 elif(croll >= -180 and croll <= -178) or (croll < 180 and croll > 177):
597   - self.RenderTextDirection(["P", "L", "A", "R"])
  565 + self.RenderTextDirection([_("P"), _("L"), _("A"), _("R")])
598 566  
599 567 elif(croll >= -177 and croll <= -133):
600   - self.RenderTextDirection(["PR", "LP", "AL", "RA"])
  568 + self.RenderTextDirection([_("PR"), _("LP"), _("AL"), _("RA")])
601 569  
602 570 elif(croll >= -132 and croll <= -101):
603   - self.RenderTextDirection(["RP", "PL", "LA", "AR"])
  571 + self.RenderTextDirection([_("RP"), _("PL"), _("LA"), _("AR")])
604 572  
605 573 elif(croll >= -101 and croll <= -87):
606   - self.RenderTextDirection(["R", "P", "L", "A"])
  574 + self.RenderTextDirection([_("R"), _("P"), _("L"), _("A")])
607 575  
608 576 elif(croll >= -86 and croll <= -42):
609   - self.RenderTextDirection(["RA", "PR", "LP", "AL"])
  577 + self.RenderTextDirection([_("RA"), _("PR"), _("LP"), _("AL")])
610 578  
611 579 elif(croll >= -41 and croll <= -2):
612   - self.RenderTextDirection(["AR", "RP", "PL", "LA"])
  580 + self.RenderTextDirection([_("AR"), _("RP"), _("PL"), _("LA")])
613 581  
614 582 elif(self.orientation == "CORONAL"):
615 583  
616 584 if (croll >= -2 and croll <= 1):
617   - self.RenderTextDirection(["S", "R", "I", "L"])
  585 + self.RenderTextDirection([_("T"), _("R"), _("B"), _("L")])
618 586  
619 587 elif(croll > 1 and croll <= 44):
620   - self.RenderTextDirection(["SL", "RS", "IR", "LI"])
  588 + self.RenderTextDirection([_("TL"), _("RT"), _("BR"), _("LI")])
621 589  
622 590 elif(croll > 44 and croll <= 88):
623   - self.RenderTextDirection(["LS", "SR", "RI", "L"])
  591 + self.RenderTextDirection([_("LS"), _("TR"), _("RB"), _("L")])
624 592  
625 593 elif(croll > 89 and croll <= 91):
626   - self.RenderTextDirection(["L", "S", "R", "I"])
  594 + self.RenderTextDirection([_("L"), _("T"), _("R"), _("B")])
627 595  
628 596 elif(croll > 91 and croll <= 135):
629   - self.RenderTextDirection(["LI", "SL", "RS", "IR"])
  597 + self.RenderTextDirection([_("BI"), _("TL"), _("RT"), _("BR")])
630 598  
631 599 elif(croll > 135 and croll <= 177):
632   - self.RenderTextDirection(["IL", "LS", "SR", "RI"])
  600 + self.RenderTextDirection([_("BL"), _("LT"), _("TR"), _("RB")])
633 601  
634 602 elif(croll >= -180 and croll <= -178) or (croll < 180 and croll > 177):
635   - self.RenderTextDirection(["I", "L", "S", "R"])
  603 + self.RenderTextDirection([_("B"), _("L"), _("T"), _("R")])
636 604  
637 605 elif(croll >= -177 and croll <= -133):
638   - self.RenderTextDirection(["IR", "LI", "SL", "RS"])
  606 + self.RenderTextDirection([_("BR"), _("LB"), _("TL"), _("RT")])
639 607  
640 608 elif(croll >= -132 and croll <= -101):
641   - self.RenderTextDirection(["RI", "IL", "LS", "SR"])
  609 + self.RenderTextDirection([_("RB"), _("BL"), _("LT"), _("TR")])
642 610  
643 611 elif(croll >= -101 and croll <= -87):
644   - self.RenderTextDirection(["R", "I", "L", "S"])
  612 + self.RenderTextDirection([_("R"), _("B"), _("L"), _("T")])
645 613  
646 614 elif(croll >= -86 and croll <= -42):
647   - self.RenderTextDirection(["RS", "IR", "LI", "SL"])
  615 + self.RenderTextDirection([_("RT"), _("BR"), _("LB"), _("TL")])
648 616  
649 617 elif(croll >= -41 and croll <= -2):
650   - self.RenderTextDirection(["SR", "RI", "IL", "LS"])
  618 + self.RenderTextDirection([_("TR"), _("RB"), _("BL"), _("LT")])
651 619  
652 620 elif(self.orientation == "SAGITAL"):
653 621  
654 622 if (croll >= -2 and croll <= 1):
655   - self.RenderTextDirection(["A", "S", "P", "I"])
  623 + self.RenderTextDirection([_("A"), _("T"), _("P"), _("B")])
656 624  
657 625 elif(croll > 1 and croll <= 44):
658   - self.RenderTextDirection(["AI", "SA", "PS", "IP"])
  626 + self.RenderTextDirection([_("AB"), _("TA"), _("PT"), _("BP")])
659 627  
660 628 elif(croll > 44 and croll <= 88):
661   - self.RenderTextDirection(["IA", "AS", "SP", "PI"])
  629 + self.RenderTextDirection([_("BA"), _("AS"), _("TP"), _("PB")])
662 630  
663 631 elif(croll > 89 and croll <= 91):
664   - self.RenderTextDirection(["I", "A", "S", "P"])
  632 + self.RenderTextDirection([_("B"), _("A"), _("T"), _("P")])
665 633  
666 634 elif(croll > 91 and croll <= 135):
667   - self.RenderTextDirection(["IP", "AI", "SA", "PS"])
  635 + self.RenderTextDirection([_("BP"), _("AB"), _("SA"), _("PT")])
668 636  
669 637 elif(croll > 135 and croll <= 177):
670   - self.RenderTextDirection(["PI", "IA", "AS", "SP"])
  638 + self.RenderTextDirection([_("PB"), _("BA"), _("AT"), _("TP")])
671 639  
672 640 elif(croll >= -180 and croll <= -178) or (croll < 180 and croll > 177):
673   - self.RenderTextDirection(["P", "I", "A", "S"])
  641 + self.RenderTextDirection([_("P"), _("B"), _("A"), _("T")])
674 642  
675 643 elif(croll >= -177 and croll <= -133):
676   - self.RenderTextDirection(["PS", "IP", "AI", "SA"])
  644 + self.RenderTextDirection([_("PT"), _("BP"), _("AB"), _("TA")])
677 645  
678 646 elif(croll >= -132 and croll <= -101):
679   - self.RenderTextDirection(["SP", "PI", "IA", "AS"])
  647 + self.RenderTextDirection([_("TP"), _("PB"), _("BA"), _("AT")])
680 648  
681 649 elif(croll >= -101 and croll <= -87):
682   - self.RenderTextDirection(["S", "P", "I", "A"])
  650 + self.RenderTextDirection([_("T"), _("P"), _("B"), _("A")])
683 651  
684 652 elif(croll >= -86 and croll <= -42):
685   - self.RenderTextDirection(["SA", "PS", "IP", "AI"])
  653 + self.RenderTextDirection([_("TA"), _("PT"), _("BP"), _("AB")])
686 654  
687 655 elif(croll >= -41 and croll <= -2):
688   - self.RenderTextDirection(["AS", "SP", "PI", "IA"])
  656 + self.RenderTextDirection([_("AT"), _("TP"), _("PB"), _("BA")])
689 657  
690 658  
691 659 def Reposition(self, slice_data):
... ...