[vtkusers] clipDataSetScalars problems
chen zhao
dreamthinkinger at gmail.com
Wed Oct 17 05:33:30 EDT 2012
Hi,
I am very interested vtk.But a vtk problem bothering me for a long time.
My OS is centos6.3. vtk version 5.10,cmake version is 2.84,ccmake is 2.84.
I have built vtk source successfully and get a vtk.jar.
I have a vtk file(ASCII, UNSTRUCTURED_GRID),I want to cut a part of the
file.The vtk file's information is:
-------------------------------------------------------------------------------------------------
vtk DataFile Version 2.0
Result of a test
ASCII
DATASET UNSTRUCTURED_GRID
POINTS 2897304 float
...
CELLS 2720061 24480549
...
CELL_TYPES 2720061
...
CELL_DATA 2720061
SCALARS matnumber long
LOOKUP_TABLE default
...
POINT_DATA 2897304
SCALARS srr float
LOOKUP_TABLE default
...
SCALARS stt float
LOOKUP_TABLE default
...
SCALARS spp float
LOOKUP_TABLE default
...
SCALARS stp float
LOOKUP_TABLE default
...
SCALARS srp float
LOOKUP_TABLE default
...
SCALARS srt float
LOOKUP_TABLE default
...
VECTORS desplacement float
...
--------------------------------------------------------------------------------------------------
On the top,it is the vtk file data structure.
My source is following:
*# step 1: read file*
vtkUnstructuredGridReader reader = new vtkUnstructuredGridReader();
reader.SetFileName(fileName);
reader.Update();
vtkUnstructuredGrid output = reader.GetOutput();
*#step 2: create a clipper*
vtkClipDataSet clipper = new vtkClipDataSet();
vtkImplicitBoolean cut = new vtkImplicitBoolean();
cut.SetOperationTypeToIntersection();
/*
new vtkPlane (vtkPlane1,vtkPlane2,vtkPlane3)
*/
cut.AddFunction(vtkPlane1);
cut.AddFunction(vtkPlane2);
cut.AddFunction(vtkPlane3);
clipper.SetInput(output);
clipper.SetClipFunction(cut);
clipper.GenerateClipScalarsOn();
clipper.GenerateClippedOutputOn();
clipper.SetInsideOut(-1);
*#step 3:save clipper data*
vtkUnstructuredGridWriter writer = new vtkUnstructuredGridWriter();
String fileNameWriter = "cutter.vtk";
writer.SetFileName("/work/data/vtk/"+fileNameWriter);
writer.SetInput(clipper.GetOutput());
writer.SetFileTypeToASCII();
writer.Write();
Now I can get the cutter.vtk file,when I open the "cutter.vtk" file by
ParaView,I only find "Solid Color, cellNormals, matnumber,
ClipDataSetScalars displacement" scalars,but in orignal vtk file I
can find "Solid Color, cellNormals, displacement, matnumber, spp, srr, stt,
srp, srt, stp" scalars.So in cutter.vtk file,it added "ClipDataSetScalars"
scalars and removed "spp, stt, srr, srp, srt,
stp" 6 scalars.Why did cutter.vtk remove the 6 scalars and add
"ClipDataSetScalars"?
I want to keep the "spp, stt, srr, srp, srt, stp " scalars,but I don't know
how to do it. Is my source code wrong?
Please advice. The problem is very import for me.
Chen Zhao
*
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121017/6be9f3fc/attachment.htm>
More information about the vtkusers
mailing list