<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7638.1">
<TITLE>RE: [vtkusers] Error messages and no image with vtkImageViewer2</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=2>Hi Jan,<BR>
<BR>
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.<BR>
<BR>
- John<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: vtkusers-bounces@vtk.org on behalf of Jan<BR>
Sent: Wed 6/18/2008 6:22 PM<BR>
To: vtkusers@vtk.org<BR>
Subject: [vtkusers] Error messages and no image with vtkImageViewer2<BR>
<BR>
Hi,<BR>
<BR>
I am writing a little QT application using ITK and VTK, trying to use<BR>
vtkIMageViewer2.<BR>
<BR>
During startup, I get the following error messages:<BR>
<BR>
ERROR: In VTK-504/Filtering/vtkDemandDrivenPipeline.cxx, line 710<BR>
vtkStreamingDemandDrivenPipeline (0x11b8570): Input port 0 of algorithm<BR>
vtkImageMapToWindowLevelColors(0x118dc50) has 0 connections but is not<BR>
optional.<BR>
<BR>
ERROR: In VTK-504/Rendering/vtkImageActor.cxx, line 182<BR>
vtkOpenGLImageActor (0x11bfaf0): This filter requires unsigned char<BR>
scalars as input<BR>
<BR>
And the view keeps blank<BR>
<BR>
<BR>
=============================================================<BR>
Code:<BR>
=============================================================<BR>
ViewingWidget.h:<BR>
...<BR>
QVTKWidget _view;<BR>
...<BR>
<BR>
ViewingWidget.cpp:<BR>
...<BR>
ViewingWidget::ViewingWidget( const char* name) :<BR>
QWidget()<BR>
{<BR>
_imageViewer = vtkImageViewer2::New();<BR>
_view.setParent( this );<BR>
_view.SetRenderWindow( _imageViewer->GetRenderWindow() );<BR>
_imageViewer->SetupInteractor(<BR>
_view.GetRenderWindow()->GetInteractor() );<BR>
_imageViewer->SetColorLevel( 100 );<BR>
_imageViewer->SetColorWindow( 256 );<BR>
}<BR>
...<BR>
<BR>
loading the image comes later when pressing a button.<BR>
<BR>
typedef itk::Image< unsigned char, 3 > ImageType;<BR>
typedef itk::ImageSeriesReader< ImageType > ReaderType;<BR>
typedef itk::ImageToVTKImageFilter< ImageType > FilterType;<BR>
<BR>
ImageType::Pointer image;<BR>
ReaderType::Pointer reader = ReaderType::New();<BR>
FilterType::Pointer itk2vtk;<BR>
...<BR>
reader->SetFileNames( names );<BR>
reader->Update();<BR>
image = reader->GetOutput();<BR>
<BR>
itk2vtk->SetInput( image );<BR>
_imageViewer->SetInput( itk2vtk->GetOutput() );<BR>
=============================================================<BR>
<BR>
when I use<BR>
<BR>
vtkPNGReader* reader = vtkPNGReader::New();<BR>
reader->SetFileName( "image.png" );<BR>
_imageViewer->SetInputConnection( reader->GetOutputPort() );<BR>
<BR>
it shows me a grayscale pattern that does not really look like the input<BR>
image.<BR>
<BR>
=============================================================<BR>
<BR>
It would be great if you could give me a hint how to properly use<BR>
vtkImageViewer2.<BR>
<BR>
Thanks,<BR>
Jan<BR>
<BR>
<BR>
VTK: 5.0.4<BR>
ITK: 3.4.0<BR>
QT: 4.3<BR>
gcc: 4.2.1 (SUSE Linux)<BR>
OpenSuSE 10.3 64bit<BR>
<BR>
<BR>
<BR>
_______________________________________________<BR>
This is the private VTK discussion list.<BR>
Please keep messages on-topic. Check the FAQ at: <A HREF="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</A><BR>
Follow this link to subscribe/unsubscribe:<BR>
<A HREF="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</A><BR>
<BR>
</FONT>
</P>
</BODY>
</HTML>