[vtkusers] Please help I don't understand why vtkImageViewer doesn't work properly !!!

Łukasz Tutaj ltutaj at wp.pl
Thu Oct 6 12:44:59 EDT 2005


Hi vtk Users,

    I think that this source code should work properly but it only shows 
some small empty window.

int main()
{
    vtkDICOMImageReader *reader = vtkDICOMImageReader::New();
    reader->SetFileName("D:\\PRACA MAGISTERSKA\\dane381\\46009361");
    vtkImageViewer2 *viewer = vtkImageViewer2::New();
    viewer->SetInput(reader->GetOutput());
    viewer->SetColorLevel(40);
    viewer->SetColorWindow(300);
    vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
    viewer->SetupInteractor(iren);
    iren->Initialize();
    iren->Start();
    ...
    return 0;
}

Changing lines
    ...
    iren->Initialize();
    iren->Start();
    ...
  to
    viewer->Render();
image is displayed correctly but window is disappears very fast - it 
means that something is wrong with interactor but I don't know what.
Could somebody tell me what is wrong?

Thanks.
Łukasz Tutaj




More information about the vtkusers mailing list