Jump to content

Recommended Posts

hmm.. maybe try it with a super basic project, CAD / Scan / Colormap. 
run it in the script editor? --> paste errors (if any)
you can also run this script below to analyze the np.arrays. 
(just change the 'colormap' name to what you have in your project)
 

import gom
import numpy as np

# Access surface comparison inspection element
colormap = gom.app.project.inspection['Surface comparison 1']

# Extract NumPy arrays (preserve original dimensions)
coordinates = np.asarray(colormap.data.coordinate)
normals = np.asarray(colormap.data.normal)
scalar_values = np.asarray(colormap.data.scalar_value)
triangles = np.asarray(colormap.data.triangle)


# ---------------------------------------------------------
# ARRAY INSPECTION
# ---------------------------------------------------------

def inspect_array(name, array):

    print("\n" + "=" * 70)
    print("ARRAY:", name)
    print("=" * 70)

    print("Shape:       ", array.shape)
    print("Dimensions:  ", array.ndim)
    print("Data type:   ", array.dtype)
    print("Total values:", array.size)

    print("\nFIRST 5 ROWS")
    print(array[0, :5])


# Inspect arrays
inspect_array("COORDINATES", coordinates)
inspect_array("NORMALS", normals)
inspect_array("SCALAR VALUES", scalar_values)
inspect_array("TRIANGLES", triangles)


# ---------------------------------------------------------
# SCALAR VALUE STATISTICS
# ---------------------------------------------------------

print("\n" + "=" * 70)
print("SCALAR VALUE STATISTICS")
print("=" * 70)

for stage in range(scalar_values.shape[0]):

    values = scalar_values[stage].ravel()
    valid = np.isfinite(values)

    print("\nSTAGE:", stage)

    print("Total values:  ", values.size)
    print("Valid values:  ", np.count_nonzero(valid))
    print("Invalid values:", np.count_nonzero(~valid))

    if np.any(valid):

        print("Minimum:       ", np.min(values[valid]))
        print("Maximum:       ", np.max(values[valid]))
        print("Mean:          ", np.mean(values[valid]))
        print("Median:        ", np.median(values[valid]))
        print("Std Dev:       ", np.std(values[valid]))


# ---------------------------------------------------------
# MESH VALIDATION
# ---------------------------------------------------------

print("\n" + "=" * 70)
print("MESH VALIDATION")
print("=" * 70)

for stage in range(coordinates.shape[0]):

    vertex_count = coordinates.shape[1]
    triangle_count = triangles.shape[1]

    stage_triangles = triangles[stage]

    invalid_indices = np.count_nonzero(
        (stage_triangles < 0) |
        (stage_triangles >= vertex_count)
    )

    print("\nSTAGE:", stage)
    print("Vertex count:   ", vertex_count)
    print("Triangle count: ", triangle_count)
    print("Minimum index:  ", stage_triangles.min())
    print("Maximum index:  ", stage_triangles.max())
    print("Invalid indices:", invalid_indices)

    print("Coordinate/normal match:",
          coordinates[stage].shape == normals[stage].shape)

    print("Coordinate/scalar match:",
          coordinates[stage].shape[0] == scalar_values[stage].shape[0])


print("\nArray analysis complete.")

 

Link to comment
https://qualityforum.zeiss.com/topic/27762-colormap-viewer/#findComment-158038
Share on other sites

×
×
  • Create New...