[vtkusers] Problems with vtkImageViewer2

Steven Hou steveo14 at gmail.com
Mon Nov 24 15:24:38 EST 2008


Hi everyone, I am trying to display a 2D image using wxVTK:

My code looks something like this:

vtkImageViewer2 *viewer;
wxVTKRenderWindowInteractor *m_pVTKWindow;

viewer = vtkImageViewer2::New();
m_pVTKWindow = new wxVTKRenderWindowInteractor(notebook, MY_VTK_WINDOW);
notebook->AddPage(m_pVTKWindow, "wxVTK");

vtkImageData *image = vtkImageData::New();
image->SetDimensions(xSize+1,ySize+1,zSize+1);
image->SetScalarTypeToDouble();
image->AllocateScalars();

double *x = static_cast<double*>(image->GetScalarPointer());

... I fill x with data

viewer->SetInput(image);
viewer->SetColorWindow(1230100);
viewer->SetColorLevel(615050);
viewer->SetupInteractor ( m_pVTKWindow );

When I compile this code, the image viewer displays a black screen. If I
change vtkImageViewer2 to vtkImageViewer, the image is displayed properly.
Are there compatibility issues with wxVTK and vtkImageViewer2?

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081124/3521cee6/attachment.htm>


More information about the vtkusers mailing list