<div dir="ltr">I don't think ReadFieldData returns anything.<br><br>Instead you should be using do_reader->GetOutput()->GetFieldData(); (after calling ReadFieldData())<br><br>I suggest you to instantiate the class like this<br>
<br>vtkSmartPointer<vtkDataObjectReader> do_reader =<br> vtkSmartPointer<vtkDataObjectReader>::New();<br><br>Jothy<br><br><br><br><div class="gmail_quote">On Thu, Feb 9, 2012 at 1:26 PM, <span dir="ltr"><<a href="mailto:ycollette.nospam@free.fr">ycollette.nospam@free.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I found the way to initialize the class in C++:<br>
<div class="im"><br>
vtkFieldData * dataSet = NULL;<br>
</div> vtkDataObject * do_tmp = NULL;<br>
vtkDataObjectReader * do_reader = vtkDataObjectReader::New(); // instead of new vtkDataObjectReader<br>
<br>
do_reader->ReadAllFieldsOn();<br>
do_reader->SetFileName(Filename);<br>
do_tmp = do_reader->GetOutput();<br>
dataSet = do_reader->ReadFieldData();<br>
<br>
Now, I've got a problem: this simple program hangs when I call dataSet = do_reader->ReadFieldData();<br>
<br>
YC<br>
<br>
----- Mail original -----<br>
De: "ycollette nospam" <<a href="mailto:ycollette.nospam@free.fr">ycollette.nospam@free.fr</a>><br>
Ā: <a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br>
Envoyé: Jeudi 9 Février 2012 14:04:27<br>
Objet: [vtkusers] How to use vtkDataObjectReader in C++<br>
<div><div></div><div class="h5"><br>
Hello,<br>
<br>
I tried to compile the following code under C++, but the compiler complains about not being able to access protected members (the contructor and the destructor).<br>
Here is the peice of code:<br>
<br>
vtkFieldData * dataSet = NULL;<br>
vtkDataObjectReader * do_reader = new vtkDataObjectReader;<br>
<br>
do_reader->ReadAllFieldsOn();<br>
do_reader->SetFileName(Filename);<br>
dataSet = do_reader->ReadFieldData();<br>
<br>
<br>
My question is: how to use vtkDataObjectReader in C++ ?<br>
<br>
Best regards,<br>
<br>
YC<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">Jothy<br></div><br>
</div>