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

Luis Ibanez luis.ibanez at kitware.com
Sat Apr 17 18:05:02 EDT 2010


Hi Sutrisno,

What do you want to save in that .vtk file ?

1)  A Surface  ?
2)  An image ?


If you want to save a surface, then you
must first extract an itkMesh out of the image.


If you want to save an image, then you
can simply use itkImageFileWriter
You just need to provide a filename with
the extension ".vtk".


      Regards,


            Luis


-------------------------------------------------------------
On Fri, Apr 16, 2010 at 10:40 PM, SUTRISNO SUTRISNO <sutrisno_link at yahoo.com
> wrote:

>
>
>
> Hi Luis,
>
> thanks for the explanation of reading *. vtk file.
>
> but the main problem is how to write vtk files from ITK process (especially
> DICOM as an input)
>
>
>    Regards,
>
>
>          Sutrisno
> ------------------------------
> *Dari:* Luis Ibanez <luis.ibanez at kitware.com>
> *Kepada:* SUTRISNO SUTRISNO <sutrisno_link at yahoo.com>
> *Cc:* itk milis itk <Insight-users at itk.org>
> *Terkirim:* Jum, 16 April, 2010 08:56:11
> *Judul:* Re: how to write *.vtk file
>
>
> 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
>>
>
> __________________________________________________
> Apakah Anda Yahoo!?
> Lelah menerima spam? Surat Yahoo! memiliki perlindungan terbaik terhadap
> spam
> http://id.mail.yahoo.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100417/7fd1c19c/attachment.htm>


More information about the Insight-users mailing list