How do I orient homogeneously the 3d viewer of the scene across different scenes?

Hi,
I am doing some volume analysis of a tomography with time resolution.
This means that I have several set of data that, if reconstructed, lead to different scenes (which I have saved indipendently).
I would like to make some video of the 3d time resolved reconstruction, but since I have not enough power in my laptop, I need to do it in an old fashion way (exporting the images of the 3d and then put them together).

The problem is that somhow I have changed the orientation of segmentation in the 3d viewer of the scene and to have a constant orientation, I need to set back the original orientation of the 3d viewer.
How can I do it?
I am attaching two screenshot that show the situation
These are two different scenes, and the only thing that changes is the orientation in the 3d viewer… I could I make it homogeneous (so then I can do a video). I would like a precise method to do it, and I would avoid to do it manually by scrolling.

Thank you very much for your time, any help would be appreciated.

You can get the camera node settings from the view you want, and apply those in another scene.

cameraNode = slicer.modules.cameras.logic().GetViewActiveCameraNode(slicer.app.layoutManager().threeDWidget(0).mrmlViewNode())
camPosition = [0,0,0] # just pre-allocating position variable
cameraNode.GetPosition(camPosition) # filling in the position variable
camFocalPoint = [0,0,0] # pre-allocating focal point (direction the camera is pointing from the position)
cameraNode.GetFocalPoint(camFocalPoint) # filling in focal point
camViewUp = [0,0,0] # pre-allocating view up direction (vector pointing up, perpendicular to vector from position to focal point)
cameraNode.GetViewUp(camViewUp) 

You can just record the values you find for these camera parameters, and then do the following to apply them to another scene:

cameraNode = slicer.modules.cameras.logic().GetViewActiveCameraNode(slicer.app.layoutManager().threeDWidget(0).mrmlViewNode())
cameraNode.SetPosition(camPosition) # setting camera location
cameraNode.SetPosition(camFocalPoint) # setting direction camera is looking
cameraNode.SetViewUp(camViewUp) # setting up direction (i.e. the rotation around the position-focal point axis)

You can also play time sequences of any nodes (volumes, models, markups, transforms, …) using Sequences module.

Load all your volumes into the scene, go to Sequences module, go to Edit tab, select each volume node from the right box, and add it to the sequence (left box) by clicking the green button. You can replay sequences by switching to Browse tab, select your newly created sequence node, and click the green + button.

You can create videos of your sequence using Screen Capture module.

Hi,

@mikebind , I guess I should open the python interface and paste your code right (sorry I am not good at programming)?

And then I just close the scene and open the one I want to paste again the second part of the code?

For @lassoan , the problem is my laptop RAM. I have a 16 gb Ram + graphic one (4GB), but it is not enough to digest 31 volumes (11 MB each) and create the sequence (RAM error occurs if I try so, even with only 7 volumes). If you have an idea how to skip this would be great!

To deal with limited amount of physical RAM you can:

  • load, crop/resample (using Crop volume module), and save each volume. Just by a downsampling by a spacing scale of 2x, you reduce the memory usage by 8x
  • increase virtual memory size in your system settings (this make make your computer slow when you load a lot of data, but the application will still keep running)
  • afyer you added a few volumes to the sequence, delete those volumes from the scene (they are stored in the sequence already)

Yes, you can open the python interactor (Ctrl+3 or the python button in the toolbar) and paste. The variables you create (camFocalPoint, etc.) will persist after you close the scene and open a new one, but will not persist after you close and reopen Slicer. (To deal with that you could save them to a file, or even just print them and write them down (e.g. print camFocalPoint in the interactor)). If you can get @lassoan’s solution working, that’s a much more elegant approach, but if not, maybe this hack can get you through what you want to accomplish.