[vtkusers] vtkVolume vtkActor
Jochen K.
jochen.kling at email.de
Tue Jun 26 12:13:06 EDT 2012
Hi Antonio,
I've written a compilable example, which demonstrates converting an
vtkImageData object to vtkPolyData is working properly:
#include <vtkVersion.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkInteractorStyleUser.h>
#include <vtkSmartPointer.h>
#include "vtkVolume16Reader.h"
#include "vtkImageData.h"
#include "vtkImageDataGeometryFilter.h"
int main(int, char *[])
{
vtkSmartPointer<vtkVolume16Reader> v16 =
vtkSmartPointer<vtkVolume16Reader>::New();
v16->SetDataDimensions(64, 64);
v16->GetOutput()->SetOrigin(0.0, 0.0, 0.0);
v16->SetDataByteOrderToLittleEndian();
v16->SetFilePrefix("c:\\vtk\\vtkdata-5.8.0\\Data\\headsq\\quarter");
v16->SetImageRange(1, 93);
v16->SetDataSpacing(3.2, 3.2, 1.5);
v16->Update();
vtkImageData* imageData = v16->GetOutput();
vtkSmartPointer<vtkImageDataGeometryFilter> filter =
vtkSmartPointer<vtkImageDataGeometryFilter>::New();
filter->SetInput(imageData);
vtkSmartPointer<vtkPolyDataMapper> polyDataMapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
polyDataMapper->SetInputConnection(filter->GetOutputPort());
vtkSmartPointer<vtkActor> polyActor =
vtkSmartPointer<vtkActor>::New();
polyActor->SetMapper(polyDataMapper);
// get a reference to the renderwindow of our renderWindowControl1
// Visualize
vtkSmartPointer<vtkRenderer> renderer =
vtkSmartPointer<vtkRenderer>::New();
vtkSmartPointer<vtkRenderWindow> renderWindow =
vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->AddRenderer(renderer);
vtkSmartPointer<vtkRenderWindowInteractor> interactor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
interactor->SetRenderWindow(renderWindow);
renderer->AddActor(polyActor);
renderWindow->SetSize(500,500);
renderWindow->Render();
renderWindow->Render();
interactor->Start();
return EXIT_SUCCESS;
}
Maybe you will provide us with a full compilable small example demostrating
the problem.
best regards
Jochen
--
View this message in context: http://vtk.1045678.n5.nabble.com/vtkVolume-vtkActor-tp5714227p5714252.html
Sent from the VTK - Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120626/f3a4e3c8/attachment.htm>
More information about the vtkusers
mailing list