# How rotate images in a sequence?

How to “anti-Transverse” for a sequence? Or, how to do inplane rotation for images in a sequence for 90 degree (not 3D rotation, but 2D in-plane rotation)?

Hi everyone,

I need help fixing a sequence of linear transforms. The sequences are ultrasound data collected using modules “OpenIGTLinkIF” and “Volume Reslice Diver”. However, I probably incorrectly set up the module “Volume Reslice Driver” (as the screenshot shows below) when I was collecting the data, resulting in all ultrasound images rotated for 90 degrees.

How can I batch-process the sequence to “anti-Transverse” all the linear transforms, so that all the images can rotate back in 3D while maintaining the 3D position relationship among images in the sequence? In other words, how to let each frame in a sequence in-plane rotate 90 degrees instead of a 3D rotation? (What kind of python script function should I write in order to achieve it?)

Thank you so much in advance!

You can fix this by applying a simple linear transform to the image (TransducerToProbe) to fix this. Your transform tree will look like this:

``````-- ProbeToReference
+-- TransducerToProbe
+-- Image_Transducer
``````
• ProbeToReference is the transform provided by the tracking system (changing in time, along with the image)
• TransducerToProbe transform is responsible for correctly positioning and orienting the image slice relative to the tracking sensor/marker.
• Image_Transducer is the image you recorded, it contains a constant transform that is usually used for scaling and moving the image so that its origin is in the transducer’s origin and the Y axis is the sound propagation direction. If in your case the axes are not aligned like this it is not an issue at all, as you can compensate for any errors in the TransducerToProbe transform.

Problem solved! Thank you so much!

BTW, could you please confirm that the error resulted from using the “Transverse” mode in the module “Volume Reslice Diver” when collecting the sequence data? I forgot why I chose that mode. Should I choose it next time when collecting sequence data?

No, Volume Reslice Driver does not change any data, except for the positions of the 2D views. It moves the views to the ultrasound images, not the images to the views.

Hi Tamas,

The problem was that the TransducerToProbe transform was missing from your transform hierarchy. The image was in `Transducer` coordinate system, so you had to transform it into the `Probe` coordinate system before you could apply the `ProbeToReference` transform.