<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial">Hello, everyone,<br><div id="isForwardContent"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>I got a problem when I do surface reconstruction using vtkDiscreteMarchingCubes. Can somebody give me a help? <br>Thank you very much.<br>Fei Liu<br><br>-----------------<br>Objective:</div>we want to do surface reconstruction for some segmented CT images.<br>For
 each segmented image, we have got four differentiated regions: kidney 
(gray value 220), tumor (gray value 230), vessels (gray value 240), and 
spine (gray value 250). The left area has a gray value of 0.<br><br>When we do surface reconstruction for these segmented CT images, we want to get the following result:<br>each of the four regions (kidney, tumor, vesels and spine) is displayed with a different color given by lookuptake.<br>-----------------<br>Current problem:<br>However,
 it does not work using the following codes, that is, the selected 
colors in the lookuptable are not assigned to the four regions.<br><br><br>Here are the codes:<br><br>{<br>    vtkSmartPointer<vtkImageAppend > append = vtkSmartPointer<vtkImageAppend >::New();<br>//then I put images in append<br><br>//using vtkDiscreteMarchingCubes for reconstruction<br>    vtkSmartPointer<vtkDiscreteMarchingCubes> dmc = vtkSmartPointer<vtkDiscreteMarchingCubes>::New();<br>    dmc->SetInputConnection(append->GetOutputPort());        <br>    dmc->SetValue(0, 220);<br>    dmc->SetValue(1, 230);<br>    dmc->SetValue(2, 240);<br>    dmc->SetValue(3, 250);<br>    dmc->Update();<br><br>//optimization<br>    vtkSmartPointer<vtkDecimatePro> deci = vtkSmartPointer<vtkDecimatePro>::New(); //减少数据读取点,以牺牲数据量加速交互<br>    deci->SetTargetReduction(0.3);<br>    deci->SetInputConnection(dmc->GetOutputPort());<br>    vtkSmartPointer<vtkSmoothPolyDataFilter> smooth = vtkSmartPointer<vtkSmoothPolyDataFilter>::New();  //使图像更加光滑<br>    smooth->SetInputConnection(deci->GetOutputPort());<br>    smooth->SetNumberOfIterations(200);<br>    vtkSmartPointer<vtkPolyDataNormals> skinNormals = vtkSmartPointer<vtkPolyDataNormals>::New();  //求法线<br>    skinNormals->SetInputConnection(smooth->GetOutputPort());<br>    skinNormals->SetFeatureAngle(60.0);<br>    vtkSmartPointer<vtkStripper> stripper = vtkSmartPointer<vtkStripper>::New();   //将三角形连接起来<br>    stripper->SetInputConnection(skinNormals->GetOutputPort());<br><br>// Map the scalar values in the image to colors with a lookup table:<br>    vtkSmartPointer<vtkLookupTable> lookupTable = vtkSmartPointer<vtkLookupTable>::New();<br>    lookupTable->SetNumberOfTableValues(4);    <br>    lookupTable->SetTableValue(0, 0.8900, 0.8100, 0.3400, 1); // Banana<br>    lookupTable->SetTableValue(1, 1.0000, 0.3882, 0.2784, 1); // Tomato    <br>    lookupTable->SetTableValue(2, 0.7400, 0.9900, 0.7900, 1); // Mint<br>    lookupTable->SetTableValue(3, 0.2000, 0.6300, 0.7900, 1); // Peacock<br>    lookupTable->Build();<br><br>//define a new actor and vtkPolyDataMapper mapper<br>    vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();<br>    mapper->SetInputConnection(stripper->GetOutputPort());<br>    mapper->ScalarVisibilityOn();<br>    mapper->SetScalarRange(220, 250);<br>    mapper->SetScalarModeToUseCellData();<br>    mapper->SetLookupTable(lookupTable);<br>    vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();<br>    actor->SetMapper(mapper);<br><br>//add actor to a render and display the result<br>    m_StaticSurface1.GetvtkRenderer()->AddActor(actor);<br>    m_StaticSurface1.GetvtkRenderer()->ResetCamera();<br>}</div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span> 




</div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span></div></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>