The vtkResliceImageViewer and the vtkResliceCursorRepresentation reslicer has different output

Hi,
I am using vtkResliceImageViewer follow the FourPaneViewer example, However, when I am using GetRepresentation()->GetReslice()->GetOutput(), sometimes the output image is different from the viewer output (mainly the orientation), I notice that when the green cursor in the sagital view pass the horizontal position, the viewer output was flipped, is this a bug of the camera?
My vtk version is VTK-8.1.2.


it is not a bug. These VTK classes implement one specific behavior but the optimal view orientation very much depends on the clinical application.

For example, you can orient the view to have the view up (or right) direction aligned with anatomical up (or left) directions, as shown in this Python code snippet. But there are many other valid strategies - such as simulating fluoroscopic views, commonly ultrasound imaging view conventions, etc.

1 Like

However, when the output flipped, the view up didn’t changed(Although the axes actor in the bottom left corner was flipped). I tried to set the view up, but the output continue to flip when pass the horizontal position. And when I rotate both green cursor, the view up became difficult to control.

Hi @kohit ,
I noticed the same behavior you pointed out. I was wondering if you found a solution and if you could share it please.
Many thanks

This is tricky, I modified the source code of VTK to keep the output not to be flipped, but this solution sometimes makes more wired behavior, such as the cursor couldn’t be selected. Anyway, I still consider VTK should do something about it.

You cannot just “not flip it”. At some point, you need to flip or rotate (switch axes).

You typically want to keep your “anatomical up” direction parallel with “view up” direction and “anatomical left” direction parallel with “view right” direction. However, as you rotate the view, you may find orientations where these constraints cannot be fulfilled, for example when “anatomical left” becomes close to parallel with the view normal then you need to switch axes. It can be an abrupt switch at a certain angle or a adjustment of orientation in a certain range.

The optimal axis switch/reorient strategy depends on the specific clinical application:

While VTK is widely used for visualization in many medical imaging software, implementing these axis reorienting strategies in VTK would be out of scope of VTK core (even if VTK had one or a few specific strategies implemented, there is a chance that your application would require something different).

1 Like