[Insight-users] how to write *.vtk file

Luis Ibanez luis.ibanez at kitware.com
Thu Apr 15 21:56:11 EDT 2010


Hi Sutrisno,

This is an understandable confusion.

The .vtk extension of the legacy VTK file format
is used for both files that store images and files
that store polydata.

When you use the .vtk extension for the output
filename of any of the ITK image processing
examples, that resulting .vtk file will contain an
image, not a polydata.

That means that if you want to read it back with
VTK classes, you should use the vtkImageReader,
and not the vtkPolyDataReader.

In fact, you may want to use the vtkImageReader2:
http://www.vtk.org/doc/nightly/html/classvtkImageReader2.html


     Regards,


          Luis


------------------------------------------------------------------------
On Tue, Apr 13, 2010 at 6:09 AM, SUTRISNO SUTRISNO
<sutrisno_link at yahoo.com>wrote:

> Hi Luis,
>
> I tried to segmented DICOM files and save them in vtk format.
> I used  DicomSeriesReadImageWrite2.cxx, DeformableModel1.cxx,
> DeformableModel2.cxx  to build my program.
> the problem is  the result does not match what I expected.
> when I opened bone.vtk (result file) with file editor the content just like
> this:
>
> # vtk DataFile Version 3.0
> VTK File Generated by Insight Segmentation and Registration Toolkit (ITK)
> ASCII
> DATASET STRUCTURED_POINTS
> DIMENSIONS 124 124 45
> SPACING 1.0000000000000000e+00 1.0000000000000000e+00
> 1.0000000000000000e+00
> ORIGIN 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
> POINT_DATA 691920
> SCALARS scalars short 1
> LOOKUP_TABLE default
> 0 0 0 0 0 0
> 0 0 0 0 0 0
> 0 0 0 0 0 0
> 0 0 0 0 0 0
> 0 0 0 0 0 0
> 0 0 0 0 0 0
> ....
> and when I opened this file with vtk reader (PolyDataReader) there was
> error :
>
> ERROR: In /build/buildd/vtk-5.0.3/IO/vtkPolyDataReader.cxx, line 142
> vtkPolyDataReader (0x8765510): Cannot read dataset type: structured_points
>
>
> This is my source code list :
> /*=========================================================================
> Name : 3D Segmentation of Bone Structure on CT Image
> =========================================================================*/
> // Include the required header
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100415/6edac3f5/attachment.htm>


More information about the Insight-users mailing list