[vtkusers] orthogonal slices through a volume (and now non-orthogonal too).

David Gobbi dgobbi at atamai.com
Wed Aug 23 07:14:02 EDT 2006


Mark Gooding wrote:
> Hi all,
>
> In response to my question about displaying non-orthogonal planes,
> David kindly pointed me to this thread, which appears to be the best
> simple example of how to use vtkImageReslice in the archives so far.
> However I still a problem.
>
> To put things in context, I have been using the following pipeline to
> display orthogonal planes: ( I am trying to  use vtkImageReslice to
> display non-orthogonal planes.)
>
> vtkStructuredPoints
> vtkImageMapToColors
> vtkImageActor
> and using the actor's SetDisplayExtend to specify which plane to show.
>
> When using vtkImageReslice....to get planes through the centre of my
> volume I use:
>
> double origin[3];
> double spacing[3];
> imageDataStructuredPoints->GetOrigin(origin);
> imageDataStructuredPoints->GetSpacing(spacing);
> testReslice->SetResliceAxesOrigin((origin[0]+spacing[0]*(volumeSizeInVoxelsX/2)),(origin[1]+spacing[1]*(volumeSizeInVoxelsY/2)),(origin[2]+spacing[2]*(volumeSizeInVoxelsZ/2))); 
>
>        
> When displayed in 3D, the image appears offset by half the volume (
> see http://www.robots.ox.ac.uk/~gooding/vtkbizarre.html ), and I get
> the error message:
>
> ERROR: In \vtk\source\Filtering\vtkStreamingDemandDrivenPipeline.cxx, 
> line 628
> vtkStreamingDemandDrivenPipeline (026B50E8): The update extent
> specified in the information for output port 0 on algorithm
> vtkImageReslice(026B4028) is 182 182 0 359 0 177, which is outside the
> whole extent 0 363 0 359 0 0.

This is an issue with vtkImageActor.  The first time it runs, it sets 
its DisplayExtent from the WholeExtent of its input.  If the WholeExtent 
of the image ever changes afterwards, then it gives out the error that 
you reported above.

The trick is to reset the image actor DisplayExtent by setting it to 
(-1, 0, 0, 0, 0, 0), which will force the image actor to recompute its 
extent and position from the new WholeExtent instead of using old, 
invalid values.  The idea here is that vtkImageReslice is giving you 
exactly the slice that you want, so vtkImageActor should not be doing 
any extent or slice selection.

I think that vtkImageActor needs to be changed so that it will always 
automatically resize and reposition itself according to its input unless 
you call SetDisplayExtent() to fix its extent.  I have added a bug 
report for this, I've been bitten by it a couple times myself.

 - David
>
> Any suggestions as to what is going wrong?
>
> Cheers,
>
> mark
> _______________________________________________
> This is the private VTK discussion list. Please keep messages 
> on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>




More information about the vtkusers mailing list