[vtkusers] How to know the type of a vtk file

Cory Quammen cory.quammen at kitware.com
Tue Aug 9 09:42:39 EDT 2016


You can use vtkDataSetReader::ReadOutputType() [1] to tell what type
of data set is in a .vtk file. This member function will return one of
VTK_POLY_DATA, VTK_STRUCTURED_POINTS, VTK_STRUCTURED_GRID,
VTK_RECTILINEAR_GRID, or VTK_UNSTRUCTURED_GRID if the data set can be
read. -1 indicates an error with the output type.

HTH,
Cory

[1] http://www.vtk.org/doc/nightly/html/classvtkDataSetReader.html#a88737685e39184afa34ccca53bb47dcb

On Tue, Aug 9, 2016 at 4:36 AM, maogui.hu <maogui.hu at gmail.com> wrote:
> Hi all,
> I'm a newer to VTK. I know that there are two VTK file formats to save
> objects, one is the legacy format, another is  XML-based file format. For
> the XML-based format, different data types have different file extensions.
> For example, .vti for vtkImageData, .vtp for vtkPolyData, .vts for
> vtkStructuredGrid. However, for the legacy format, there is only one file
> extension (.vtk). My question is there a quick function in VTK to know the
> exact data type of a .vtk file?
>
> Thanks,
>
> Maogui Hu
>
> _______________________________________________
> 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
R&D Engineer
Kitware, Inc.


More information about the vtkusers mailing list