[Paraview] How to save points from a cut
Dominik Szczerba
domi at vision.ee.ethz.ch
Wed Mar 1 07:09:44 EST 2006
I do it in C++, TCL would be similar
//==================================
#include <cassert>
#include "vtk/vtkCell.h"
#include "vtk/vtkCellData.h"
#include "vtk/vtkStructuredGrid.h"
#include "vtk/vtkStructuredGridWriter.h"
#include "vtk/vtkImageData.h"
#include "vtk/vtkStructuredPoints.h"
#include "vtk/vtkStructuredPointsReader.h"
#include "vtk/vtkStructuredPointsWriter.h"
int main(int argc, char *argv[]){
vtkStructuredPointsReader* reader = vtkStructuredPointsReader::New();
reader->SetFileName(argv[1]);
vtkStructuredPoints* grid = reader->GetOutput();
grid->Update();
vtkStructuredPointsWriter* writer = vtkStructuredPointsWriter::New();
writer->SetInput(grid);
writer->SetFileName(argv[2]);
writer->SetFileTypeToASCII();
//writer->SetFileTypeToBinary();
writer->Write();
reader->Delete();
writer->Delete();
return 0;
}
tchumat at astro.helsinki.fi wrote:
> Hello Dominik,
>
> Thanks for your reply!
> Can you also give me a hit on which TCP script to use? That would be great!
>
> Tchu
>
>> Save the file as legacy, but AFAIR this will give you a binary file. But
>> this you can already read yourself (will be big endian) - or use a
>> simple TCL script or C++ code to convert it to ASCII.
>> --ds
>>
>> tchumat at astro.helsinki.fi wrote:
>>
>>> Hello!
>>>
>>> This is probably a newbie question, but I simply do not find the answer
>>> myself.
>>> I am running paraview on linux, open a vtk file, the header of the file
>>> I am opening looks like that:
>>> ASCII DATASET POLYDATA POINTS 10818
>>> float
>>>
>>> What I would like to do, is to store the points and triangles after I
>>> have cut this object in to a file, which has plain text, as it was the
>>> case for the input file. The problem, I have is that I do not find the
>>> setting to change the encoding of the save-format to the format where
>>> the points are stored in ASCII text.
>>> Is this possible? What I get, if I store the results of the cut in a
>>> file I allways get the encoded data <AppendedData encoding="base64">,
>>> which I can not process further.
>>> I really tried all the formats like vtk, pvd, ply etc, but all of them
>>> store the data somehow encoded.
>>>
>>> Thanks very much!
>>>
>>> Tchu
>>>
>>>
>>>
>>>
>>>
>>> ----------------------------------------------------------------
>>> This message was sent using IMP, the Internet Messaging Program.
>>>
>>> _______________________________________________
>>> ParaView mailing list
>>> ParaView at paraview.org
>>> http://www.paraview.org/mailman/listinfo/paraview
>>
>>
>> --
>> Dominik Szczerba, Dr.
>> Computer Vision Lab CH-8092 Zurich
>> http://www.vision.ee.ethz.ch/~domi
>> _______________________________________________
>> ParaView mailing list
>> ParaView at paraview.org
>> http://www.paraview.org/mailman/listinfo/paraview
>>
>
>
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
--
Dominik Szczerba, Dr.
ETZ C110 CO-ME/BIWI CH-8092 Zurich
http://www.vision.ee.ethz.ch/~domi
More information about the ParaView
mailing list