[vtkusers] Error messages and no image with vtkImageViewer2
John Eke
johne at annidis.com
Thu Jun 19 09:54:38 EDT 2008
Hi Jan,
Have you tried the ITK+VTK connection reading just one image file for now? see if you can make that work before you try reading several slices. If you read in the image as <unsigned char, 2> the you shouldn't get the second error message anymore.
- John
-----Original Message-----
From: vtkusers-bounces at vtk.org on behalf of Jan
Sent: Wed 6/18/2008 6:22 PM
To: vtkusers at vtk.org
Subject: [vtkusers] Error messages and no image with vtkImageViewer2
Hi,
I am writing a little QT application using ITK and VTK, trying to use
vtkIMageViewer2.
During startup, I get the following error messages:
ERROR: In VTK-504/Filtering/vtkDemandDrivenPipeline.cxx, line 710
vtkStreamingDemandDrivenPipeline (0x11b8570): Input port 0 of algorithm
vtkImageMapToWindowLevelColors(0x118dc50) has 0 connections but is not
optional.
ERROR: In VTK-504/Rendering/vtkImageActor.cxx, line 182
vtkOpenGLImageActor (0x11bfaf0): This filter requires unsigned char
scalars as input
And the view keeps blank
=============================================================
Code:
=============================================================
ViewingWidget.h:
...
QVTKWidget _view;
...
ViewingWidget.cpp:
...
ViewingWidget::ViewingWidget( const char* name) :
QWidget()
{
_imageViewer = vtkImageViewer2::New();
_view.setParent( this );
_view.SetRenderWindow( _imageViewer->GetRenderWindow() );
_imageViewer->SetupInteractor(
_view.GetRenderWindow()->GetInteractor() );
_imageViewer->SetColorLevel( 100 );
_imageViewer->SetColorWindow( 256 );
}
...
loading the image comes later when pressing a button.
typedef itk::Image< unsigned char, 3 > ImageType;
typedef itk::ImageSeriesReader< ImageType > ReaderType;
typedef itk::ImageToVTKImageFilter< ImageType > FilterType;
ImageType::Pointer image;
ReaderType::Pointer reader = ReaderType::New();
FilterType::Pointer itk2vtk;
...
reader->SetFileNames( names );
reader->Update();
image = reader->GetOutput();
itk2vtk->SetInput( image );
_imageViewer->SetInput( itk2vtk->GetOutput() );
=============================================================
when I use
vtkPNGReader* reader = vtkPNGReader::New();
reader->SetFileName( "image.png" );
_imageViewer->SetInputConnection( reader->GetOutputPort() );
it shows me a grayscale pattern that does not really look like the input
image.
=============================================================
It would be great if you could give me a hint how to properly use
vtkImageViewer2.
Thanks,
Jan
VTK: 5.0.4
ITK: 3.4.0
QT: 4.3
gcc: 4.2.1 (SUSE Linux)
OpenSuSE 10.3 64bit
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080619/94877889/attachment.htm>
More information about the vtkusers
mailing list