VTK Export¶
MicPy can export field data to the Visualization Toolkit (VTK) ImageData format (.vti). This allows you to easily visualize MICRESS results in tools like ParaView or process them further in Python using VTK-based libraries.
ParaView Plugin
MicPy also provides a dedicated ParaView plugin that enables direct loading of MICRESS binary files – no conversion required. See the ParaView plugin documentation for details.
Exporting a Field as VTK ImageData¶
A Field can be converted to a vtkImageData object using Field.as_vti(). You can choose how the data is represented:
- CellData: Each
Fieldvalue is mapped directly to a VTK cell. - PointData:
Fieldvalues are interpolated to VTK grid nodes.
PointData Interpolation
Conversion of field data to PointData maps values from cell centers to mesh vertices by aggregating contributions from adjacent cells. This operation increases the data resolution from \((n_x, n_y, n_z)\) to \((n_x + 1, n_y + 1, n_z + 1)\) and will introduce a smoothing effect. Nevertheless, the transformation may be useful for applying data filters that require point-associated data, such as isosurface extraction.
Saving to a .vti File¶
To write the result to disk, use the built-in Field.save_vti() convenience method:
Reference¶
micpy.bin.Field.as_vti(name='values', point_data=False) ¶
Convert the field to a VTK ImageData object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name | str | Name of the data array. Defaults to | 'values' |
point_data | bool |
| False |
Returns: VTK ImageData object.
micpy.bin.Field.save_vti(filename, name='values', point_data=False) ¶
Save the field as a VTK ImageData file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename | str | Filename of the VTK ImageData file. | required |
name | str | Name of the data array. Defaults to | 'values' |
point_data | bool |
| False |
Returns: Filename of the VTK ImageData file.