[vtkusers] Writing point cloud to .vtk using MATLAB

rakesh patil prakeshofficial at gmail.com
Thu Sep 15 00:15:13 EDT 2011


Dear Haluk,

As far as my knowledge is concerned, these scalars may be either depth
values, temperature, pressure etc defined at those point locations. That's
why it is called POINT_DATA. It can be also used to specify colors for
individual cells in which case, scalars will be assigned to CELL_DATA
instead of POINT_DATA.

Please see this example:

http://www.vtk.org/Wiki/VTK/Examples/Cxx/VTKConcepts/Scalars

Seniors correct me if I am wrong.

Thanks

Regards
Rakesh Patil

On Wed, Sep 14, 2011 at 10:29 PM, Haluk Noyan Tokgozoglu
<htokgoz1 at jhu.edu>wrote:

> Hi,
>
> What are those scalar values supposed to denote?
>
> Haluk Noyan Tokgozoglu
>
> Johns Hopkins University
> Computer Science PhD Student
> Computational Interaction and Robotics Library
> Secretary of the GRO
> Treasurer of UPE
>
>
>
> On Wed, Sep 14, 2011 at 12:21, rakesh patil <prakeshofficial at gmail.com>wrote:
>
>> Hi,
>>
>> As mentioned in the pdf file
>>
>>
>> http://www.vtk.org/VTK/img/file-formats.pdf
>>
>> There must be some scalar values for the POINT_DATA. Check for the example
>> on page number 8 in that file. Your code only writes the x,y,z points in the
>> file. Scalar values should follow after POINT_DATA.
>>
>> Hope that helps.
>>
>> Regards
>> Rakesh Patil
>>
>> On Wed, Sep 14, 2011 at 9:08 PM, Haluk Noyan Tokgozoglu <htokgoz1 at jhu.edu
>> > wrote:
>>
>>> Hi,
>>>
>>> I have point cloud data in the form of 3 vectors, x y z which are n-by-1
>>> and contain the 3 coordinates of the points. I am trying to swiftly generate
>>> a .vtk file in MATLAB so I can view it in Paraview, but I am having trouble
>>> understanding the documentation at
>>> http://www.vtk.org/VTK/img/file-formats.pdf
>>>
>>> I have written some code, where I write the points as an unstructred
>>> grid, but paraview doesn't show anything when I try to view the file.
>>>
>>> Here's my code:
>>>
>>> function [] = write_vtk(x,y,z)
>>>
>>>     n=size(x);
>>>     delete('data.vtk');
>>>     fid=fopen('data.vtk','w');
>>>     fprintf(fid,'# vtk DataFile Version 2.0\n');
>>>     fprintf(fid,'blah\n');
>>>     fprintf(fid,'ASCII\n');
>>>     fprintf(fid,'DATASET UNSTRUCTURED_GRID\n');
>>>     fprintf(fid,'POINTS %d float\n',n);
>>>     for i=1:n
>>>         fprintf(fid,'%f %f %f\n',x(i),y(i),z(i));
>>>     end
>>>     fprintf(fid,'POINT_DATA %d\n',n);
>>>     fclose(fid);
>>>
>>>
>>> end
>>>
>>> What am I doing wrong?
>>>
>>>
>>> Haluk Noyan Tokgozoglu
>>>
>>> Johns Hopkins University
>>> Computer Science PhD Student
>>> Computational Interaction and Robotics Library
>>> Secretary of the GRO
>>> Treasurer of UPE
>>>
>>>
>>>
>>> _______________________________________________
>>> 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
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110915/5f1732a5/attachment.htm>


More information about the vtkusers mailing list