[vtkusers] vtkContourFilter issue

Jérôme jerome.velut at gmail.com
Wed Dec 9 11:49:31 EST 2009


I saw that increments is (0, 0, 0). It should be something like (1, 11,
121), no? Maybe you missed to call SetNumberOfScalarComponents( ... ) ?

That's an (humble) idea...
Jerome

2009/12/9 David Doria <daviddoria+vtk at gmail.com <daviddoria%2Bvtk at gmail.com>
>

> I create an ImageData:
>
> vtkSmartPointer<vtkImageData> grid = vtkSmartPointer<vtkImageData>::New();
> grid->SetOrigin(xmin, ymin, zmin);
> grid->SetExtent(0, this->NumberOfCellsX-1, 0, this->NumberOfCellsY-1,
> 0, this->NumberOfCellsZ-1); //same as grid->SetDimensions(10, 10, 10);
> grid->SetSpacing((xmax-xmin)/static_cast<double>(this->NumberOfCellsX),
> (ymax-ymin)/static_cast<double>(this->NumberOfCellsY),
> (zmax-zmin)/static_cast<double>(this->NumberOfCellsZ));
>
> Then I set a value at each point:
>
>  for (int z = 0; z < dims[2]; z++)
>    {
>    for (int y = 0; y < dims[1]; y++)
>      {
>      for (int x = 0; x < dims[0]; x++)
>        {
>       //compute d ....
>        grid->SetScalarComponentFromDouble(x,y,z,0,d);
>        }
>      }
>    }
>
> Then I want to extract the 0 isosurface of this scalar field.
>
> I tried to do:
>
> vtkSmartPointer<vtkContourFilter> contourFilter =
>        vtkSmartPointer<vtkContourFilter>::New();
>
> contourFilter->SetInput(grid);
>
> vtkPolyData* surface = contourFilter->GetOutput();
>
> but the result has 0 points and 0 cells. Have I done something wrong
> with constructing the ImageData? Or using the ContourFilter?
>
> Thanks,
>
> David
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091209/b84486ba/attachment.htm>


More information about the vtkusers mailing list