<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I think this reproduces the error, but I had to run it in
Debug-Mode. Then it went into the part where the described error is
generated.<br>
<br>
<i>typedef itk::Image<unsigned char,2> imagetype;<br>
vtkSmartPointer<vtkJPEGReader>
reader=vtkSmartPointer<vtkJPEGReader>::New();<br>
reader->SetFileName("1.jpg");<br>
<br>
vtkSmartPointer<vtkImageActor>
actor=vtkSmartPointer<vtkImageActor>::New();<br>
actor->SetInput(reader->GetOutput());<br>
<br>
vtkSmartPointer<vtkImageCast>
caster=vtkSmartPointer<vtkImageCast>::New();<br>
caster->SetInput(actor->GetInput());<br>
caster->SetOutputScalarTypeToUnsignedChar();<br>
<br>
itk::VTKImageToImageFilter<imagetype>::Pointer
vtk2itk=itk::VTKImageToImageFilter<imagetype>::New();<br>
vtk2itk->SetInput(caster->GetOutput());<br>
vtk2itk->Update();<br>
<br>
itk::BinaryThresholdImageFilter<imagetype,imagetype>::Pointer
binaryfilter=itk::BinaryThresholdImageFilter<imagetype,imagetype>::New();<br>
binaryfilter->SetLowerThreshold(125*(-1));<br>
binaryfilter->SetInput(vtk2itk->GetOutput());<br>
binaryfilter->Update();<br>
<br>
itk::ImageToVTKImageFilter<imagetype>::Pointer
itk2vtk=itk::ImageToVTKImageFilter<imagetype>::New();<br>
itk2vtk->SetInput(binaryfilter->GetOutput());<br>
itk2vtk->Update();<br>
<br>
vtkSmartPointer<vtkRenderWindowInteractor>
interactor=vtkSmartPointer<vtkRenderWindowInteractor>::New();<br>
<br>
vtkSmartPointer<vtkImageViewer2>
viewer=vtkSmartPointer<vtkImageViewer2>::New();<br>
viewer->SetInput(itk2vtk->GetOutput());<br>
viewer->SetupInteractor(interactor);<br>
<br>
interactor->Initialize();<br>
viewer->Render();<br>
interactor->Start();<br>
</i><br>
Am 04.12.2011 19:25, schrieb David Doria:
<blockquote
cite="mid:CABDpjT=RK60QX4O6ZvYg4gXyoa42_BBd7xonr82d5ezX6813Kg@mail.gmail.com"
type="cite">
<pre wrap="">On Sun, Dec 4, 2011 at 1:20 PM, Ralf.Denhof <a class="moz-txt-link-rfc2396E" href="mailto:ralf.denhof@gmx.de"><ralf.denhof@gmx.de></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Am 04.12.2011 19:18, schrieb David Doria:
</pre>
<blockquote type="cite">
<pre wrap="">Did you call imageImport->SetNumberOfScalarComponents (4); ?
</pre>
</blockquote>
<pre wrap="">
No, never in the whole project.
</pre>
</blockquote>
<pre wrap="">
Try to setup an as-small-as-possible project that compiles to give
this error. The error seems to indicate there is something wrong with
the number of components of the input image vs the number of
components the import filter is expecting. Try to simulate the
conditions you have and produce the error so we can more easily help
you debug it.
David
</pre>
</blockquote>
<br>
</body>
</html>