{"id":19607189,"url":"https://github.com/robocorp/example-x-ray-image-processing","last_synced_at":"2025-10-21T06:57:06.017Z","repository":{"id":103903571,"uuid":"479403544","full_name":"robocorp/example-x-ray-image-processing","owner":"robocorp","description":"X-ray Image Viewer (NumPy, imageio, Matplotlib, SciPy)","archived":false,"fork":false,"pushed_at":"2023-05-30T10:17:38.000Z","size":4942,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":17,"default_branch":"main","last_synced_at":"2025-05-13T00:47:09.203Z","etag":null,"topics":["data-science","numpy","python","robotframework","xray-images"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robocorp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-08T13:34:45.000Z","updated_at":"2025-02-28T07:45:24.000Z","dependencies_parsed_at":"2023-07-19T05:31:58.614Z","dependency_job_id":null,"html_url":"https://github.com/robocorp/example-x-ray-image-processing","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robocorp%2Fexample-x-ray-image-processing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robocorp%2Fexample-x-ray-image-processing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robocorp%2Fexample-x-ray-image-processing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robocorp%2Fexample-x-ray-image-processing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robocorp","download_url":"https://codeload.github.com/robocorp/example-x-ray-image-processing/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253850874,"owners_count":21973671,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-science","numpy","python","robotframework","xray-images"],"created_at":"2024-11-11T10:09:11.937Z","updated_at":"2025-10-21T06:57:00.956Z","avatar_url":"https://github.com/robocorp.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# X-ray Image Viewer (NumPy, imageio, Matplotlib, SciPy)\n\n\u003cimg src=\"images/animation.gif\" style=\"margin-bottom:20px\"\u003e\n\n[Robocorp](https://robocorp.com/) is great for automation. It can also be used in data science!\n\nThe most tedious part of Python data science projects has to be setting up the Python environment and installing all the required dependencies. Not to mention keeping all that up-to-date. Or making the same setup work on another machine than yours!\n\nLet Robocorp handle the Python environment for you. Focus on data science - the stuff that matters.\n\nThis example application reads and processes X-ray images with [NumPy](https://numpy.org/), [imageio](https://imageio.readthedocs.io/), [Matplotlib](https://matplotlib.org/), and [SciPy](https://scipy.org/).\n\nThis application was inspired by the original [NumPy tutorial - X-ray image processing](https://numpy.org/numpy-tutorials/content/tutorial-x-ray-image-processing.html).\n\n\u003e This project uses a deprecated library [RPA.Dialogs](https://robocorp.com/docs/libraries/rpa-framework/rpa-dialogs) that has been replaced by [RPA.Assistant](https://robocorp.com/docs/libraries/rpa-framework/rpa-assistant). You can find an example detailing the new library [here](https://robocorp.com/portal/robot/robocorp/template-assistant).\n\n## Dependencies\n\n`conda.yaml`:\n\n```yaml\nchannels:\n  - conda-forge\n\ndependencies:\n  - python=3.10.4\n  - imageio=2.16.1\n  - matplotlib=3.5.1\n  - scipy=1.8.0\n  - pip=20.1\n  - pip:\n      - rpaframework-dialogs==2.0.0\n```\n\n## The X-ray image operation dialog\n\n```robot\n*** Settings ***\nDocumentation       View X-ray images.\n...                 Inspired by the original example at\n...                 https://numpy.org/numpy-tutorials/content/tutorial-x-ray-image-processing.html\n\nLibrary             RPA.Dialogs\nLibrary             xray.py\n\n\n*** Variables ***\n${OP_CANNY_FILTER}=             Canny filter\n${OP_GAUSSIAN_GRADIENT}=        Gaussian Gradient (edges)\n${OP_LAPLACIAN_GAUSSIAN}=       Laplacian Gaussian (edges)\n${OP_SOBEL_FELDMAN}=            Sobel-Feldman operator\n${OP_VIEW}=                     View\n\n\n*** Tasks ***\nView X-ray image\n    ${image_path}    ${operation}=    Select X-ray images and operation\n    IF    \"${operation}\" == \"${OP_VIEW}\"\n        Display Xray    ${image_path}\n    ELSE IF    \"${operation}\" == \"${OP_CANNY_FILTER}\"\n        Display Canny Filter    ${image_path}\n    ELSE IF    \"${operation}\" == \"${OP_GAUSSIAN_GRADIENT}\"\n        Display Gaussian Gradient    ${image_path}\n    ELSE IF    \"${operation}\" == \"${OP_LAPLACIAN_GAUSSIAN}\"\n        Display Laplacian Gaussian    ${image_path}\n    ELSE IF    \"${operation}\" == \"${OP_SOBEL_FELDMAN}\"\n        Display Sobel Feldman    ${image_path}\n    END\n\n\n*** Keywords ***\nSelect X-ray images and operation\n    Add file input\n    ...    name=xray_image\n    ...    source=%{ROBOT_ROOT}${/}x-ray-images\n    Add operation options\n    ${result}=    Run dialog    title=X-ray Image Viewer\n    RETURN    ${result.xray_image}[0]    ${result.operation}\n\nAdd operation options\n    ${options}=\n    ...    Create List\n    ...    ${OP_VIEW}\n    ...    ${OP_CANNY_FILTER}\n    ...    ${OP_GAUSSIAN_GRADIENT}\n    ...    ${OP_LAPLACIAN_GAUSSIAN}\n    ...    ${OP_SOBEL_FELDMAN}\n    Add Radio Buttons\n    ...    name=operation\n    ...    options=${options}\n    ...    default=${OP_VIEW}\n```\n\n## The X-ray processing library\n\n```py\n# Inspired by the original example at\n# https://numpy.org/numpy-tutorials/content/tutorial-x-ray-image-processing.html\n\nimport imageio\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom scipy import ndimage\n\ndef display_xray(image_path):\n    xray_image = imageio.imread(image_path)\n    plt.imshow(xray_image, cmap=\"gray\")\n    plt.axis(\"off\")\n    plt.show()\n\ndef display_canny_filter(image_path):\n    xray_image = imageio.imread(image_path)\n    fourier_gaussian = ndimage.fourier_gaussian(xray_image, sigma=0.05)\n    x_prewitt = ndimage.prewitt(fourier_gaussian, axis=0)\n    y_prewitt = ndimage.prewitt(fourier_gaussian, axis=1)\n    xray_image_canny = np.hypot(x_prewitt, y_prewitt)\n    xray_image_canny *= 255.0 / np.max(xray_image_canny)\n    print(\"The data type - \", xray_image_canny.dtype)\n    fig, axes = plt.subplots(nrows=1, ncols=4, figsize=(12, 4))\n    axes[0].set_title(\"Original\")\n    axes[0].imshow(xray_image, cmap=\"gray\")\n    axes[1].set_title(\"Canny (edges) - prism\")\n    axes[1].imshow(xray_image_canny, cmap=\"prism\")\n    axes[2].set_title(\"Canny (edges) - nipy_spectral\")\n    axes[2].imshow(xray_image_canny, cmap=\"nipy_spectral\")\n    axes[3].set_title(\"Canny (edges) - terrain\")\n    axes[3].imshow(xray_image_canny, cmap=\"terrain\")\n    for i in axes:\n        i.axis(\"off\")\n    plt.show()\n\ndef display_gaussian_gradient(image_path):\n    xray_image = imageio.imread(image_path)\n    x_ray_image_gaussian_gradient = ndimage.gaussian_gradient_magnitude(xray_image, sigma=2)\n    fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(10, 4))\n    axes[0].set_title(\"Original\")\n    axes[0].imshow(xray_image, cmap=\"gray\")\n    axes[1].set_title(\"Gaussian gradient (edges)\")\n    axes[1].imshow(x_ray_image_gaussian_gradient, cmap=\"gray\")\n    for i in axes:\n        i.axis(\"off\")\n    plt.show()\n\ndef display_laplacian_gaussian(image_path):\n    xray_image = imageio.imread(image_path)\n    xray_image_laplace_gaussian = ndimage.gaussian_laplace(xray_image, sigma=1)\n    fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(10, 4))\n    axes[0].set_title(\"Original\")\n    axes[0].imshow(xray_image, cmap=\"gray\")\n    axes[1].set_title(\"Laplacian-Gaussian (edges)\")\n    axes[1].imshow(xray_image_laplace_gaussian, cmap=\"gray\")\n    for i in axes:\n        i.axis(\"off\")\n    plt.show()\n\ndef display_sobel_feldman(image_path):\n    xray_image = imageio.imread(image_path)\n    x_sobel = ndimage.sobel(xray_image, axis=0)\n    y_sobel = ndimage.sobel(xray_image, axis=1)\n    xray_image_sobel = np.hypot(x_sobel, y_sobel)\n    xray_image_sobel *= 255.0 / np.max(xray_image_sobel)\n    print(\"The data type - before: \", xray_image_sobel.dtype)\n    xray_image_sobel = xray_image_sobel.astype(\"float32\")\n    print(\"The data type - after: \", xray_image_sobel.dtype)\n    fig, axes = plt.subplots(nrows=1, ncols=3, figsize=(10, 4))\n    axes[0].set_title(\"Original\")\n    axes[0].imshow(xray_image, cmap=\"gray\")\n    axes[1].set_title(\"Sobel (edges) - grayscale\")\n    axes[1].imshow(xray_image_sobel, cmap=\"gray\")\n    axes[2].set_title(\"Sobel (edges) - CMRmap\")\n    axes[2].imshow(xray_image_sobel, cmap=\"CMRmap\")\n    for i in axes:\n        i.axis(\"off\")\n    plt.show()\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobocorp%2Fexample-x-ray-image-processing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobocorp%2Fexample-x-ray-image-processing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobocorp%2Fexample-x-ray-image-processing/lists"}