Automate mrview volume rendering (rotation)


I’m looking for one way to automate screen capture of the volume rendering that involves rotation, not sure if it’s possible.

I want to achieve cardinal views along specific axis, rotating with mouse can’t guarantee the precision as I want to keep the view identical across several figures. I can manage to achieve that by toggling the rotate section in “screen capture” menu. For example, the one below, I rotate the volume from the default initial view by 90degrees along the 1st axis, then 90 degress along the second axis.

I wonder if there’s one way to automate this process through command line?

Many thanks!


Hi @lmx,

You can kind of automate this, but it might not give you the amount of control you’re after. You can use the -plane option to set the view to axial (2), sagittal (0) or coronal (1) – the index refers to the through-plane axis ([ 0 1 2 ] → [ X Y Z ]). Something like this should do the trick (through by the looks of things you’ll also likely need to add appropriate -tractography.load calls, etc.):

mrview glassbrain.mif -mode 3 -noannot -capture.prefix glassbrain -plane 0 -capture.grab -plane 1 -capture.grab -plane 2 -capture.grab -exit

This take a screenshot of your glassbrain.mif image from all 3 cardinal projections, with filename glassbrain000X.png, and exits immediately.

If you need more fine-grained tuning of the exact orientation, that’s unfortunately not yet possible. The other issue is that the axial projection is taken from below (to ensure radiological display convention), which might not be what you’re after…

If you want to do this within the viewer directly, you can always hit the R key (reset view), then A, S, or C keys to change the view to axial, sagittal or coronal. As before, this is limited to exactly those projections, but that might be enough if that’s all you need.

Thank you so much @jdtournier , it really helps.

One off topic question, is it possible to define the alpha by inputting a value either through gui or cmd, instead of dragging the alpha bar to adjust? It’s a bit tricky to replicate the same glass rendering across different sessions.