[vtkusers] Extracting component of vector field and exporting subset of arrays
peterm
madapeti at gmail.com
Tue Jul 24 09:52:23 EDT 2012
Thanks for the response,
The arrayCalculator seems to work using the mentioned modification, when I
export the volume to .vtk using the vtkDataSetWriter the result seems to be
fine.
However saving the selected components to MHD files just won't work! What I
would like to achieve is to save select scalar fields from a structured grid
to a set of MHD files, so that it can be further processed in an external
application. To create the MHD files I use vtkMetaImageWriter. In case I use
the arrayCalculator as the input for the vtkMetaImageWriter than the created
file seems to contain a defaultly selected scalar component. I have tried to
use multiple approaches to select the component I would actually like to
export:
- use vtkAssignAttribute to specify the component
- use passArrays to remove everything else, so that the exported component
is the one I would like
I have run into problems using either of the approaches:
- vtkAssignAttribute:
I used the filter in the following manner
assignAttribute.SetInputConnection(arrayCalculatorXYZ.GetOutputPort())
assignAttribute.Assign("U_x", "SCALARS", "POINT_DATA")
writer.SetInputConnection(assignAttribute.GetOutputPort()) #
vtkMetaImageWriter
The result is the following error message:
writer (MHD): vtkMetaImageWriter (0x2d234b0): Unknown scalar type
- passArrays
The setup is the following
passArrays = vtk.vtkPassArrays()
passArrays.SetInput(arrayCalculatorXYZ.GetOutput())
passArrays.AddArray(0, "U_x")
passArrays.UseFieldTypesOn()
passArrays.AddFieldType(0) # vtkDataObject::POINT
passArrays.AddFieldType(1) # vtkDataObject::CELL
In this case I get volumes with zero values (not exactly zero but very
small 10^-20 etc.)
The correctness of the output of the arrayCalculatorXYZ is tested using
saving to the VTK format
Remark: using passArrays with the export to VTK crashes Paraview when the
file contents are displayed
In case there is an alternative solution how to save scalar components of a
structured grid to MHD files, I would really like to hear about it.
Alternatively if anyone has a suggestion, it would be very much welcome.
Thanks a lot,
Peter
--
View this message in context: http://vtk.1045678.n5.nabble.com/Extracting-component-of-vector-field-and-exporting-subset-of-arrays-tp5714867p5714891.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list