Skip to content

Commit

Permalink
flip axes not images.
Browse files Browse the repository at this point in the history
  • Loading branch information
raacampbell committed Apr 8, 2020
1 parent 9846694 commit 502b095
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions lasagna/lasagna_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,16 +1001,41 @@ def axisRatio3Slot(self):

def flipAxis_Slot(self, axisToFlip):
"""
Loops through all displayed image stacks and flips the axes
This slot flips two of the axes at a time in way that makes it look as though the
stack itself was flipped.
Originally the stack was flipped via the image_stacks.flipAlongAxis method.
However, this only flips the volume so points traced on the volume:
https://github.com/SainsburyWellcomeCentre/lasagna/issues/136
axis 0: top left
axis 1: top right
axis 2: bottom left
The flip buttons should behave as follows:
View 1: axis 1 X-axis, axis 2 Y-axis
View 2: axis 0 X-axis, axis 2 X-axis
View 3: axis 0 Y-axis, axis 1 Y-axis
"""

image_stacks = self.returnIngredientByType("imagestack")
if not image_stacks:
return

for thisStack in image_stacks:
thisStack.flipAlongAxis(axisToFlip)

self.initialiseAxes()
#for thisStack in image_stacks:
# thisStack.flipAlongAxis(axisToFlip)
#
#self.initialiseAxes()

if (axisToFlip==0):
self.axes2D[1].view.getViewBox().invertX( not(self.axes2D[1].view.getViewBox().xInverted()) )
self.axes2D[2].view.getViewBox().invertY( not(self.axes2D[2].view.getViewBox().yInverted()) )
elif (axisToFlip==1):
self.axes2D[0].view.getViewBox().invertX( not(self.axes2D[0].view.getViewBox().xInverted()) )
self.axes2D[2].view.getViewBox().invertX( not(self.axes2D[2].view.getViewBox().xInverted()) )
elif (axisToFlip==2):
self.axes2D[0].view.getViewBox().invertY( not(self.axes2D[0].view.getViewBox().yInverted()) )
self.axes2D[1].view.getViewBox().invertY( not(self.axes2D[1].view.getViewBox().yInverted()) )

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Methods that are run during navigation
Expand Down

0 comments on commit 502b095

Please sign in to comment.