get information about dataset labels
This commit is contained in:
parent
e8a4f06634
commit
f6de182eb6
|
@ -259,7 +259,7 @@ class Table:
|
|||
Table data from file.
|
||||
|
||||
"""
|
||||
f = open(fname) if isinstance(fname, (str, Path)) else fname
|
||||
f = open(Path(fname).expanduser()) if isinstance(fname, (str, Path)) else fname
|
||||
f.seek(0)
|
||||
|
||||
comments = []
|
||||
|
|
|
@ -60,12 +60,25 @@ class VTK:
|
|||
"""Number of points in vtkdata."""
|
||||
return self.vtk_data.GetNumberOfPoints()
|
||||
|
||||
|
||||
@property
|
||||
def N_cells(self) -> int:
|
||||
"""Number of cells in vtkdata."""
|
||||
return self.vtk_data.GetNumberOfCells()
|
||||
|
||||
@property
|
||||
def labels(self):
|
||||
"""Labels of datasets."""
|
||||
labels = {}
|
||||
|
||||
cell_data = self.vtk_data.GetCellData()
|
||||
if c := [cell_data.GetArrayName(a) for a in range(cell_data.GetNumberOfArrays())]:
|
||||
labels['Cell Data'] = c
|
||||
|
||||
point_data = self.vtk_data.GetPointData()
|
||||
if p := [point_data.GetArrayName(a) for a in range(point_data.GetNumberOfArrays())]:
|
||||
labels['Point Data'] = p
|
||||
|
||||
return labels
|
||||
|
||||
@staticmethod
|
||||
def from_image_data(cells: IntSequence,
|
||||
|
|
Loading…
Reference in New Issue