[vtkusers] Marching cubes

lydia many vtklydia at hotmail.com
Tue Nov 27 08:19:54 EST 2001


Hello
I'm using the marching cubes for reconstruction from a set of slices,but I 
always have a hole for the first slice. I tried many times but it dosen't 
work. Did any one had the same problem
This the code I use
I think this is due to the gaussian filter but I need your opinion.

	reader->SetFilePrefix("D:/surface");
	reader->SetDataExtent(0,511,0,511,1,15);
	reader->SetDataVOI(0,511,0,511,1,15);
	reader->SetDataSpacing(0.9375,0.9375,1.0);
	float origin2_x= ((512/2)*0.9375*(-1));
	float origin2_y=((512/2)*0.9375*(-1));
	reader->SetDataOrigin(origin2_x, origin2_y,0);
	reader->SetFilePattern("%s.%d");
	reader->SetDataByteOrderToBigEndian();
	reader->SetDataScalarTypeToUnsignedShort();


	int decimate_iterations=5;int SMOOTH_ITERATIONS=0;int FEATURE_ANGLE=60;
int ISLAND_REPLACE=0, ISLAND_AREA=30, Tissue=0;

vtkImageIslandRemoval2D*islandRemover=vtkImageIslandRemoval2D::New();

	if (ISLAND_REPLACE >= 0)
	{
		islandRemover->SetAreaThreshold (ISLAND_AREA);
		islandRemover->SetIslandValue(ISLAND_REPLACE);
		islandRemover->SetReplaceValue(Tissue);
		islandRemover->SetInput((reader->GetOutput()));

	}


	 int sample_rate[3];
	 sample_rate[0]=1;
	 sample_rate[1]=1;
	 sample_rate[2]=1;

	 vtkImageShrink3D *shrinker=vtkImageShrink3D::New();
     shrinker->SetInput(islandRemover->GetOutput());
     shrinker->SetShrinkFactors(sample_rate);
     shrinker->AveragingOn();

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

	 vtkImageToStructuredPoints 
*toStructuredPoints=vtkImageToStructuredPoints::New();
	 toStructuredPoints->SetInput(reader->GetOutput());


vtkMarchingCubes *skinExtractor = vtkMarchingCubes::New();
	  skinExtractor->SetInput(toStructuredPoints->GetOutput());
      skinExtractor->SetValue(0, 255);
	  skinExtractor->ComputeScalarsOff();
      skinExtractor->ComputeGradientsOff();
	 if ((decimate_iterations != 0) || (SMOOTH_ITERATIONS  !=0))
		skinExtractor->ComputeNormalsOff();


_________________________________________________________________
Téléchargez MSN Explorer gratuitement à l'adresse 
http://explorer.msn.fr/intl.asp




More information about the vtkusers mailing list