On Sun, Nov 23, 2008 at 5:01 AM, Steven Hou <ste...@gm...> wrote:
> 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?
Yes.
I think it happen somewhere in between VTK 4.4 and VTK 5.0 (during the
pipeline transition). I tried once to figure out what was going on,
but gave up.
I think the ordering with SetupInteractor is important. For instance,
this used to work:
http://gdcm.svn.sf.net/viewvc/gdcm/trunk/Utilities/wxWidgets/wxGDCMFrame.cpp?view=markup
If you find anything, please let me know !
Thanks
--
Mathieu
|