[vtkusers] vtkXMLPolyDataReader/Writer problem
Bill Lorensen
bill.lorensen at gmail.com
Thu Nov 7 08:28:49 EST 2013
What lookup table did you use to display the first image?
On Thu, Nov 7, 2013 at 4:19 AM, madz <madaramh at gmail.com> wrote:
> Hi,
> I'm trying to write a polydata file which looks like the following
> <http://vtk.1045678.n5.nabble.com/file/n5724345/write_file.png> ;
> The code I'm using is;
>
> std::string filename2 = "outputBPoly.vtp";
> // Write file
> vtkSmartPointer<vtkXMLPolyDataWriter> writer =
> vtkSmartPointer<vtkXMLPolyDataWriter>::New();
> writer2->SetFileName(filename2.c_str());
> #if VTK_MAJOR_VERSION <= 5
> writer->SetInput(polydata);
> #else
> writer->SetInputData(polydata);
> #endif
> writer->SetDataModeToAscii();
> writer->Write();
>
>
> And I'm reading the file from a different application.
> The code is;
>
> // Read all the data from the file
> vtkSmartPointer<vtkXMLPolyDataReader> reader =
> vtkSmartPointer<vtkXMLPolyDataReader>::New();
> reader->SetFileName(filename.c_str());
> reader->Update();
>
> // Visualize
> vtkSmartPointer<vtkPolyDataMapper> mapper =
> vtkSmartPointer<vtkPolyDataMapper>::New();
> mapper->SetInputConnection(reader->GetOutputPort());
>
> vtkSmartPointer<vtkActor> actor =
> vtkSmartPointer<vtkActor>::New();
> actor->SetMapper(mapper);
>
> vtkSmartPointer<vtkRenderer> renderer =
> vtkSmartPointer<vtkRenderer>::New();
> vtkSmartPointer<vtkRenderWindow> renderWindow =
> vtkSmartPointer<vtkRenderWindow>::New();
> renderWindow->AddRenderer(renderer);
> vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
> vtkSmartPointer<vtkRenderWindowInteractor>::New();
> renderWindowInteractor->SetRenderWindow(renderWindow);
>
> renderer->AddActor(actor);
> renderer->SetBackground(1, 1, 1);
>
> renderWindow->Render();
> renderWindowInteractor->Start();
>
> And the output looks like the following image.
> <http://vtk.1045678.n5.nabble.com/file/n5724345/read.png>
> My question is, what happened to the different colours in the original
> polydata. Why aren't they appearing in the new polydata. How do I remedy
> this?
>
> Thank you.
>
>
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/vtkXMLPolyDataReader-Writer-problem-tp5724345.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
--
Unpaid intern in BillsBasement at noware dot com
More information about the vtkusers
mailing list