Table of Contents
Fetching ...

Histropy: A Computer Program for Quantifications of Histograms of 2D Gray-scale Images

Sagarika Menon, Peter Moeck

TL;DR

The computer program"Histropy" is an interactive Python program for the quantification of selected features of two-dimensional images/patterns using calculations based on the pixel intensities in this data, their histograms, and user-selected sections of those histograms.

Abstract

The computer program "Histropy" is an interactive Python program for the quantification of selected features of two-dimensional (2D) images/patterns (in either JPG/JPEG, PNG, GIF, BMP, or baseline TIF/TIFF formats) using calculations based on the pixel intensities in this data, their histograms, and user-selected sections of those histograms. The histograms of these images display pixel-intensity values along the x-axis (of a 2D Cartesian plot), with the frequency of each intensity value within the image represented along the y-axis. The images need to be of 8-bit or 16-bit information depth and can be of arbitrary size. Histropy generates an image's histogram surrounded by a graphical user interface that allows one to select any range of image-pixel intensity levels, i.e. sections along the histograms' x-axis, using either the computer mouse or numerical text entries. The program subsequently calculates the (so-called Monkey Model) Shannon entropy and root-mean-square contrast for the selected section and displays them as part of what we call a "histogram-workspace-plot." To support the visual identification of small peaks in the histograms, the user can switch between a linear and log-base-10 display scale for the y-axis of the histograms. Pixel intensity data from different images can be overlaid onto the same histogram-workspace-plot for visual comparisons. The visual outputs of the program can be saved as histogram-workspace-plots in the PNG format for future usage. The source code of the program and a brief user manual are published in the supporting materials as well as on GitHub. Instead of taking only 2D images as inputs, the program's functionality could be extended by a few lines of code to other potential uses employing data tables with one or two dimensions in the CSV format.

Histropy: A Computer Program for Quantifications of Histograms of 2D Gray-scale Images

TL;DR

The computer program"Histropy" is an interactive Python program for the quantification of selected features of two-dimensional images/patterns using calculations based on the pixel intensities in this data, their histograms, and user-selected sections of those histograms.

Abstract

The computer program "Histropy" is an interactive Python program for the quantification of selected features of two-dimensional (2D) images/patterns (in either JPG/JPEG, PNG, GIF, BMP, or baseline TIF/TIFF formats) using calculations based on the pixel intensities in this data, their histograms, and user-selected sections of those histograms. The histograms of these images display pixel-intensity values along the x-axis (of a 2D Cartesian plot), with the frequency of each intensity value within the image represented along the y-axis. The images need to be of 8-bit or 16-bit information depth and can be of arbitrary size. Histropy generates an image's histogram surrounded by a graphical user interface that allows one to select any range of image-pixel intensity levels, i.e. sections along the histograms' x-axis, using either the computer mouse or numerical text entries. The program subsequently calculates the (so-called Monkey Model) Shannon entropy and root-mean-square contrast for the selected section and displays them as part of what we call a "histogram-workspace-plot." To support the visual identification of small peaks in the histograms, the user can switch between a linear and log-base-10 display scale for the y-axis of the histograms. Pixel intensity data from different images can be overlaid onto the same histogram-workspace-plot for visual comparisons. The visual outputs of the program can be saved as histogram-workspace-plots in the PNG format for future usage. The source code of the program and a brief user manual are published in the supporting materials as well as on GitHub. Instead of taking only 2D images as inputs, the program's functionality could be extended by a few lines of code to other potential uses employing data tables with one or two dimensions in the CSV format.
Paper Structure (10 sections, 4 equations, 9 figures)

This paper contains 10 sections, 4 equations, 9 figures.

Figures (9)

  • Figure 1: A screenshot of the (initial) Histropy workspace after the user has selected the image displayed in the top right corner. Note that the histogram's title contains the file name of the selected image. Also note that the title of the image in the top right corner, "Image 1," has a font color corresponding to the color of the histogram. This particular histogram is from a 512 by 512 pixel cutout of the crystal pattern in the background of Figure A1a. (This figure is displayed in color in the online version of this paper.)
  • Figure 2: A close up of the scale selection space. The linear y-axis is currently selected and the y-axis limit is set to the default: the max value of the inputted image.
  • Figure 3: The selection space for the range of pixel intensities (x-values on the histogram) that the calculations are computed over. The text fields shown here are editable directly by clicking on them and typing in new values.
  • Figure 4: The cursor, circled in red on the histogram here, corresponds to the coordinates shown in the bottom right corner in a red box. The added red boxes and arrows indicate the connection between the cursor placement and the value displayed in the bottom right corner. Upon clicking at this coordinate, the lower bound of the intensity range would update to 61 (where the cursor is pointing), and this change would reflect in the selection space text box. (This figure is displayed in color in the online version of this paper.)
  • Figure 5: The calculation selection space. These text displays are not editable but they will update as the intensity range field is updated, either through directly entering into the fields or by clicking on the histogram.
  • ...and 4 more figures