postResults module
Warning
The following description is partially AI generated, it might be incomplete or incorrect.
- postResults.get3DSlicesWithFields(mesh, field='field1', clim=[-10, 80], scaling='', plotter=None, normal=None, center=None, textLabel=True, scalarBar=True, cmap=None)[source]
Creates a 3D visualization of the mesh with a single slice along a specified normal axis, mapping a scalar field to the slice.
The function returns a plotter object for further customization or display.
Parameters:
- meshpyvista.PolyData
The mesh data to be visualized.
- fieldstr, optional
The name of the scalar field to display on the mesh slice. Defaults to ‘field1’.
- climlist, optional
Color limits for the scalar field. Defaults to [-10, 80].
- scalingstr, optional
A string for scaling information to be displayed as a label.
- plotterpyvista.Plotter, optional
An existing pyvista plotter instance. If None, a new one is created.
- normalstr, optional
The normal axis for slicing the mesh (‘x’, ‘y’, or ‘z’). Defaults to ‘z’.
- centertuple, optional
The center point for slicing. If None, the mesh center is used.
- textLabelbool, optional
Whether to add a text label indicating the field name and scaling. Defaults to True.
- scalarBarbool, optional
Whether to add a scalar bar to the plot. Defaults to True.
- cmapstr, optional
The colormap to use for the scalar field. Defaults to ‘jet’.
Returns:
- ppyvista.Plotter
The plotter object with the 3D mesh slice and field visualized.
- postResults.get3Dmesh(mesh, plotter=None)[source]
Creates a 3D visualization of the mesh with slices along the x, y, and z axes.
The function returns a plotter object for further customization or display.
Parameters:
- meshpyvista.PolyData
The mesh data to be visualized.
- plotterpyvista.Plotter, optional
An existing pyvista plotter instance. If None, a new one is created.
Returns:
- ppyvista.Plotter
The plotter object with the 3D mesh and slices visualized.
- postResults.get3DmeshWithFields(mesh, field='field1', clim=[-10, 80], scaling='', plotter=None, center=None, cmap=None)[source]
Creates a 3D visualization of the mesh with slices along the x, y, and z axes and maps a scalar field to the mesh.
The function returns a plotter object for further customization or display.
Parameters:
- meshpyvista.PolyData
The mesh data to be visualized.
- fieldstr, optional
The name of the scalar field to display on the mesh. Defaults to ‘field1’.
- climlist, optional
Color limits for the scalar field. Defaults to [-10, 80].
- scalingstr, optional
A string for scaling information to be displayed as a label.
- plotterpyvista.Plotter, optional
An existing pyvista plotter instance. If None, a new one is created.
- centertuple, optional
The center point for slicing. If None, the mesh center is used.
- cmapstr, optional
The colormap to use for the scalar field. Defaults to ‘jet’.
Returns:
- ppyvista.Plotter
The plotter object with the 3D mesh and field visualized.
- postResults.get3DmeshWithMaterials(mesh, plotter=None, addLegend=True)[source]
Creates a 3D visualization of the mesh with segmented material properties, applying different colors and opacities for each material.
The function returns a plotter object for further customization or display.
Parameters:
- meshpyvista.PolyData
The mesh data to be visualized.
- plotterpyvista.Plotter, optional
An existing pyvista plotter instance. If None, a new one is created.
- addLegendbool, optional
Whether to add a legend to the plot indicating the materials. Defaults to True.
Returns:
- ppyvista.Plotter
The plotter object with the 3D mesh and materials visualized.
- postResults.get3DslicesWithMaterials(mesh, plotter=None, normal=None, center=None, addBar=True)[source]
Creates a 3D visualization of the mesh with slices along the x, y, and z axes, showing segmented material properties.
The function returns a plotter object for further customization or display.
Parameters:
- meshpyvista.PolyData
The mesh data to be visualized.
- plotterpyvista.Plotter, optional
An existing pyvista plotter instance. If None, a new one is created.
- normalstr, optional
The normal axis for slicing the mesh. If None, slices are made along all three axes.
- centertuple, optional
The center point for slicing. If None, the mesh center is used.
- addBarbool, optional
Whether to add a scalar bar to the plot. Defaults to True.
Returns:
- ppyvista.Plotter
The plotter object with the 3D mesh slices and materials visualized.
- postResults.getSlicemeshWithMaterials(mesh, plotter=None, normal=None, center=None, addBar=False)[source]
Creates a 3D visualization of a single slice of the mesh with segmented material properties, applying different colors for each material.
The function returns a plotter object for further customization or display.
Parameters:
- meshpyvista.PolyData
The mesh data to be visualized.
- plotterpyvista.Plotter, optional
An existing pyvista plotter instance. If None, a new one is created.
- normalstr, optional
The normal axis for slicing the mesh (‘x’, ‘y’, or ‘z’). Defaults to ‘z’.
- centertuple, optional
The center point for slicing. If None, the mesh center is used.
- addBarbool, optional
Whether to add a scalar bar to the plot. Defaults to False.
Returns:
- ppyvista.Plotter
The plotter object with the 3D mesh slice and materials visualized.
- postResults.importClassicResults(self, ptName, step, customPath=None)[source]
Imports classic results for a given patient and step number.
This function is a wrapper around importResults, specifically designed to filter files with the “classic_” prefix.
Parameters:
- selfobject
The instance of the class calling this function.
- ptNamestr
The name of the patient.
- stepint
The step number in the process.
- customPathstr, optional
A custom path to the results directory.
Returns:
- dfpandas.DataFrame
The classic results data loaded into a DataFrame.
- postResults.importGrowthResults(self, ptName, step, customPath=None)[source]
Imports growth results for a given patient and step number.
This function is a wrapper around importResults, specifically designed to filter files with the “growth_” prefix.
Parameters:
- selfobject
The instance of the class calling this function.
- ptNamestr
The name of the patient.
- stepint
The step number in the process.
- customPathstr, optional
A custom path to the results directory.
Returns:
- dfpandas.DataFrame
The growth results data loaded into a DataFrame.
- postResults.importResults(self, ptName, step, customPath=None, myStr='')[source]
Imports results data from HDF5 files based on the patient name (ptName), step number (step), and an optional custom string filter (myStr).
This function searches for the appropriate file, reads the data from it, and returns it as a pandas DataFrame.
Parameters:
- selfobject
The instance of the class calling this function.
- ptNamestr
The name of the patient.
- stepint
The step number in the process.
- customPathstr, optional
A custom path to the results directory. If None, a default path is used.
- myStrstr, optional
A custom string to filter the files. Defaults to an empty string.
Returns:
- dfpandas.DataFrame
The data loaded from the HDF5 file into a DataFrame.
Raises:
- FileNotFoundError
If no file matching the criteria is found.
- postResults.pathForResults(self)[source]
Returns the path to the directory where results are stored.
If a custom path is provided (self.customPath), it returns that path. Otherwise, it returns a default path.
Parameters:
- selfobject
The instance of the class calling this function. It should have an attribute customPath.
Returns:
- resultsPathstr
The path to the results directory.
- postResults.readVariousFormats(base_file_name, dirResults)[source]
Reads data from various file formats (HDF5, Parquet, CSV) stored in a specified directory.
This function checks for the presence of HDF5 and Parquet files first. If neither is found, it falls back to reading a CSV file. The data is then returned as a pandas DataFrame.
Parameters:
- base_file_namestr
The base name of the file (without the extension).
- dirResultsstr
The directory where the files are located.
Returns:
- dfpandas.DataFrame
The data loaded into a DataFrame from the appropriate file format.
- postResults.saveMeshIsoView(mesh, path)[source]
Saves a screenshot of the 3D mesh in an isometric view.
This function visualizes the mesh without any additional slices or field data, and saves the resulting view as an image.
Parameters:
- meshpyvista.PolyData
The mesh data to be visualized.
- pathstr
The path where the screenshot will be saved.
Returns:
None
- postResults.saveMeshIsoViewWithMaterialSlice(mesh, path)[source]
Saves a screenshot of the 3D mesh in an isometric view with material slices.
This function creates slices along the x, y, and z axes, visualizes the segmented material properties, and saves the resulting view as an image.
Parameters:
- meshpyvista.PolyData
The mesh data to be sliced and visualized.
- pathstr
The path where the screenshot will be saved.
Returns:
None
- postResults.saveSlice(mesh, normal, posRatio, path, clim=[-10, 80])[source]
Saves screenshots of a slice of the mesh with field data and material properties.
This function creates a slice along a specified axis at a given position, visualizes the field data, and saves it as an image. It also visualizes segmented materials and saves another image.
Parameters:
- meshpyvista.PolyData
The mesh data to be sliced and visualized.
- normalstr
The axis normal to the slice (‘x’, ‘y’, or ‘z’).
- posRatiofloat
The position ratio along the normal axis where the slice is made (0 to 100).
- pathstr
The base path where the screenshots will be saved.
- climlist, optional
Color limits for the scalar field. Defaults to [-10, 80].
Returns:
None
- postResults.show3Dmesh(mesh, plotter=None)[source]
Displays a 3D mesh using the pyvista library.
This function uses get3Dmesh to prepare the plot and then displays it.
Parameters:
- meshpyvista.PolyData
The mesh data to be visualized.
- plotterpyvista.Plotter, optional
An existing pyvista plotter instance. If None, a new one is created.
Returns:
None
- postResults.show3DmeshWithFields(mesh, field='field1', clim=[-10, 80], scaling='', plotter=None)[source]
Imports growth results for a given patient and step number.
This function is a wrapper around importResults, specifically designed to filter files with the “growth_” prefix.
Parameters:
- selfobject
The instance of the class calling this function.
- ptNamestr
The name of the patient.
- stepint
The step number in the process.
- customPathstr, optional
A custom path to the results directory.
Returns:
- dfpandas.DataFrame
The growth results data loaded into a DataFrame.
- postResults.show3DmeshWithMaterials(mesh, plotter=None)[source]
Displays a 3D mesh with segmented material properties visualized on it using the pyvista library.
This function uses get3DmeshWithMaterials to prepare the plot and then displays it.
Parameters:
- meshpyvista.PolyData
The mesh data to be visualized.
- plotterpyvista.Plotter, optional
An existing pyvista plotter instance. If None, a new one is created.
Returns:
None
- postResults.show3DslicesWithMaterials(mesh, plotter=None)[source]
Displays 3D slices of the mesh with segmented material properties visualized on them using the pyvista library.
This function uses get3DslicesWithMaterials to prepare the plot and then displays it.
Parameters:
- meshpyvista.PolyData
The mesh data to be visualized.
plotter : pyvista.Plotter