[vtkusers] Error messages and no image with vtkImageViewer2

Jan vtk at schreiber2.de
Thu Jun 19 18:20:34 EDT 2008


Hi John,

thanks a lot for your quick reply.

I have now changed it to
     typedef itk::Image< unsigned char, 2 > ImageType;
     typedef itk::ImageFileReader< ImageType > ReaderType;

Unfortunately, nothing has changed. The second error message 
("vtkOpenGLImageActor (0x1173a00): This filter requires unsigned char 
scalars as input") already appears at startup before I initiate loading 
the image...

Do you have any other ideas that could solve the issue?

Thanks,
Jan


John Eke wrote:
> 
> 
> 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
> 




More information about the vtkusers mailing list