Rhist img

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search


Locates regions and calculates region-size histogram for an image.


[dx,dy,szmap] = rhist_img(im,options)


The region-size is defined the radius of the largest circle that will fit inside a given space. This function returns the histogram of region sizes for all spaces in an image. The histogram can be calculated for either the signal (positive values) or voids (zero-values) in an image and plotted as a function of radius, diameter, or area.

The algorithm used starts with thresholding the input image, followed by searching the image for the largest region which can be identified. Starting at that size, the regions into which the given radius circle can be inscribed are filled in. The radius is then decreased and the image is searched for the new size circle, repeating the fill-in process. This is continued until the smallest circle size is reached. The fill-in process can also be optionally "dilated" (see options) to help fill non-circular regions and avoid in-filling of edges with small circles.


  • im = grayscale image (spatial x spatial 2D image).


  • dy = vector of the estimated number of domains found at each domain sizes specified in dx.
  • dx = vector of the examined domain size radius, in pixels (see "units" option to change to other measures).
  • szmap = a "size map" of the same dimensions of the input image. Each domain is color-coded to indicate its relative size.


options = a structure array with the following fields:

  • plots : [ 'none' | 'detailed' |{'final'}] governs plots created by function. 'final' shows a histogram of domain sizes. 'detailed' includes histogram, original image, and a "size image" which shows the size of each region and its spatial location as a color-coded image.
  • units : [{'radius'}| 'diameter' | 'area' ] defines what units the measured areas should be reported in the plotted results.
  • space : [ 'void' | 'signal' ] governs whether the algorithm will search positive 'signal' space in which domains of interest are indicated by signal, or 'void' space, in which domains of interest are indicated by the lack of signal.
  • minsize : [2] governs the smallest size region to be identified in an image (as defined by the radius of the circle.)
  • stepsize : [0.5] interval for histogram resolution (in circle radius units - the inscribing circle is stepped down this number of units in each iteration)
  • pthreshold : [0.05] the maximum projection onto the circle which will still permit a region to be a "fit" to the circle.
  • imthreshold : [] the intensity threshold used to segregate between signal and void spaces. If empty, the median of all values is used as a threshold (unless the image is already thresholded into a binary image.)
  • dilatefill : [ 'off' |{'on'}] specifies whether the filled spaces should be dilated prior to marking region as accounted for. This allows for slightly better fill to non-circular regions without using additional "small" regions to fill in the edges. However, it also reduces the accuracy of the region count slightly.
  • buffer : [10] the number of pixels to add around the image to avoid spill-over of regions (necessary due to convolutions algorithm used)

See Also