[vtkusers] RectilinearGrid into vtkContourFilter

Alex Malyushytskyy alexmalvtk at gmail.com
Wed Aug 28 18:30:16 EDT 2013


Have you tried to display "smoothed" instead of "triangleCellNormals"?
Are you sure smoothed consists of polygons?
If for example it had only lines triangleCellNormals would have nothing in.

Alex



On Wed, Aug 28, 2013 at 12:45 PM, ThinkFlow <neto at caltech.edu> wrote:

> Hi,
>
> I am trying to render the polydata that results after passing in a
> vtkRectilinearGrid into vtkContourFilter. However, I keep getting a black
> screen. There were a few questions like mine that were already answered,
> but
> when I tried out those fixes, I still got a black screen. When I render the
> vtkRectilinearGrid data by itself without passing it through
> vtkContourFilter, it works.
>
>     vtkRectilinearGridReader *reader = vtkRectilinearGridReader::New();
>
>     reader->SetFileName(prefix_suffix);
>     reader->Update();
>
>     // Create a grid
>     vtkSmartPointer<vtkRectilinearGrid> grid = reader->GetOutput();
>
>     vtkContourFilter* contour = vtkContourFilter::New();
>
>     contour->SetInput(grid);
>
>     contour->SetNumberOfContours(3);
>
>     contour->ComputeNormalsOn();
>
>     contour->Update();
>
>     vtkPolyData *smoothed_polys = contour->GetOutput();
>
>     // calc cell normal
>     vtkPolyDataNormals *triangleCellNormals= vtkPolyDataNormals::New();
>
>     #if VTK_MAJOR_VERSION <= 5
>         triangleCellNormals->SetInput(smoothed_polys);
>     #else
>         triangleCellNormals->SetInputData(smoothed_polys);
>     #endif
>
>     triangleCellNormals->ComputeCellNormalsOn();
>     triangleCellNormals->ComputePointNormalsOff();
>     triangleCellNormals->ConsistencyOn();
>     triangleCellNormals->AutoOrientNormalsOn();
>     triangleCellNormals->Update(); // creates vtkPolyData
>
>     vtkPolyDataMapper* contourMapper = vtkPolyDataMapper::New();
>     contourMapper->SetInput(triangleCellNormals->GetOutput());
>
>      vtkActor* contourActor = vtkActor::New();
>      contourActor->SetMapper(contourMapper);
>
>     // Create a renderer, render window, and interactor
>     vtkRenderer* renderer = vtkRenderer::New();
>     vtkRenderWindow *renderWindow = vtkRenderWindow::New();
>     vtkRenderWindowInteractor *renderWindowInteractor =
> vtkRenderWindowInteractor::New();
>
>     // Add the actors to the scene
>     renderWindow->AddRenderer(renderer);
>     renderWindowInteractor->SetRenderWindow(renderWindow);
>     renderer->AddActor(contourActor);
>
>     // Render and interact
>     renderWindow->Render();
>     renderWindowInteractor->Start();
>
> Thanks,
>
> Naoki
>
>
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/RectilinearGrid-into-vtkContourFilter-tp5723107.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> 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/20130828/d8f0339a/attachment.htm>


More information about the vtkusers mailing list