paraview_interface module#
This module is now deprecated. Please use pyvista instead.
This module provides the paraview interface from homcloud.interface module.
The basic model of this module is “pipeline” model. A data object is
filtered by the chain of pipeline nodes, and the result is shown.
The objects of PipelineNode
correspond the node of the pipeline,
and you can adjust visualization by these objects.
You can use many methods of PipelineNode
to adjust the visualization,
and you can construct a new pipeline node by the following methods:
Todo:
Add clip_box method
- class homcloud.paraview_interface.BaseDrawer(n_colors, column_spec)[source]#
Bases:
object
This class represents the generator of a VTK file.
- Parameters:
n_colors (int) – The number of colors
column_spec (dict[str, float or None]) – The pairs of the names of the columns and default values.
- class homcloud.paraview_interface.CubeDrawer(n_colors, dims, column_names)[source]#
Bases:
BaseDrawer
,BaseCellDrawer
- class homcloud.paraview_interface.LinesDrawer(n_colors, column_names)[source]#
Bases:
BaseDrawer
- class homcloud.paraview_interface.PipelineNode(parent=None)[source]#
Bases:
object
This class represents elements in a pipeline in ParaView.
This class is the base class for paraview interface classes. You should not create an instance of this class directly.
- clip_sphere(center, radius, inside_out=True)[source]#
Create a new pipeline node to clip the object with a sphere shape.
- Parameters:
center (tuple[float, float, float]) – The center of the clipping sphere
radius (float) – The radius of the clipping sphere
inside_out (bool) – If True, only the elements in the shpere are shown. If False, only the elements outside of the sphere is shown.
- Returns:
A new PipelineNode object for sphere clipping.
- Return type:
- color_by(field, range=None)[source]#
Set the coloring by field name.
- Parameters:
field (string or int) – The name of the field.
range (tuple[float, float] or None) – The upper and lower bounds of the colorbar. If None, the minimal and maximal values of the field are used.
- Returns:
self
- set_color(color)[source]#
Set the color.
- Parameters:
color (tuple[float, float, float]) – The RGB values (0.0 to 1.0)
- Returns:
self
- set_linewidth(width)[source]#
Set the linewidth.
- Parameters:
width (float) – The width of the lines
- Returns:
self
- set_opacity(opacity)[source]#
Set the opacity.
0.0 - completely transparent
1.0 - completely opaque
- Parameters:
opacity (float) – The opacity.
- Returns:
self
- set_pointsize(size)[source]#
Set the pointsize.
- Parameters:
pointsize (float) – The size of the points
- Returns:
self
- threshold(field, range)[source]#
Create a new pipeline node for thresholding whose parent is self.
Only the elements whose field are in the range when the returned object is passed to
show()
.- Parameters:
field (string) – The name of the field which have the thresholded value.
range (tuple[float, float] or float) – The upper and lower bounds of the values. If an float number is given, the threshold is (range, range).
- Returns:
A new PipelineNode object for thresholding.
- Return type:
- class homcloud.paraview_interface.PointCloud(path, dim=3, delimiters=' ', gui_name=None, file=None)[source]#
Bases:
PipelineNode
This class represents a pointcloud data source in paraview.
- Parameters:
path (string) – The filepath of the pointcloud.
dim (int) – The dimension of the space in which the pointcloud lives.
delimiter (string) – The delimiter of elements in a pointcloud file. If you want to show a CSV file, please specify “,”.
gui_name (string or None) – The name shown in Pipeline Browser in paraview’s GUI.
Notes
This is constructed by CSVReader and TableToPoints.
- static from_array(array, dim=3, gui_name=None)[source]#
Construct a pipeline node for pointcloud from an ndarray object.
- Parameters:
array (nupmy.ndarray) – The pointcloud data.
dim (int) – The dimension of the space in which the pointcloud lives.
gui_name (string) – The name shown in Pipeline Browser in paraview’s GUI.
- Returns:
A pipeline node object.
- Return type:
- homcloud.paraview_interface.PolyLine(array, gui_name=None)[source]#
Returns
PipelineNode
object representing a polyline.- Parameters:
array (numpy.ndarray) – An array of points.
gui_name (string or None) – The name shown in Pipeline Browser in paraview’s GUI.
- Returns:
A pipeline node object
- Return type:
- class homcloud.paraview_interface.PolyLineDrawer(n_colors, points, column_names)[source]#
Bases:
BaseDrawer
- class homcloud.paraview_interface.SimplexDrawer(n_colors, points, column_names)[source]#
Bases:
BaseDrawer
,BaseCellDrawer
- class homcloud.paraview_interface.SparseBitmapDrawer(n_colors, column_names)[source]#
Bases:
BaseDrawer
- class homcloud.paraview_interface.SparseCubeDrawer(n_colors, ndim, column_names)[source]#
Bases:
BaseDrawer
- class homcloud.paraview_interface.SphereClip(parent, center, radius, inside_out=True)[source]#
Bases:
PipelineNode
This class represents a pipeline node for sphere clipping.
You should construct the instance of this class by
PipelineNode.clip_sphere()
.
- class homcloud.paraview_interface.SurfaceDrawer(n_colors, surface, column_names)[source]#
Bases:
BaseDrawer
- class homcloud.paraview_interface.Threshold(parent, field, range)[source]#
Bases:
PipelineNode
This class represents a pipeline node for thresholding.
You should construct the instance of this class by
PipelineNode.threshold()
.
- class homcloud.paraview_interface.VTK(path, gui_name=None, file=None)[source]#
Bases:
PipelineNode
This class represents a VTK data source in paraview.
- homcloud.paraview_interface.VoxelData(array, gui_name=None, offsets=[0, 0, 0])[source]#
Returns
PipelineNode
object representing a voxel data.- Parameters:
array (numpy.ndarray) – An array.
gui_name (string or None) – The name shown in Pipeline Browser in paraview’s GUI.
- Returns:
A pipeline node object
- Return type:
- class homcloud.paraview_interface.XMLVTI(path, gui_name, file=None)[source]#
Bases:
PipelineNode
This class represents a VTI data source in XML format in paraview.
- homcloud.paraview_interface.show(sources, path=None, wait=True, bgcolor=None)[source]#
Shows sources by invoking paraview.
- Parameters:
sources (list of PipelineNode) – Pipeline nodes to be output.
path (string or None) – The output filename. If this parameter is None, a temporary filepath is generated and use it. If path is not None, the file remains after stopping paraview.
wait (bool) – If True, this function returns after paraview stops. If False, this function returns immediately after paraview is invoked by using backgroup process mechanism.
bgcolor (None or tuple[float, float, float]) – Background color.
- homcloud.paraview_interface.write_python_code(out, sources, bgcolor)[source]#
Write a python code generated by sources to out.
- Parameters:
out (io-like) – The output IO object.
sources (list of PipelineNode) – Pipeline nodes to be output.