[Insight-users] Problem using ImageToVTKImageFilter and QVTKWidget
jason yuan
jiaxin.yuan at gmail.com
Wed Aug 3 01:44:07 EDT 2011
Hi Luis and Françoise,
I met the same problem in the new version of itk (3.20), but it seems to
have fixed at 2010-10-21, can somebody tell me how to get a stable version
which can solve this problem?
Thank you in advance, it bother me for quite a few days.
Below is my source code.
QString fileName = QFileDialog::getOpenFileName(this,
tr("Open Image"), "c:/", tr("*.*"));
typedef itk::Image<unsigned short,2> ImageType;
typedef itk::ImageFileReader<ImageType> ReaderType;
typedef itk::ImageToVTKImageFilter<ImageType> ConnectorType;
ReaderType::Pointer readerITK = ReaderType::New();
readerITK->SetFileName(fileName.toLocal8Bit().constData());
ConnectorType::Pointer connector = ConnectorType::New();
connector->SetInput( readerITK->GetOutput() );
vtkImageData* vtkimage = vtkImageData::New();
connector->Update();
vtkimage = connector->GetOutput();
vtkImageViewer* viewer = vtkImageViewer::New();
viewer->SetInput(vtkimage );
ui->qvtkWidget->SetRenderWindow(viewer->GetRenderWindow());
viewer->SetupInteractor(ui->qvtkWidget->GetRenderWindow()->GetInteractor());
viewer->Render();
viewer->SetColorWindow( 254 );
viewer->SetColorLevel( 128 );
BR,
Jason
--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Problem-using-ImageToVTKImageFilter-and-QVTKWidget-tp3769440p6647616.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.
More information about the Insight-users
mailing list