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

This is the result:


======================================================================
ARRAY: COORDINATES
======================================================================
Shape:        (14, 1001483, 3)
Dimensions:   3
Data type:    float64
Total values: 42062286

FIRST 5 ROWS
[[-3.77004521 -2.5909069   5.63548731]
 [-3.75618393 -2.57819015  5.61667638]
 [-3.74682975 -2.60982676  5.63127428]
 [-3.74232265 -2.56547339  5.59786546]
 [-3.73137834 -2.58936804  5.60604099]]

======================================================================
ARRAY: NORMALS
======================================================================
Shape:        (14, 1001483, 3)
Dimensions:   3
Data type:    float64
Total values: 42062286

FIRST 5 ROWS
[[0.51937824 0.47984293 0.70710468]
 [0.51937836 0.47984299 0.70710462]
 [0.5193944  0.47983545 0.70709789]
 [0.51939189 0.47983265 0.7071017 ]
 [0.51940525 0.47982848 0.70709467]]

======================================================================
ARRAY: SCALAR VALUES
======================================================================
Shape:        (14, 1001483, 1)
Dimensions:   3
Data type:    float64
Total values: 14020762

FIRST 5 ROWS
[[0.17371252]
 [0.19341013]
 [0.18066262]
 [0.21199106]
 [0.20574836]]

======================================================================
ARRAY: TRIANGLES
======================================================================
Shape:        (14, 1728100, 3)
Dimensions:   3
Data type:    int32
Total values: 72580200

FIRST 5 ROWS
[[1 0 2]
 [2 3 1]
 [2 4 3]
 [3 4 5]
 [4 2 7]]

======================================================================
SCALAR VALUE STATISTICS
======================================================================

STAGE: 0
Total values:   1001483
Valid values:   817004
Invalid values: 184479
Minimum:        -0.9999836087226868
Maximum:        0.9999943971633911
Mean:           0.12506770972503356
Median:         0.007404788630083203
Std Dev:        0.33857524864327565

STAGE: 1
Total values:   1001483
Valid values:   810624
Invalid values: 190859
Minimum:        -0.9997458457946777
Maximum:        0.9999995827674866
Mean:           0.12545123292840807
Median:         0.005641367053613067
Std Dev:        0.33820176809525915

STAGE: 2
Total values:   1001483
Valid values:   806167
Invalid values: 195316
Minimum:        -0.9999976754188538
Maximum:        0.9999997615814209
Mean:           0.12822237201850964
Median:         0.008725213818252087
Std Dev:        0.33852532712616873

STAGE: 3
Total values:   1001483
Valid values:   799139
Invalid values: 202344
Minimum:        -0.9999946355819702
Maximum:        0.9999998211860657
Mean:           0.11647757265726937
Median:         0.00733939977362752
Std Dev:        0.3346622895754618

STAGE: 4
Total values:   1001483
Valid values:   806319
Invalid values: 195164
Minimum:        -0.999889612197876
Maximum:        0.9999955296516418
Mean:           0.12375207080038801
Median:         0.006627410184592009
Std Dev:        0.33557094342534866

STAGE: 5
Total values:   1001483
Valid values:   807133
Invalid values: 194350
Minimum:        -0.9999645948410034
Maximum:        0.9999971389770508
Mean:           0.12766216929258173
Median:         0.012189929373562336
Std Dev:        0.34083237602395183

STAGE: 6
Total values:   1001483
Valid values:   805712
Invalid values: 195771
Minimum:        -0.9999943375587463
Maximum:        0.9999861121177673
Mean:           0.1224781303949255
Median:         0.0034620233345776796
Std Dev:        0.34337158696471554

STAGE: 7
Total values:   1001483
Valid values:   810347
Invalid values: 191136
Minimum:        -0.9998605847358704
Maximum:        0.9999995827674866
Mean:           0.1223609867846869
Median:         0.003429613308981061
Std Dev:        0.34028559250643153

STAGE: 8
Total values:   1001483
Valid values:   799807
Invalid values: 201676
Minimum:        -0.9999169111251831
Maximum:        0.9999849796295166
Mean:           0.12175145579847788
Median:         0.009752480313181877
Std Dev:        0.3382057162990135

STAGE: 9
Total values:   1001483
Valid values:   804530
Invalid values: 196953
Minimum:        -0.9998884797096252
Maximum:        0.9999997019767761
Mean:           0.1309860663740092
Median:         0.00888607557862997
Std Dev:        0.33682884009253805

