-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from ZEISS/20240719-move-examples
Copied from examples/ to AppExamples/
- Loading branch information
Showing
105 changed files
with
7,362 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# DisplayImage | ||
|
||
This example demonstrates how to read a measurement image from a project and display it in PNG format using an image widget in a user defined script dialog. | ||
|
||
## Example | ||
|
||
![](images/dialog.png) | ||
|
||
## Preliminaries | ||
|
||
* For the sake of simplicity it is assumed that the measurement list from which the image is read has a fixed name ('Scan 1'). | ||
* You have to install [OpenCV python](https://pypi.org/project/opencv-python/) for the example to run. | ||
* The example code must be part of an add-on, so that this python wheel can be added to that add-on's environment. | ||
|
||
![](images/wheel1.png) | ||
|
||
![](images/wheel2.png) | ||
|
||
![](images/wheel3.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## DisplayImage | ||
|
||
This App is part of the [ZEISS INSPECT Python API App Examples](https://github.com/ZEISS/zeiss-inspect-app-examples/tree/main/AppExamples). | ||
|
||
See [App documentation](Documentation.md) for details. | ||
|
||
You can [download this App](https://software-store.zeiss.com/products/apps/DisplayImage) from the [ZEISS Quality Software Store](https://software-store.zeiss.com). | ||
|
||
The ZEISS INSPECT App develomment documentation can be found on [ZEISS IQS GitHub](https://zeissiqs.github.io/zeiss-inspect-addon-api/2025/index.html). |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"author": "Carl Zeiss GOM Metrology GmbH", | ||
"description": "Display measurement as a single image", | ||
"labels": [ | ||
], | ||
"licensing": { | ||
"licenses": [ | ||
], | ||
"product-codes": [ | ||
] | ||
}, | ||
"software-revision": "0000", | ||
"software-version": "ZEISS INSPECT 2025", | ||
"tags": [ | ||
"image-widget", "measurement" | ||
], | ||
"title": "Display Image", | ||
"uuid": "74edeeeb-126b-4033-814f-66272bc7ba1f", | ||
"version": "1.0.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"content": [ | ||
[ | ||
{ | ||
"columns": 3, | ||
"data": "AAAAAA==", | ||
"file_name": "", | ||
"height": 0, | ||
"keep_aspect": true, | ||
"keep_original_size": true, | ||
"name": "image", | ||
"rows": 1, | ||
"system_image": "system_message_warning", | ||
"tooltip": { | ||
"id": "", | ||
"text": "", | ||
"translatable": true | ||
}, | ||
"type": "image", | ||
"use_system_image": false, | ||
"width": 0 | ||
}, | ||
{ | ||
}, | ||
{ | ||
} | ||
] | ||
], | ||
"control": { | ||
"id": "Close" | ||
}, | ||
"embedding": "always_toplevel", | ||
"position": "automatic", | ||
"size": { | ||
"height": 88, | ||
"width": 134 | ||
}, | ||
"sizemode": "automatic", | ||
"style": "", | ||
"title": { | ||
"id": "", | ||
"text": "Text detection", | ||
"translatable": true | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
AppExamples/misc/DisplayImage/scripts/display_image.metainfo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"display_name": "display_image", | ||
"folded_blocks": [ | ||
], | ||
"icon": "", | ||
"iinspect_condition": "", | ||
"interactive": false, | ||
"main_menu_path": { | ||
"anchor": { | ||
"item": "", | ||
"submenu": [ | ||
], | ||
"type": "command" | ||
}, | ||
"script": "userscript.display_image", | ||
"submenu": [ | ||
] | ||
}, | ||
"multicreation_script": false, | ||
"script_check_type": "none", | ||
"script_element_type": "none", | ||
"show_in_iinspect": false, | ||
"show_in_menu": true, | ||
"uuid": "c269d2dc-b6c2-471d-ace9-c2d58d5fa767" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# display_image.py | ||
# | ||
# Display an optical measurement using the image widget | ||
# | ||
# Carl Zeiss GOM Metrology GmbH, 2024 | ||
# | ||
# This App is part of the ZEISS INSPECT Python API Examples: | ||
# https://zeissiqs.github.io/zeiss-inspect-addon-api/2025/python_examples/ | ||
# --- | ||
|
||
import gom | ||
import cv2 | ||
import numpy as np | ||
|
||
def get_image (): | ||
""" Read image from project """ | ||
|
||
# | ||
# It is assumed that the measurement series 'Scan 1' contains images | ||
# | ||
measurement = gom.app.project.measurement_series['Scan 1'].measurements[0] | ||
image = np.array (measurement.images['left camera'].data.rgb )[0] | ||
return cv2.cvtColor(image, cv2.COLOR_BGR2RGB) | ||
|
||
def image_to_png (image): | ||
""" Convert image to PNG """ | ||
|
||
_, data = cv2.imencode(".png", image) | ||
return data.tobytes() | ||
|
||
image = get_image () | ||
|
||
DIALOG=gom.script.sys.create_user_defined_dialog (file='dialog.gdlg') | ||
|
||
DIALOG.image.data = image_to_png (cv2.resize (image, (640, 480))) | ||
|
||
gom.script.sys.show_user_defined_dialog (dialog=DIALOG) |
26 changes: 26 additions & 0 deletions
26
AppExamples/misc/FileSelectionAndFiltering/doc/Documentation.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# FileSelectionAndFiltering | ||
|
||
File Selection and Filtering Examples | ||
|
||
Examples for selecting and filtering files in ZEISS INSPECT Python scripts. | ||
|
||
This App contains the following scripts: | ||
|
||
| File | Description | | ||
| ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | | ||
| [listdir_dialog.py](../scripts/listdir_dialog.py) | List files in a directory | | ||
| [listdir_categories.py](../scripts/listdir_categories.py) | List files in directory and print their category (file, folder or other) | | ||
| [listdir_ext.py](../scripts/listdir_ext.py) | List files iin directory and print their extension | | ||
| [walkdir_ext.py](../scripts/walkdir_ext.py) | Traverses a directory tree and splits each file path in filename, basename and extension | | ||
| [walkdir_import_scripts.py](../scripts/walkdir_import_scripts.py) | Traverses a directory tree and imports all Python scripts | | ||
| [walkdir_import_stl_pol.py](../scripts/walkdir_import_stl_pol.py) | Traverses a directory tree and and imports all `.pol` and `.stl` files | | ||
|
||
A detailed description can be found in the ZEISS Quality Tech Guide: [How Do I Select and Filter Files in Python Scripts](https://techguide.zeiss.com/en/zeiss-inspect-2023/article/how_to_select_and_filter_files_in_python_scripts.html). | ||
|
||
## See also | ||
|
||
* How-to: [Selecting a file or folder](https://zeissiqs.github.io/zeiss-inspect-addon-api/2025/howtos/python_api_introduction/file_selection_dialog.html) | ||
* [User defined dialogs — File widget](https://zeissiqs.github.io/zeiss-inspect-addon-api/2025/howtos/python_api_introduction/user_defined_dialogs.html#file-widget) | ||
* [User defined dialogs — File system browser widget](https://zeissiqs.github.io/zeiss-inspect-addon-api/main/howtos/python_api_introduction/user_defined_dialogs.html#file-system-browser-widget) | ||
* [Python3 documentation — os module — Files and direcories ](https://docs.python.org/3/library/os.html#files-and-directories) | ||
* [Python3 documentation — os.path module](https://docs.python.org/3/library/os.path.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## FileSelectionAndFiltering | ||
|
||
This App is part of the [ZEISS INSPECT Python API App Examples](https://github.com/ZEISS/zeiss-inspect-app-examples/tree/main/AppExamples). | ||
|
||
See [App documentation](Documentation.md) for details. | ||
|
||
You can [download this App](https://software-store.zeiss.com/products/apps/FileSelectionAndFiltering) from the [ZEISS Quality Software Store](https://software-store.zeiss.com). | ||
|
||
The ZEISS INSPECT App develomment documentation can be found on [ZEISS IQS GitHub](https://zeissiqs.github.io/zeiss-inspect-addon-api/2025/index.html). |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.