<!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 5.50.4134.600" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Dear friends,<BR>i want to display the grayscale
images(medical images) and fit to image </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>in given size.But the following code is giving
color image as output but i want grayscale image as output.And how to convert
image data to </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>polydata.Please give me suggestion.<BR>For that
output i wrote the folowing code:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> vtkImageReader *Reader =
vtkImageReader::New();<BR> Reader->SetDataByteOrderToLittleEndian();<BR> Reader->SetDataExtent(0,511,0,511,1,1);<BR> Reader->SetFileName(filepath);//give
here filepath<BR> Reader->SetDataSpacing(1.0, 1.0,
1.0);<BR> Reader->SetDataMask(0x7fff);<BR> Reader->SetDataScalarTypeToUnsignedShort();
<BR>////////////////<BR> //vtkImageLuminance
*luminance=vtkImageLuminance::New();<BR>
//luminance->SetInput(Reader->GetOutput());</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>vtkImageDataGeometryFilter
*geometry=vtkImageDataGeometryFilter::New();<BR>
geometry->SetInput(Reader->GetOutput());</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>vtkWarpScalar
*warp=vtkWarpScalar::New();<BR>
warp->SetInput(geometry->GetOutput());<BR>
warp->SetScaleFactor(-0.1);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>vtkMergeFilter
*merge=vtkMergeFilter::New();<BR>
merge->SetGeometry(warp->GetOutput());<BR>
merge->SetScalars(Reader->GetOutput());</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>vtkDataSetMapper
*mapper=vtkDataSetMapper::New();<BR>
mapper->SetInput(merge->GetOutput());<BR>
mapper->SetScalarRange(0, 255);<BR>
mapper->ImmediateModeRenderingOff();</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>vtkActor
*actor=vtkActor::New();<BR> actor->SetMapper(mapper);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>vtkRenderer
*ren1=vtkRenderer::New();<BR>vtkRenderWindow
*renWin=vtkRenderWindow::New();<BR>
renWin->AddRenderer(ren1);<BR> vtkRenderWindowInteractor
*iren=vtkRenderWindowInteractor::New();<BR>//
iren->SetRenderWindow(renWin);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> ren1->AddActor(actor);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> renWin->SetSize(250,250); //threse size
are given dynamically<BR> renWin->SetParentId(m_wnd);//control
Id.<BR> <BR> renWin->Render();</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><BR>Thanking
you,<BR>Regards,<BR>satyanarayana</FONT></DIV></BODY></HTML>