[vtkusers] Reorienting the reslice plane with vtkResliceImageViewer

Colin Horne colin at cdfh.org.uk
Thu Dec 8 10:41:11 EST 2016

Hi all,

In case it's of interest to anyone else, here's how I ended up solving
my problem:

// Note that all viewers share the same vtkResliceCursor instance, as
par the FourPaneViewer example program.
vtkResliceCursor *cursor = ...;

double *ptrs[3] = { x_axis, y_axis, z_axis };
double *origin = ...;

for (int i=0; i<3; ++i) {


// Now call Render() on each viewer, as necessary.


On 12 October 2016 at 00:07, Colin Horne <colin at cdfh.org.uk> wrote:
> Hi all,
> I'm using the vtkResliceImageViewer class to display a 3D volume in oblique
> mode, essentially as is done in the FourPaneViewer example program.The
> reslice cursor widget lets me reorient a given reslice plane with the mouse,
> but I would also like to set its orientation via the API. To this end, I
> have tried:
> viewer->GetResliceCursor()->SetYAxis(yaxis);
> viewer->GetResliceCursor()->Modified();
> viewer->Render();
> where 'viewer' is an instance of vtkResliceImageViewer and 'yaxis' has type
> double[3].
> Unfortunately, however, the code has no effect on the orientation of the
> slice. Indeed, after the call to Render(), calling GetYAxis() reveals that
> the changes have been overwritten.
> I'm afraid that I'm entirely new to VTK, and so am perhaps missing something
> embarrassingly obvious. I would be very grateful for any suggestions. I
> should mention that I'm hoping there might be a solution that is compatible
> with the existing vtkResliceCursorWidget (i.e., rather than using
> vtkResliceImage directly), as I still need to allow reorienting via the
> mouse.
> Many thanks!
> Colin

More information about the vtkusers mailing list