| import sys |
| import os |
|
|
| |
| sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../..')) |
|
|
| from topologyScoring import pointCloudGeometryScore |
|
|
| def evaluateQmcpackCriticalPoints(gtFilename : str, reconFilename : str, verbose : bool = False): |
| """ |
| Given two sets of critical 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 critical point |
| in the ground truth data. It should also have a point array called "CriticalType". It should assign |
| values as follows: 0: minimum. 1: 1-saddle. 2: 2-saddle. 3: maximum. 4: degenerate critical point. |
| 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(gtFilename, "CriticalType", reconFilename, "CriticalType", verbose) |
|
|
| if __name__ == "__main__": |
|
|
| if len(sys.argv) != 3: |
| print(f"{os.path.basename(__file__)}: usage is 'python3 {os.path.basename(__file__)} gt_points.vtk recon_points.vtk'") |
| exit(1) |
|
|
| score = evaluateQmcpackCriticalPoints(sys.argv[1], sys.argv[2], verbose=True) |
|
|
| print(f"These critical points scored: {score}") |
|
|
|
|