Python script to automate rotation

Michael_Allen
Wed, 06 Dec 2023 23:41:43 +0000
Support

Hi all, I’m working on a project creating radiographic views from CT scans, rotating one volume inside another using the repository script (https://github.com/Slicer/Slicer/blob/master/Base/Python/slicer/ScriptedLoadableModule.py). This works great. I need to make 1 degree increments and save time images each time, which for multiple patient samples, I’m hoping to automate. I wrote a Python script for exporting video and 3d spins of a CT volume for other projects, and that works well. Python and most programming is new to me but I can figure most stuff out with pointers in the right direction and google. In looking at the transform scripts that start to get into C++, I can’t really figure out whats going on though and could use some direction.

My workflow will be:

1. use the Script linked above to set the rotation point for my volume.

2. Increase the rotation by 1 degree.

3. Capture screenshot.

In a python script, is there a way to change the rotation of a volume transform? Does anyone know any places to start looking around for ideas?

I’ve been looking at these scripts on the slicer github to try and figure out what’s going on with little progress:
Modules/Loadable/Transforms/qSlicerTransformsModuleWidget.h
Modules/Loadable/Transforms/qSlicerTransformsModule.cxx
Libs/MRML/Widgets/qMRMLTransformSliders.cxx
Libs/MRML/Widgets/qMRMLTransformSliders.h

Thanks for any suggestions!

4 posts - 1 participant