Commit f9b2672b8efd668059ca96044ac530b9dc3f2bac
1 parent
2ce38179
Exists in
master
and in
67 other branches
When user scroll through the slices and last one reached is not more raised the scroll event
Showing
1 changed file
with
6 additions
and
4 deletions
Show diff stats
invesalius/data/slice_.py
| @@ -128,13 +128,15 @@ class Slice(object): | @@ -128,13 +128,15 @@ class Slice(object): | ||
| 128 | 128 | ||
| 129 | def GetMaxSliceNumber(self, orientation): | 129 | def GetMaxSliceNumber(self, orientation): |
| 130 | shape = self.matrix.shape | 130 | shape = self.matrix.shape |
| 131 | - | 131 | + |
| 132 | + # Because matrix indexing starts with 0 so the last slice is the shape | ||
| 133 | + # minu 1. | ||
| 132 | if orientation == 'AXIAL': | 134 | if orientation == 'AXIAL': |
| 133 | - return shape[0] | 135 | + return shape[0] - 1 |
| 134 | elif orientation == 'CORONAL': | 136 | elif orientation == 'CORONAL': |
| 135 | - return shape[1] | 137 | + return shape[1] - 1 |
| 136 | elif orientation == 'SAGITAL': | 138 | elif orientation == 'SAGITAL': |
| 137 | - return shape[2] | 139 | + return shape[2] - 1 |
| 138 | 140 | ||
| 139 | def OnRemoveMasks(self, pubsub_evt): | 141 | def OnRemoveMasks(self, pubsub_evt): |
| 140 | selected_items = pubsub_evt.data | 142 | selected_items = pubsub_evt.data |