[ITK] VTK Deplacement Field Format

Matt McCormick matt.mccormick at kitware.com
Fri Sep 12 14:44:50 EDT 2014


Hi James,

Yes, it looks like ITK's .vtk files writer is not following the
standard very well, and it is printing six values per line [1].

The binary version will not have any newlines.

Hope this helps,
Matt


[1] http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/IO/ImageBase/src/itkImageIOBase.cxx;h=ae10e65dee1ecff0579d9ba43db9118c4466eec7;hb=HEAD#l656

On Fri, Sep 12, 2014 at 2:05 PM, Armstrong, Hirotatsu
<HIROTATSU.ARMSTRONG at ucdenver.edu> wrote:
> Hello,
>
>
>
> I am having some trouble understanding the format of a .vtk file.  I am
> deformably registering 2 CT images and saving the displacement field in a
> .vtk file.  According to a pdf I found (for VTK v4.2), when written in ASCII
> format, vector data should have 3 values on each line corresponding to the
> x,y,z components for each vector.  When I write my .vtk file, I get this,
>
>
>
>
>
> # vtk DataFile Version 3.0
>
> VTK File Generated by Insight Segmentation and Registration Toolkit (ITK)
>
> ASCII
>
> DATASET STRUCTURED_POINTS
>
> DIMENSIONS 512 512 88
>
> SPACING 9.7656250000000000e-001 9.7656250000000000e-001
> 3.0000000000000000e+000
>
> ORIGIN -2.5000000000000000e+002 -1.0900000000000000e+002
> -1.5900000000000000e+002
>
> POINT_DATA 23068672
>
> VECTORS vectors float
>
> -0.0644559 -0.0859412 0 0.231144 -0.231144 0
>
> 0.242202 -0.201835 0 -0.211765 0 0
>
> 0.164835 -0.362637 0 0.159204 -0.437811 0
>
> 0.108108 -0.0405405 0 0.395062 -0.0493827 0
>
> -0.0987654 0.00493827 0 0.447702 -0.127915 0
>
> -0.167866 0.167866 0 -0.359551 -0.134831 0
>
> .
>
> .
>
> .
>
>
>
>
>
> Which is giving 6 values on each line.  I looked for some documentation but
> couldn’t find anything other than the pdf.  Could someone please point me to
> the latest documentation for the .vtk file format?  Also, I originally wrote
> the files in binary format, but was having some issue with that as well,
> which is why I switched to ASCII so I can actually visualize the data.  The
> documentation is not clear if there are newline characters included or not
> when binary data is written.  I would assume not, but could this be
> clarified as well?
>
>
>
> Thanks
>
>
>
> James Armstrong, Ph.D.
>
> PostDoctoral Fellow, Physics
>
> Department of Radiation Oncology
>
> University of Colorado School of Medicine
>
> 1665 Aurora Ct, MS F706
>
> Aurora, CO 80045
>
> 720-848-0257
>
>
>
>
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/mailman/listinfo/community
>



More information about the Community mailing list