Skip to main content

pyRockImageLab

DOI PyPI version PyPI downloads License: AGPL-3.0-or-later

v0.1.0

pyRockImageLab (import pyrockimagelab) turns geological core photographs into clean, depth-labelled images. It crops each core section out of a photo of a whole core box, and it joins (stitches) close-up photos of one section into one long high-resolution image. A small browser app does the clicking; the package functions do the rest, also from notebooks with no windows.

Marked corners of a core section and the cropped, straightened section

Left: the four corners of one core section on a box photo. Right: the cropped, straightened section (2563–2566 ft, example data in example_data/ExampleCore).

Contact:

Larry Syu-Heng Lai (larrysyuhenglai@gmail.com)
The project was initiated when Larry was affiliated at the Quantitative Clastics Laboratory, Bureau of Economic Geology, The University of Texas at Austin

Installation

From PyPI:

pip install pyrockimagelab

From this repo:

conda env create -f environment.yml
conda activate pyrockimagelab
pip install -e .

No Qt or other GUI toolkit is needed; the app runs in your web browser.

Citation

Lai, L.S.-H. (2026) pyRockImageLab. Zenodo, https://doi.org/10.5281/zenodo.23656974

Key Features

  • Browser app pyrockimagelab-app with two tools: Crop core-box photo and Stitch close-up photos.
  • Crop each core section from a box photo by its four corners and straighten it (ortho_warp_quad).
  • Join close-up photos along one section into one high-resolution image (stitch_chain).
  • Every corner you mark is saved in _picks.json in the photo folder, so notebooks and the command line can re-create the same images without any clicking.
  • Command-line entry points: pyrockimagelab-app (the app) and pyrockimagelab (re-create images from saved corners).

The app

pyrockimagelab-app /path/to/CoreImages

This opens the app in your web browser (stop it with Quit, or Ctrl+C in the terminal). The start screen offers two tools:

  • Crop core-box photo — Open a photo of a whole core box, mark the corners of each core section, and save each section as its own straightened image labelled with depth.
  • Stitch close-up photos — Pick the close-up photos taken along one core section, trim each one, and join them into one long high-resolution image.

The app's start screen

Both tools start the same way: in Choose a folder, type the project folder (laid out as Project / Well name / start-end) and press Show photo folders. Every depth folder is listed with what is already done; click the one to work on.

Crop core-box photo

This tool cuts each core section out of a photo of a whole core box. Watch it once, then follow the steps below.

Demo: cropping core sections from a core-box photo

Sped-up demo. Click it to watch the 1080p video (about 40 seconds).

  1. Choose the box photo — click the photo of the whole core box, then press Use this photo.
  2. Mark core sections — set how many core sections the box holds, then click the four corners of each section (drag a corner to adjust). Type each section's length in feet; the depth and file name fill in automatically. Preview shows the straightened section.
  3. Saved images — press Save 3 section images (the number follows your sections). Each section is saved as {well}_{top}-{bottom}.png and .tif (300 dpi) in the well folder.

Stitch close-up photos

This tool joins several close-up photos of one core section into one long, sharp image. Watch it once, then follow the steps below.

Demo: joining close-up photos into one long image

Sped-up demo. Click it to watch the 1080p video (about 40 seconds).

  1. Choose close-up photos — pick a core section, click its close-up photos in order (top of the core first), then press Use these photos.
  2. Trim each photo — click the four corners of the core in each photo to cut away the background (or press Use whole photo), then Next: join the photos.
  3. Join the photos — Join photos matches overlapping features and joins the photos into one long image. If the result looks wrong, change the matching settings and join again.
  4. Straighten and save — adjust the four corners of the joined image and press Save image. It is saved as {well}_{top}-{bottom}_hr.png and .tif (600 dpi) in the well folder.

You can stop at any time; everything you saved stays on disk, and the app shows where you left off next time.

Example notebooks

pyRockImageLab_1_ExampleCore.ipynb runs end to end on the small example set in example_data/ExampleCore/ (one box photo, six close-up photos and saved corner picks, about 15 MB). It crops, stitches and orthorectifies the close-ups into a high-resolution mosaic of the 2563–2566 ft segment and writes PNGs to outputs/. The notebook only replays the saved corners; to mark your own, use the app (last cell).

Cropped close-up photos and the stitched high-resolution mosaic

The six cropped close-up photos that were stitched, numbered in stitching order (left), beside the stitched high-resolution mosaic of 2563–2566 ft (right).

pyRockImageLab_1_core_photo_processing.ipynb is the full workflow notebook for your own data.

That notebook sets the folder path, opens the app for marking corners, and then re-creates the images from the saved corners with the package functions (no pop-up windows). Put your own core photos outside this repo and pass that folder in.

Caller-supplied layout:

{core_images_dir}/{UWI}/{depth-range}/          # source photos + _picks.json
{core_images_dir}/{UWI}/{UWI}_{start}-{end}[_hr].png
import pyrockimagelab as pril

pril.process_folder(
    folder="/path/to/CoreImages/UWI/start-end",
    uwi="UWI",
)
pyrockimagelab --root /path/to/CoreImages --uwi UWI --folder start-end

Package structure

README.md
README-pypi.md
FUNCTION_DOCUMENTATION.md
pyproject.toml
setup.py
environment.yml
example_data/ExampleCore/        # anonymized example photos + _picks.json
figures/
pyRockImageLab_1_ExampleCore.ipynb
pyRockImageLab_1_core_photo_processing.ipynb
pyrockimagelab/
    common/
    image_processing/
    core_box/
    webapp/                      # browser app (pyrockimagelab-app)

Function list: FUNCTION_DOCUMENTATION.md.

Dependencies

Requires Python >=3.10.

Installed with the package: numpy (>=1.20), opencv-python (>=4.5), Pillow (>=8.3), matplotlib (>=3.5, for notebook figures), fastapi (>=0.100), uvicorn (>=0.23), pillow-heif (>=0.13, for HEIC photos).

Tests: pip install -r requirements-dev.txt && python -m pytest.

Metadata

Release files for pyrockimagelab 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyrockimagelab 0.1.1
File Size Uploaded Provenance Actions
pyrockimagelab-0.1.1.tar.gz 53.6 kB Without provenance Details for pyrockimagelab-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyrockimagelab 0.1.1
File Interpreter ABI Platform Actions
pyrockimagelab-0.1.1-py3-none-any.whl Python 3 none any Details for pyrockimagelab-0.1.1-py3-none-any.whl

Total release size: 110.8 kB

Release files / pyrockimagelab-0.1.1.tar.gz

Download URL pyrockimagelab-0.1.1.tar.gz
Size 53.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9e89d77ab4cfe53911ade2a85b7bf328101177e8578d452ca55140eb0bdfbcb2
BLAKE2b-256 checksum
How to use checksums
d3cd5ba03c2de052e5658e779cd8567135e061ec610b9918a83672c5f8ae05be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / pyrockimagelab-0.1.1-py3-none-any.whl

Download URL pyrockimagelab-0.1.1-py3-none-any.whl
Size 57.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
06d4dece6c692bc8029153fa80a6a44ce09a42f4e7f31041f0cfff7f305a7881
BLAKE2b-256 checksum
How to use checksums
58b57444257fc7a40c8eca4b56479cf2d1d5c95c1203de982aa2236d4f058130
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for pyrockimagelab 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page