<!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.2800.1476" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY style="COLOR: #000000; FONT-FAMILY: Arial" bgColor=#ffffff>
<DIV>Hi, everyone,</DIV>
<DIV> </DIV>
<DIV>I try to use colour mapping on the isosuface which is generated by
vtkMarchingCubes.</DIV>
<DIV>The scalar range is between 0 and 53. but I only can get one colour. </DIV>
<DIV> </DIV>
<DIV>The following is my code structure. Please help me to find where I am
wrong.</DIV>
<DIV> </DIV>
<DIV>Thanks in advance!</DIV>
<DIV> </DIV>
<DIV>Tracy</DIV>
<DIV> </DIV>
<DIV><FONT
size=2>*************************************************************************************************************************************************</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>int main(int argc, char **argv)<BR>{<BR> float
range[2];</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>// Read dataset and extract a portion of an input structured
points dataset<BR>vtkStructuredPointsReader *reader =
vtkStructuredPointsReader::New();
<BR> reader->SetFileName(".//Data//MH_Zoning2.vtk");</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>vtkExtractVOI *extract =
vtkExtractVOI::New();<BR> extract->SetInput(reader->GetOutput());<BR> extract->SetVOI(0,
49, 0, 24, 0, 79); // whole dimention
50*50*80 <BR> extract->SetSampleRate(1, 2,
3);<BR> extract->Update();<BR> extract->GetOutput()->GetScalarRange(range);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>// define lookuptable<BR>vtkLookupTable *lut =
vtkLookupTable::New();<BR> lut->SetHueRange
(0.0,0.667);<BR> lut->SetNumberOfColors
(256);<BR> lut->Build();<BR> for (int i=0; i<53;
i++)<BR> lut->SetTableValue(i,
(i+1)/255.0,(i+2)/255.0,(i+3)/255.0, 1.0);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>// data rendering<BR>vtkMarchingCubes *plane =
vtkMarchingCubes::New();<BR>
plane->SetInput(extract->GetOutput());<BR>
plane->GenerateValues(54, 0,53);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>vtkCleanPolyData *cleaner =
vtkCleanPolyData::New();<BR>
cleaner->SetInput(plane->GetOutput());<BR>
<BR> //vtkDecimatePro *deci =
vtkDecimatePro::New();<BR> //
deci->SetInput(contours->GetOutput());<BR> //
deci->SetTargetReduction(0.9);<BR> //
deci->PreserveTopologyOn();</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>vtkSmoothPolyDataFilter *smoother =
vtkSmoothPolyDataFilter::New();<BR> smoother->SetInput
(cleaner->GetOutput());<BR> smoother->SetNumberOfIterations(150);<BR>
<BR>vtkPolyDataNormals *normals =
vtkPolyDataNormals::New();<BR> normals->SetInput
(smoother->GetOutput());<BR>
normals->FlipNormalsOff();</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>vtkPolyDataMapper *contMapper =
vtkPolyDataMapper::New();<BR>
contMapper->SetInput(normals->GetOutput());<BR>
contMapper->ScalarVisibilityOn();<BR>
contMapper->SetScalarRange(range);<BR>
contMapper->SetLookupTable(lut);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>vtkActor *contActor = vtkActor::New();<BR>
contActor->SetMapper(contMapper);<BR>
contActor->GetProperty()->SetOpacity (1);</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>// window stuff<BR>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 size=2>ren1->SetBackground( 0.5, 0, 0.5);<BR>ren1->AddActor(
contActor);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>iren->Initialize();<BR>iren->Start();</FONT></DIV>
<DIV> </DIV>
<DIV><FONT
size=2>reader->Delete();<BR>extract->Delete();<BR>lut->Delete();</FONT></DIV>
<DIV><FONT size=2>......</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>}</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<P></P></BODY></HTML>