[vtkusers] How to read in .vtk header file information?

Juergen Mueller Juergen.Mueller at caesar.de
Fri Aug 12 04:33:00 EDT 2005


Hello,



I searched this forum for the following question, but could not find a
similar question/answer:



I want to read in the header of a .vtk file (.vtk legacy file, containing
volume data, i.e. STRUCTURED_POINTS) rather than the whole file to get
information about the dimension, spacing, etc.



Currently my code looks like this:



            vtkStructuredPointsReader * reader =
vtkStructuredPointsReader::New();

            reader->SetFileName( strFileName );

            reader->UpdateInformation();

            vtkStructuredPoints * pVolume = vtkStructuredPoints::New();

            pVolume = reader->GetOutput();

            m_ptrWidget->textBrowser_headerData->insertParagraph("Volume
dimensions:", 0);

            m_ptrWidget->textBrowser_headerData->insertAt(QString("x=%1 y=%2
z=%3") \

                  .arg( pVolume->GetDimensions()[0] ) \

                  .arg( pVolume->GetDimensions()[1] ) \

                  .arg( pVolume->GetDimensions()[2] ), 0, 20);



But for very large files this takes too long, because I am only interested
in the header information, not in the volume data itself.



I have seen that there is a ReadHeader() method of the vtkDataReader class,
but I could not find any example how to use it exactly.



Does someone know how to get the header information from a .vtk file without
reading the whole file?



Regards,

Juergen Mueller

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050812/8367b47a/attachment.htm>


More information about the vtkusers mailing list