STAGE: 10
Total values:   1001483
Valid values:   811783
Invalid values: 189700
Minimum:        -0.9994982481002808
Maximum:        1.0
Mean:           0.12587793787982593
Median:         0.006889908574521542
Std Dev:        0.3386338362739185

STAGE: 11
Total values:   1001483
Valid values:   805351
Invalid values: 196132
Minimum:        -0.9999029636383057
Maximum:        0.9999940991401672
Mean:           0.12458094398355302
Median:         0.007014192175120115
Std Dev:        0.3372293614642635

STAGE: 12
Total values:   1001483
Valid values:   813666
Invalid values: 187817
Minimum:        -0.9999779462814331
Maximum:        0.9999937415122986
Mean:           0.12616119242940965
Median:         0.009973835200071335
Std Dev:        0.3362999554437092

STAGE: 13
Total values:   1001483
Valid values:   810213
Invalid values: 191270
Minimum:        -0.99960857629776
Maximum:        0.9999967217445374
Mean:           0.12320137626659115
Median:         0.008159889839589596
Std Dev:        0.3383606201434212

======================================================================
MESH VALIDATION
======================================================================

STAGE: 0
Vertex count:    1001483
Triangle count:  1728100
Minimum index:   0
Maximum index:   1001482
Invalid indices: 0
Coordinate/normal match: True
Coordinate/scalar match: True

STAGE: 1
Vertex count:    1001483
Triangle count:  1728100
Minimum index:   0
Maximum index:   1001482
Invalid indices: 0
Coordinate/normal match: True
Coordinate/scalar match: True

STAGE: 2
Vertex count:    1001483
Triangle count:  1728100
Minimum index:   0
Maximum index:   1001482
Invalid indices: 0
Coordinate/normal match: True
Coordinate/scalar match: True

STAGE: 3
Vertex count:    1001483
Triangle count:  1728100
Minimum index:   0
Maximum index:   1001482
Invalid indices: 0
Coordinate/normal match: True
Coordinate/scalar match: True

STAGE: 4
Vertex count:    1001483
Triangle count:  1728100
Minimum index:   0
Maximum index:   1001482
Invalid indices: 0
Coordinate/normal match: True
Coordinate/scalar match: True

STAGE: 5
Vertex count:    1001483
Triangle count:  1728100
Minimum index:   0
Maximum index:   1001482
Invalid indices: 0
Coordinate/normal match: True
Coordinate/scalar match: True

STAGE: 6
Vertex count:    1001483
Triangle count:  1728100
Minimum index:   0
Maximum index:   1001482
Invalid indices: 0
Coordinate/normal match: True
Coordinate/scalar match: True

STAGE: 7
Vertex count:    1001483
Triangle count:  1728100
Minimum index:   0
Maximum index:   1001482
Invalid indices: 0
Coordinate/normal match: True
Coordinate/scalar match: True

STAGE: 8
Vertex count:    1001483
Triangle count:  1728100
Minimum index:   0
Maximum index:   1001482
Invalid indices: 0
Coordinate/normal match: True
Coordinate/scalar match: True

STAGE: 9
Vertex count:    1001483
Triangle count:  1728100
Minimum index:   0
Maximum index:   1001482
Invalid indices: 0
Coordinate/normal match: True
Coordinate/scalar match: True

STAGE: 10
Vertex count:    1001483
Triangle count:  1728100
Minimum index:   0
Maximum index:   1001482
Invalid indices: 0
Coordinate/normal match: True
Coordinate/scalar match: True

STAGE: 11
Vertex count:    1001483
Triangle count:  1728100
Minimum index:   0
Maximum index:   1001482
Invalid indices: 0
Coordinate/normal match: True
Coordinate/scalar match: True

STAGE: 12
Vertex count:    1001483
Triangle count:  1728100
Minimum index:   0
Maximum index:   1001482
Invalid indices: 0
Coordinate/normal match: True
Coordinate/scalar match: True

STAGE: 13
Vertex count:    1001483
Triangle count:  1728100
Minimum index:   0
Maximum index:   1001482
Invalid indices: 0
Coordinate/normal match: True
Coordinate/scalar match: True

Array analysis complete.
 

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

Hey Marco, Glad you got it working! you should be able to click the number in the top RH corner and either use the mousewheel or change the value to whatever you want.  If you want to customize it beyond that, I Included a "Prompt_for_ai.md" - just download / extract the codebase from github, give Codex/Claude code access to that folder, copy the prompt and follow it up by "Id like to change the color legend to ........." give codex/claude some example pictures of what you're looking for. 
let us know how it goes!

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

×
×
  • Create New...