[vtkusers] vtkSmoothPolyDataFilter won't work

LinX camilo.jimenez at spymac.com
Sun Jun 12 12:47:45 EDT 2005


I created an helicodal image:

#define MPath(i,j,k) (\ 
(i-25+5*cos(k/20))*(i-25+5*cos(k/20))+\
(j-25+5*cos(k/20))*(j-25+5*cos(k/20))<100 \
? 0 : 100)  // Helix


/******************************************************
  int sx = 50, sy = 50, sz = 256;

  float hx = 1;
  float hy = 1;
  float hz = 1;

  Image->SetDimensions( sx, sy, sz );
  Image->SetSpacing   ( hx, hy, hz );
  Image->SetScalarTypeToUnsignedShort();
  Image->Update();

  unsigned short *lImageP = NULL;
  lImageP = (unsigned short*) Image->GetScalarPointer( );

  for( k=0; k<sz; k++ ){
    for( j=0; j<sy; j++ ){
      for( i=0; i<sx; i++ ){
        lImageP[index++] = MPath((double)i,(double)j,(double)k);
      }
    } 
  }
  Image->Update();
/******************************************************
 
I want a smooth polydata of the interface so I use vtkImageMarchingCubes. 

The problem now is that the vtkImageMarchingCubes's output is really coarse, so I
pass it throught a vtkSmoothPolyDataFilter:

/******************************************************
vtkImageMarchingCubes *lMCubes = vtkImageMarchingCubes::New();
lMCubes->SetInput( Image );
lMCubes->SetValue( 0,0 );
lMCubes->UpdateWholeExtent();
  
vtkSmoothPolyDataFilter  *lSmooth = vtkSmoothPolyDataFilter::New();
lSmooth->SetInput( lMCubes->GetOutput() );
lSmooth->SetNumberOfIterations(100);
lSmooth->SetConvergence(0);
lSmooth->UpdateWholeExtent();

vtkPolyDataMapper *lMapper = vtkPolyDataMapper::New();
lMapper->SetInput( lSmooth->GetOutput() );
/******************************************************

But nothing happens!!.

Then I tried passing it throught 10(ten) vtkPolyDataNormals changing the angles
an the output is as coarse as in the principle!!.

I really need to smooth the polyData a lot.


Any suggestion??.



LinX






More information about the vtkusers mailing list