[vtkusers] Visualizing Mesh from ITK isosurface

Catherine Peloquin cepeloquin at gmail.com
Mon Jul 2 17:26:29 EDT 2007


I am getting unexpected results when I try to visualize the results of
an isosurface created with ITK in VTK.

I extracted an isosurface using the ITK BinaryMask3dMeshSource filter
then converted this filter to vtkPolyData using itkMeshTovtkPolyData
located in InsightApplications-3.2.0/DeformableModelSimplexMesh.
Finally, I visualized the PolyData in VTK using the following
function:
void vtkRender(){
 cout << "In vtkRender" << endl;
 vtkRenderer *aRenderer = vtkRenderer::New();
 vtkRenderWindow *renWin = vtkRenderWindow::New();

   renWin->AddRenderer(aRenderer);
 vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
   iren->SetRenderWindow(renWin);

 vtkPolyDataNormals *contourNormals = vtkPolyDataNormals::New();
   contourNormals->SetInput(m_PolyData);
   contourNormals->SetFeatureAngle(60.0);

 vtkPolyDataMapper *contourMapper = vtkPolyDataMapper::New();
   contourMapper->SetInput(contourNormals->GetOutput());
   contourMapper->ScalarVisibilityOff();

 vtkActor *contour = vtkActor::New();
   contour->SetMapper(contourMapper);
   contour->GetProperty()->SetColor(0.8, 0.4, 0.0);
   contour->GetProperty()->SetOpacity(0.5);

 vtkCamera *aCamera = vtkCamera::New();
   aCamera->SetViewUp (0, 0, -1);
   aCamera->SetPosition (0, 1, 0);
   aCamera->SetFocalPoint (0, 0, 0);
   aCamera->ComputeViewPlaneNormal();

 aRenderer->AddActor(contour);
 aRenderer->SetActiveCamera(aCamera);
 aRenderer->ResetCamera ();
 aCamera->Dolly(1.5);
 aRenderer->SetBackground(1,1,1);

 renWin->SetSize(640, 480);
 aRenderer->ResetCameraClippingRange();

 iren->Initialize();
 iren->Start();

 contourNormals->Delete();
 contourMapper->Delete();
 contour->Delete();
 aCamera->Delete();
 iren->Delete();
 renWin->Delete();
 aRenderer->Delete();
}

The results of the visualization were strange.  Rather than a surface,
the image looks like a sandstorm, with many points scattered around.

I am including a .jpg of the isosurface of an abdomen for an isovalue
of 380.  I have also tried 1000 and 500, but the value of the
isosurface makes little difference in the visualization results.

Does anyone have suggestions on what I can do to correct this?  I am
unsure whether this is an ITK issue or a VTK issue.

Thank you,
Catherine Peloquin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: abdomen.png
Type: image/png
Size: 4527 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070702/2de6196e/attachment.png>


More information about the vtkusers mailing list