Commit 5b2a66a51e2159011d3275e129c7a3969759c1b6
1 parent
d97c6212
Exists in
master
and in
67 other branches
Adjusting cursor spacing to match the spacing from the swapped axis volume
Showing
1 changed file
with
16 additions
and
0 deletions
Show diff stats
invesalius/data/viewer_slice.py
... | ... | @@ -1000,6 +1000,7 @@ class Viewer(wx.Panel): |
1000 | 1000 | |
1001 | 1001 | Publisher.subscribe(self.AddActors, 'Add actors ' + str(ORIENTATIONS[self.orientation])) |
1002 | 1002 | Publisher.subscribe(self.RemoveActors, 'Remove actors ' + str(ORIENTATIONS[self.orientation])) |
1003 | + Publisher.subscribe(self.OnSwapVolumeAxes, 'Swap volume axes') | |
1003 | 1004 | |
1004 | 1005 | Publisher.subscribe(self.ReloadActualSlice, 'Reload actual slice') |
1005 | 1006 | Publisher.subscribe(self.OnUpdateScroll, 'Update scroll') |
... | ... | @@ -1507,6 +1508,21 @@ class Viewer(wx.Panel): |
1507 | 1508 | self.scroll.SetScrollbar(wx.SB_VERTICAL, 1, max_slice_number, |
1508 | 1509 | max_slice_number) |
1509 | 1510 | |
1511 | + def OnSwapVolumeAxes(self, pubsub_evt): | |
1512 | + # Adjusting cursor spacing to match the spacing from the actual slice | |
1513 | + # orientation | |
1514 | + axis0, axis1 = pubsub_evt.data | |
1515 | + cursor = self.slice_data.cursor | |
1516 | + spacing = cursor.spacing | |
1517 | + if (axis0, axis1) == (2, 1): | |
1518 | + cursor.SetSpacing((spacing[1], spacing[0], spacing[2])) | |
1519 | + elif (axis0, axis1) == (2, 0): | |
1520 | + cursor.SetSpacing((spacing[2], spacing[1], spacing[0])) | |
1521 | + elif (axis0, axis1) == (1, 0): | |
1522 | + cursor.SetSpacing((spacing[0], spacing[2], spacing[1])) | |
1523 | + | |
1524 | + self.slice_data.renderer.ResetCamera() | |
1525 | + | |
1510 | 1526 | def AddActors(self, pubsub_evt): |
1511 | 1527 | "Inserting actors" |
1512 | 1528 | actors, n = pubsub_evt.data | ... | ... |