[vtk-developers] vtkTable related problem

Jeff Baumes jeff.baumes at kitware.com
Fri Nov 7 15:15:56 EST 2008


You are correct, vtkDelimitedTextReader currently creates a set of
vtkStringArrays as the columns of the table. Once the data is in that
format (string arrays), everything is valid. Data value validity only
exists in vtkVariant and vtkVariantArray. We could have decided to
read data into a collection of vtkVariantArrays instead, and the
validity information would still be present. The downside of this is
that vtkVariantArrays are new and generally "unknown" to other filters
and they tend to not be able to handle them, while vtkStringArrays
have been around a bit longer and play nicer in the pipeline, e.g. the
reader is often followed by vtkStringToNumeric (plus there is less
memory overhead). I could however see the merit in adding an option to
the reader telling it to create vtkVariantArrays instead of
vtkStringArrays so this information remains.

Jeff

On Fri, Nov 7, 2008 at 2:44 PM, John Biddiscombe <biddisco at cscs.ch> wrote:
> I'm guessing Tim or Brian is most likely to know the answer to this...
>
> I'm making use of vtkDelimitedTextReader to load a bunch of ascii data into
> a table.
> On some occasions, rows of data have fewer/missing entries, so vtkVariant
> values are generated and inserted into the table during the read process
> which are 'invalid'. As the data is being read, I can track the valid flag
> and see that it is preserved as '0'.
> When I get the output of the filter as a table object and fetch the rows,
> one by one, I iterate over the values and I find that the values are always
> valid. even when the rows were half empty in the ascii file. I was hoping to
> check the 'valid' state so that I could skip certain values and do something
> special with these rows, but instead, I see a vtkStringArray being created
> for each column - as I query the row data, the string array returns empty
> strings with the valid flag set to true for the empty cells.
>
> In short, I can test strings to see if they are empty, but I was hoping I
> could test the valid flag and tell the difference between an empty string
> and an actually absent value.
>
> Can this be done? It seems like the class is protecting itself by replacing
> invalid data, but at the expense of some potentially useful information
> specifically
>   vtkVariantArray *row = table->GetRow(i);
>   vtkVariant entry = row->GetValue(n);
> entry.isValid() is always true - even when it didn't exist.
>
> Is there another way of getting gthe row/column without the null string
> creation?
>
> thanks
>
> JB
>
> --
> John Biddiscombe,                            email:biddisco @ cscs.ch
> http://www.cscs.ch/
> CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07
> Via Cantonale, 6928 Manno, Switzerland      | Fax:  +41 (91) 610.82.82
>
>
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at vtk.org
> http://www.vtk.org/mailman/listinfo/vtk-developers
>



-- 
Jeff Baumes, Ph.D.
R&D Engineer, Kitware Inc.
(518) 371-3971 x132
jeff.baumes at kitware.com



More information about the vtk-developers mailing list