<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16981" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN class=650135403-18032010>Hi
Folks,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=650135403-18032010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=650135403-18032010>Could someone please
provide some advice with mapping a VTK-generated image data (using
vtkShepardMethod) to a polygonal actor?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=650135403-18032010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=650135403-18032010>I can generate a
.vti file (vtkXMLImageData) and view it in ParaView and all looks correct - but
when I try to write a JPEG or map the image data to a texture, I get nothing -
just white.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=650135403-18032010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=650135403-18032010>I have tried
different combinations of casting and adding lookup table to vtkTexture without
success. </SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=650135403-18032010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=650135403-18032010>Is
it perhaps because the output from vtkShepardMethod is a 3D
texture? All I want is a 2D image interpolated from scattered pointset
(with all points at z=0)</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=650135403-18032010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=650135403-18032010>The test code I am
using is as follows:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=650135403-18032010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=650135403-18032010> _shepard->SetInput(flattenFilter->GetOutput());
// vtkShepardMethod<BR> _shepard->SetSampleDimensions(500,
500, 1); // outputs a 3D image? - SetSampleDimensions(500, 500, 0) does not
work<BR> _shepard->SetModelBounds(263438.741093,
392234.568386, 6889434.400505, 7052138.258763, -0.1, 0.1);
<BR> _shepard->SetMaximumDistance(1.0);<BR> _shepard->Update();</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><SPAN class=650135403-18032010><FONT face=Arial size=2>
// Cast scalars - double to unsigned char</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=650135403-18032010> vtkSmartPointer<vtkImageCast>
castFilter =
vtkSmartPointer<vtkImageCast>::New();<BR> castFilter->SetInput(_shepard->GetOutput());<BR> castFilter->SetOutputScalarTypeToUnsignedChar();<BR> castFilter->Update();</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=650135403-18032010> vtkSmartPointer<vtkLookupTable>
table =
vtkSmartPointer<vtkLookupTable>::New();<BR> table->SetTableRange(0,255);<BR> table->SetValueRange(0.0,1.0);<BR> table->SetSaturationRange(0.0,0.0);<BR> table->SetHueRange(0.0,0.0);<BR> table->SetAlphaRange(1.0,1.0);<BR> table->SetNumberOfColors(256);<BR> table->Build();</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=650135403-18032010> vtkSmartPointer<vtkImageMapToColors>
colorize =
vtkSmartPointer<vtkImageMapToColors>::New();<BR> colorize->SetOutputFormatToRGB();<BR> colorize->SetLookupTable(table);<BR> colorize->SetInput(castFilter->GetOutput());<BR> colorize->Update();</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=650135403-18032010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=650135403-18032010> //
At this point have tried adding colorize->GetOutput() to a vtkTexture
and mapping to a polydata actor (having correct texture coordinates) without
success</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=650135403-18032010> //write JPEG image - output
image is all white<BR> vtkSmartPointer<vtkJPEGWriter>
writer =
vtkSmartPointer<vtkJPEGWriter>::New();<BR> writer->SetFileName(buff.str().c_str());<BR> writer->SetInput(colorize->GetOutput());<BR> writer->Write();</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><SPAN class=650135403-18032010><FONT face=Arial size=2> //
write VTI file - This file displays correctly in ParaView (image shows as
an unsigned char with 3 components)</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=650135403-18032010> vtkSmartPointer<vtkXMLImageDataWriter>
writer2 =
vtkSmartPointer<vtkXMLImageDataWriter>::New();<BR> writer2->SetFileName(buff2.str().c_str());<BR> writer2->SetInput(colorize->GetOutput());<BR> writer2->Update();</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=650135403-18032010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=650135403-18032010>Why is the JPEG
white while the VTI file displays correctly?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=650135403-18032010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=650135403-18032010>Thanks a heap for
any assistance!</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=650135403-18032010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=650135403-18032010>Kind
regards,</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV align=left><FONT face=Arial size=2>Allan James</FONT></DIV>
<DIV align=left><FONT face=Arial size=2>High Performance Computing &
Research Support<BR>Queensland University of Technology<BR>(07) 3138 9264<BR><A
href="mailto:ar.james@qut.edu.au">ar.james@qut.edu.au</A><BR><A
href="http://www.qut.edu.au/its/hpc">http://www.qut.edu.au/its/hpc</A></FONT><FONT
face=Arial size=2><BR> <BR>><(((º> ._.·´¯`·..
>++(((º> ._.·´¯`·.. >++(((º></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV></BODY></HTML>