[vtkusers] How to use vtkDataObjectReader in C++

Jothybasu Selvaraj jothybasu at gmail.com
Thu Feb 9 08:34:31 EST 2012


I don't think ReadFieldData returns anything.

Instead you should be using do_reader->GetOutput()->GetFieldData(); (after
calling ReadFieldData())

I suggest you to instantiate the class like this

vtkSmartPointer<vtkDataObjectReader> do_reader =
 vtkSmartPointer<vtkDataObjectReader>::New();

Jothy



On Thu, Feb 9, 2012 at 1:26 PM, <ycollette.nospam at free.fr> wrote:

> I found the way to initialize the class in C++:
>
>  vtkFieldData * dataSet = NULL;
>   vtkDataObject * do_tmp = NULL;
>  vtkDataObjectReader * do_reader = vtkDataObjectReader::New(); // instead
> of new vtkDataObjectReader
>
>  do_reader->ReadAllFieldsOn();
>  do_reader->SetFileName(Filename);
>  do_tmp = do_reader->GetOutput();
>  dataSet = do_reader->ReadFieldData();
>
> Now, I've got a problem: this simple program hangs when I call dataSet =
> do_reader->ReadFieldData();
>
> YC
>
> ----- Mail original -----
> De: "ycollette nospam" <ycollette.nospam at free.fr>
> À: vtkusers at vtk.org
> Envoyé: Jeudi 9 Février 2012 14:04:27
> Objet: [vtkusers] How to use vtkDataObjectReader in C++
>
> Hello,
>
> 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).
> Here is the peice of code:
>
>  vtkFieldData * dataSet = NULL;
>  vtkDataObjectReader * do_reader = new vtkDataObjectReader;
>
>  do_reader->ReadAllFieldsOn();
>  do_reader->SetFileName(Filename);
>  dataSet = do_reader->ReadFieldData();
>
>
> My question is: how to use vtkDataObjectReader in C++ ?
>
> Best regards,
>
> YC
> _______________________________________________
> 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
> _______________________________________________
> 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
>



-- 
Jothy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120209/fbb063a8/attachment.htm>


More information about the vtkusers mailing list