[vtkusers] vtkContourFilters

Michael Knopke Michael.Knopke at gmx.de
Fri Feb 2 04:35:26 EST 2007


Hi,
If you have your data already, this shouldn't be hard. 
Just build vtkImageData from it and feed it to the filter:


 vtkImageData *imageData = vtkImageData::New();

      imageData->SetScalarTypeToUnsignedChar();
      imageData->SetSpacing(3.2, 3.2, 20); // use correct spacing here
      imageData->SetOrigin(0.,0.,0.); //
      imageData->SetNumberOfScalarComponents(1); //depends on your data
      imageData->SetDimensions(512,512,58); set correct dimension
      imageData->AllocateScalars();

      unsigned char *ptrData = (unsigned char*)imageData->GetScalarPointer();

  for (int x=0; x<512; x++)
        for (int y=0; y<512; y++)
                for (int z=0; z<58; z++)
                {
                 *ptrData++ = x+y+z; // fill in the array here
                }

Then just connect this to your ContourFilter->SetInput(imageData);
This should work.

Michael
-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer



More information about the vtkusers mailing list