| import os | |
| import sys | |
| # Add the topology directory to Python path | |
| sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../..')) | |
| from topologyScoring import pointCloudGeometryScore | |
| def evaluateDegeneratePoints(gtPointsFile : str, reconPointsFile : str, verbose : bool = False) -> int: | |
| """ | |
| Given two sets of tensor field degenerate points, return a similarity score from 0-10. | |
| A score of 0 is considered bad and a score of 10 is considered good. | |
| Args: | |
| gtPointsFile: The name of a file in legacy VTK format (.vtk) that stores the locations of each degenerate point | |
| in the ground truth data. It should also have a point array called "DegeneracyType". It should assign | |
| a value of 0 to each trisector and 1 for each wedge. | |
| reconPointsFile: The name of a file in legacy VTK format (.vtk) that stores the locations and degeneracy types | |
| of each point in the reconstructed data. | |
| verbose: Should error messages be printed if there are issues with the input files. | |
| """ | |
| return pointCloudGeometryScore(gtPointsFile, "DegeneracyType", reconPointsFile, "DegeneracyType", verbose) | |
| if __name__ == "__main__": | |
| if len(sys.argv) != 3: | |
| print(f"{os.path.basename(__file__)}: usage is 'python3 {os.path.basename(__file__)} ground_truth_file.vtk reconstructed_file.vtk'") | |
| exit(1) | |
| score = evaluateDegeneratePoints(sys.argv[1], sys.argv[2], verbose=True) | |
| print(f"These degenerate points scored: {score}") | |