[vtkusers] 2d slice of 3d array

David Feng dfeng at cs.unc.edu
Tue Mar 16 13:48:11 EDT 2010


Check out the vtkImagePlaneWidget.  It's an arbitrarily
orientable/translatable slice plane that resamples the data onto the
plane interactively.  Check out the documentation for how to interact.
 To use:

// assume "reader" is a normal image reader with vtkImageData as output,
// and you've set up your renderer/renderwindow/renderwindowinteractor as usual.
// "iren" is a pointer to the interactor.

vtkImagePlaneWidget* ipwidget = vtkImagePlaneWidget::New();
ipwidget->SetInteractor(iren);
ipwidget->SetInput(reader->GetOutput);

You can get a pointer to the resliced image for processing using
"ipwidget->GetResliceOutput()."

If this doesn't do exactly what you want, look at
vtkImagePlaneWidget's source code.  It has all you need for creating
your own slice plane, resampling, etc.

David


On Tue, Mar 16, 2010 at 12:15 PM, Ryan Murray <rymurr at gmail.com> wrote:
> Hi all,
> I am trying to do something which I think should be straightforward.
> I have a vtk image file which holds a large 3d array on a structured
> rectilinear grid
> The only part of the vtk file I want is a 2d slice in the x,y plane.
> The problem is that the slice I want is not necessarily at a grid point and
> the
> grid I want to output is not necessarily on the same grid as the vtk file.
>
>
> I have been able to successfully use vtkExtractVOI to extract a plane on teh
> grid defined in the vtk file and obviously read in the vtk file
> I really have no idea how to move the plane between z grid points or how to
> resample the extracted grid
>
> I would appreciate any suggestions
> Thanks
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>



-- 
http://www.cs.unc.edu/~dfeng



More information about the vtkusers mailing list