The software written for the HISTPEAK application contains routines that generate a wide range of statistical quantities concerning the pixel values in an image. Clearly then, some users writing their own software might want to incorporate such routines into their own code. To make this easier to acheive the salient parts of HISTPEAK have been made into an application HSUB wherein HISTPEAK (in a slightly modified form) is called from the main subroutine. The subroutine called HISTPEAK2 should obtain values for all the quantities displayed by HISTPEAK (various modal pixel values, standard deviation, kurtosis, absolute deviation, number of bad pixels etc.) and these can be passed to the the main routine if required. HSUB as it stands allows you you to define which type of modal pixel value should be estimated (there are four to choose from — see HISTPEAK) and displayed, but this is merely intended to show how the routine HISTPEAK2 might be used.
The code is fully commented to make its use easier.