[vtkusers] 3D of human organs

Ahmed Mahmoud ahmedmm at gega.net
Mon Aug 13 18:52:21 EDT 2001


Hello all ,
I have 2D CT images , I made a 3d of the human colon with VTK , The 3D looks
fine .
My problem is when I move the camera inside the colon . I saw the triangles
strips very obviously
Is there a way to smooth these triangles .
Please , If any one worked with this problem . Give me an advise.
Thank you .

this my code to make a 3D file
/////////////////////////////
 vtkPNMReader *reader=vtkPNMReader::New();
  reader->GetOutput()-> GlobalReleaseDataFlagOn();

 vtkImageShrink3D *shrinker=vtkImageShrink3D::New();
  shrinker->SetInput (reader->GetOutput());

 vtkImageGaussianSmooth *gaussian=vtkImageGaussianSmooth::New();
  gaussian->SetInput (shrinker->GetOutput());
  gaussian->SetDimensionality(3);

 vtkImageToStructuredPoints *toStructuredPoints
  toStructuredPoints ->SetInput(gaussian ->GetOutput());
  toStructuredPoints ->Update ();
  toStructuredPoints ->GetOutput()->ReleaseDataFlagOn();

 vtkMarchingCubes *mcubes=vtkMarchingCubes::New();
  mcubes->SetInput(toStructuredPoints->GetOutput());
  mcubes->ComputeScalarsOff();
  mcubes->ComputeGradientsOff();
  mcubes->ComputeNormalsOff();
  mcubes->SetValue(0,3);
  mcubes->GetOutput()->ReleaseDataFlagOn();

 vtkDecimate *decimator=vtkDecimate::New();
  decimator->SetInput(mcubes->GetOutput());
  decimator->SetInitialFeatureAngle(DECIMATE_ANGLE);
  decimator->SetMaximumIterations(DECIMATE_ITERATIONS);
  decimator->SetMaximumSubIterations(0);
  decimator->PreserveEdgesOn();
  decimator->SetMaximumError(1);
  decimator->SetTargetReduction (DECIMATE_REDUCTION);
  decimator->SetInitialError (DECIMATE_ERROR);
  decimator->SetErrorIncrement(DECIMATE_ERROR_INCREMENT);
  decimator->GetOutput()->ReleaseDataFlagOn();

 vtkSmoothPolyDataFilter *smoother=vtkSmoothPolyDataFilter::New();
  smoother->SetInput(decimator->GetOutput());
  smoother->SetNumberOfIterations(SMOOTH_ITERATIONS);
  smoother->SetRelaxationFactor (SMOOTH_FACTOR);
  smoother->SetFeatureAngle (SMOOTH_ANGLE);
  smoother->FeatureEdgeSmoothingOff();
  smoother->BoundarySmoothingOff();
  smoother->SetConvergence(0);
  smoother->GetOutput()->ReleaseDataFlagOn();

 vtkPolyDataNormals *normals=vtkPolyDataNormals::New();
  normals->SetInput(smoother->GetOutput());
  normals->SetFeatureAngle (FEATURE_ANGLE);
  normals->GetOutput()->ReleaseDataFlagOn();

 vtkStripper *stripper=vtkStripper::New();
     stripper->SetInput(normals->GetOutput());
  stripper->GetOutput()->ReleaseDataFlagOn();

 ahmedmm at gega.net





More information about the vtkusers mailing list