Skip to main content

Interactive path tracing in 2D medical images

Project description

pt2d (Path Tracing in 2D images)

This repository is no longer being updated.

Description

An interactive GUI for path tracing and extraction in 2D images. The inteded use is for 2D medical images of Amphisbaena sutures, but we have found that it extends well into other domains aswell for path extraction in 2D images.

The user places a start and end point between which the program automatically finds a viable path. The user can place multiple new guide points to help fit the path to their liking. The smoothness of the path can be adjusted aswell. Advanced settings are available.

The points making up the final path can be exported to a .csv file.

General usage of the GUI

Installation

The program can be installed using pip:

pip install pt2d

Usage

To open the program type out pt2d in a terminal. The GUI looks the following:

General GUI layout

The functionality of the program extends to the following:

  • Main window:
    • Start/end point of the path
    • Add new points (left click)
    • Drag points (hold left click on point and drag)S
    • Drag image (hold left click and drag)
    • Remove points (right click on point)
    • Zoom (mouse wheel)
    • Export as .csv file
  • Advanced window:
    • Rainbow toggle (displays a color gradient showing the order of points)
    • Calibration of filter
      • Resize dot (mouse wheel on dot)
    • Line smoothing
    • Contrast
    • Displays contrasted blurred image
    • Displays cost image

Methodology

The project follows a simple methodology somewhat similar to that of the livewire segmentation technique.

  • Grayscaling: The image is converted to grayscale for simpler processing.
  • Contrasting: The contrast in the image is enhanced to improve visibility of the path.
  • Smoothing: Gaussian blurring is applied to improve generalization.
  • Edge detection: The Canny edge detector is applied to generate an image highlighting the edges in the original image.
  • Convolution: A disk-shaped kernel, with values increasing radially from the center to the circumference, is convolved with the image to create a new image highlighting the centers of the paths.
  • Cost image creation: A cost image is generated by first identifying the maximum intensity value of the convolved image, I_max. The cost at each pixel is then computed as (I_max - I(x,y))**4, where I(x,y) represents the intensity at pixel (x,y).
  • Graph construction: A graph is then constructed by connecting every pixel to it's 8 neighbouring pixels. The cost of going between two given pixels will simply be the average of the two pixel's values in the cost image.
  • Pathfinding: Djikstra's algorithm is then applied to find the cheapest path from the user placed start point to the user placed end point.

Known bugs & issues

  • Guide points need to be placed in order from start to finish along the path for the extracted path not to overlap incorrectly.
  • Dots don't currently scale with the image size, meaning the dots will appear small on large images.

Authors and acknowledgment

This project is developed by Aske T. Rove, Christian L. Bjerregaard & Mikkel W. Breinstrup under the supervision of Hans M. Kjer & Felipe D. Matos at DTU Compute.

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pt2d-0.1.2.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pt2d-0.1.2-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

Details for the file pt2d-0.1.2.tar.gz.

File metadata

  • Download URL: pt2d-0.1.2.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.4

File hashes

Hashes for pt2d-0.1.2.tar.gz
Algorithm Hash digest
SHA256 469875f1064960b4c8fa64d7bde87817e699536e46791344db9efdf2b0f8cbd9
MD5 1454087b1565bd73490139db0fcf313f
BLAKE2b-256 a21fdc3e06fe430826d062cffc26b7a46df0ea5337342c78a320e20bc9070c6a

See more details on using hashes here.

File details

Details for the file pt2d-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pt2d-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 22.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.4

File hashes

Hashes for pt2d-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2f06a62ab4ef5f4aa26c15b112e45483672cae11d1cc4ba95896fd7d66613273
MD5 03cba595a771f5fcb2b43ba5ff576543
BLAKE2b-256 d54a81686f7b3ad8f31a40125d4060635839b0542ef37385996810b289b11b0a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page