1313iterations = 28 # Number of frames in GIF
1414size = 384 # Output size
1515
16+
1617class Rotate (fast .PythonProcessObject ):
1718 def __init__ (self , iterations ):
1819 super ().__init__ ()
@@ -27,12 +28,12 @@ def execute(self):
2728 spacing = input .getSpacing ()
2829 transform = fast .Transform .create ()
2930 # Rotate volume the right way first
30- transform .addRotation (3.14 / 2 , np . array ( [1 , 0 , 0 ], dtype = np . float32 ) )
31- transform .addRotation (3.14 , np . array ( [0 , 1 , 0 ], dtype = np . float32 ) )
31+ transform .addRotation (3.14 / 2 , [1 , 0 , 0 ])
32+ transform .addRotation (3.14 , [0 , 1 , 0 ])
3233 # Do the rotation:
33- transform .addRotation (self .angle , np . array ( [0 , 0 , 1 ], dtype = np . float32 ) )
34+ transform .addRotation (self .angle , [0 , 0 , 1 ])
3435 # To rotate around the center, we have to move to volume so its center is at origo:
35- transform .addTranslation (np . array ( [- input .getWidth ()* spacing [0 , 0 ]/ 2 , - input .getHeight ()* spacing [1 , 0 ]/ 2 , - input .getDepth ()* spacing [2 , 0 ]/ 2 ], dtype = np . float32 ) )
36+ transform .addTranslation ([- input .getWidth ()* spacing [0 ]/ 2 , - input .getHeight ()* spacing [1 ]/ 2 , - input .getDepth ()* spacing [2 ]/ 2 ])
3637 input .setTransform (transform )
3738
3839 self .angle += 2 * math .pi / iterations # Increment angle to have it rotate over time
0 commit comments