[vtkusers] 2d slice of 3d array

David Feng dfeng at cs.unc.edu
Wed Mar 17 12:26:37 EDT 2010


You're probably right about the scaling, just to make texturing quick.
 Position and size of the plane you can control, but I don't think
spacing and step size are exposed.  You'll probably have to write your
own version of the class if you want that level of control,
unfortunately.

David

On Wed, Mar 17, 2010 at 9:28 AM, Ryan Murray <rymurr at gmail.com> wrote:
> Hi David,
> Thanks a lot for the hint. It worked perfectly
>
> The vtkImageData that comes out of GetResliceOutput() has a different number
> of points than the input
> In my case the input was 232x232x232 and the output was 256x256x1
> I assume that it was scaled to the closest multiple of 2
> Is there a way to control the output number or stepsize? Interpolating as
> necessary?
>
> Thanks
> Ryan
>
> On Tue, Mar 16, 2010 at 5:48 PM, David Feng <dfeng at cs.unc.edu> wrote:
>>
>> 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
>
>



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



More information about the vtkusers mailing list