[vtkusers] vtkImageViewer2 with QVTKWidget
    Luca Pamparana 
    deluded.soul at gmail.com
       
    Thu Jul 27 10:04:34 EDT 2006
    
    
  
Hi everyone,
So I cut down the code but still cannot display a DICOM image inside of
vtkImageViewer2 object. The normal vtkImageViewer works fine.
Here is the updated code:
QApplication app(argc, argv);
QVTKWidget widget;
#if QT_VERSION < 0x040000
    app.setMainWidget(&mainWin);
#endif
vtkDICOMImageReader *reader = vtkDICOMImageReader::New();
reader->SetDirectoryName("/home/luca/data/dicom/11088");
reader->Update();
vtkImageViewer2 * view2 = vtkImageViewer2::New();
view2->SetInputConnection(reader->GetOutputPort());
double * range = reader->GetOutput()->GetScalarRange();
view2->SetColorLevel (0.5 * (range[1] + range[0]));
view2->SetColorWindow (range[1] - range[0]);
widget.SetRenderWindow(view2->GetRenderWindow());
// Put these 2 lines....just in case...
view2->SetSlice(0);
view2->GetRenderer()->ResetCameraClippingRange();
view2->Render();
widget.show();
// Run our application loop.
app.exec();
I really am lost as to why it would not show me the image. Again,
substituting vtkImageViewer2 with vtkImageViewer works fine. Is there some
trick with the camera or the renderer that I am forgetting??? I am running
SuSe 10.1 on a 64 bit machine.
If someone can try this code and let me know if it works on their machine,
it would be great.
Cheers,
Luca
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060727/8255fe80/attachment.htm>
    
    
More information about the vtkusers
mailing list