[vtkusers] vtkTable GetValueByName
Luis Vieira
luis.vieira at vektore.com
Mon Nov 21 08:38:44 EST 2016
I will check up.
Thank you.
Luis Vieira
Consultant, Software Engineer
Vektore Exploration Consulting Corporation
ca.linkedin.com/in/joaoluisvieira
luis.vieira at vektore.com
www.vektore.com
-----Original Message-----
From: Cory Quammen [mailto:cory.quammen at kitware.com]
Sent: November 20, 2016 12:35 PM
To: Luis Vieira <luis.vieira at vektore.com>
Cc: VTK Users <vtkusers at vtk.org>
Subject: Re: [vtkusers] vtkTable GetValueByName
You can use vtkVariant.ToDouble() to access the value as a double.
http://www.vtk.org/doc/nightly/html/classvtkVariant.html#add5f17851c142a9b522532dc9b59800a
On Sun, Nov 20, 2016 at 12:16 PM, Luis Vieira <luis.vieira at vektore.com> wrote:
> Hello vtkusers,
>
>
>
> I am trying to get values of some columns in my vtkTable. Below, you
> could see my table and how I am setting the values. Works fine. Then,
> I want get some values by ColumnName (“ThistheColumn1”) instead of to
> inform row number and column number as well as vtk examples shows. I know of the existence of
> the function vtkVariant vtkTable::GetValueByName (vtkIdType const
> char * ). However, I don’t know how to apply in my particular
> case that is vtkDoubleArray and that I have to use this value as
> double and not as variant.
>
>
>
> tableLine = vtkSmartPointer<vtkTable>::New();
>
>
>
> vtkSmartPointer<vtkDoubleArray> ThistheColumn1 =
>
> vtkSmartPointer<vtkDoubleArray>::New();
>
> ThistheColumn1 ->SetName("ThistheColumn1");
>
> tableLine->AddColumn(ThistheColumn1);
>
>
>
> vtkSmartPointer<vtkDoubleArray> ThistheColumn2 =
>
> vtkSmartPointer<vtkDoubleArray>::New();
>
> ThistheColumn2->SetName("ThistheColumn2");
>
> tableLine->AddColumn(ThistheColumn2);
>
>
>
> for (unsigned int r = 0; r < numberRowsLine; r++)
>
> {
>
>
>
> for (unsigned int c = 0; c <
> modelLine->columnCount(); c++)
>
> {
>
> QString sh = modelLine->item(r,
> c)->data(Qt::DisplayRole).toString();// .toString();
>
> tableLine->SetValue(r, c,
> sh.toLatin1().constData());
>
>
>
> }
>
> }
>
>
>
> vtkDocumentation to get values
>
>
>
> vtkVariant v = table->GetValue( r,c);
>
> std::cout << "(r,c) = (" << r << "," << c << ") = " << v <<
> std::endl;
>
>
>
> Thank you very much for any help.
>
>
>
> Luis Vieira,
>
> Consultant, Software Engineer
>
> Vektore Exploration Consulting Corporation
>
> ca.linkedin.com/in/joaoluisvieira
>
> luis.vieira at vektore.com
>
> www.vektore.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
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
--
Cory Quammen
Staff R&D Engineer
Kitware, Inc.
More information about the vtkusers
mailing list