def METHOD_NAME(img, mask, bins=100, label=None):
    """Extract the temperature values of an object in an image.
    Inputs:
    thermal_img  = numpy array of thermal values
    mask         = Binary mask made from selected contours
    bins         = Number of histogram bins (default = 100)
    label        = optional label parameter, modifies the variable name of observations recorded
    Returns:
    thermal_img  = output image
    :param thermal_array: numpy.ndarray
    :param mask: numpy.ndarray
    :param bins: int
    :param label: str
    :return thermal_img: numpy.ndarray
    """
    # Store debug mode
    debug = params.debug
    # apply plant shaped mask to image and calculate statistics based on the masked image
    masked_thermal = img[np.where(mask > 0)]
    maxtemp = np.amax(masked_thermal)
    mintemp = np.amin(masked_thermal)
    avgtemp = np.average(masked_thermal)
    mediantemp = np.median(masked_thermal)
    # call the histogram function
    params.debug = None
    _, hist_data = histogram(img, mask=mask, bins=bins, hist_data=True)
    bin_labels, hist_percent = hist_data['pixel intensity'].tolist(), hist_data['proportion of pixels (%)'].tolist()
    # Store data into outputs class
    outputs.add_observation(sample=label, variable='max_temp', trait='maximum temperature',
                            method='plantcv.plantcv.analyze.thermal', scale='degrees', datatype=float,
                            value=maxtemp, label='degrees')
    outputs.add_observation(sample=label, variable='min_temp', trait='minimum temperature',
                            method='plantcv.plantcv.analyze.thermal', scale='degrees', datatype=float,
                            value=mintemp, label='degrees')
    outputs.add_observation(sample=label, variable='mean_temp', trait='mean temperature',
                            method='plantcv.plantcv.analyze.thermal', scale='degrees', datatype=float,
                            value=avgtemp, label='degrees')
    outputs.add_observation(sample=label, variable='median_temp', trait='median temperature',
                            method='plantcv.plantcv.analyze.thermal', scale='degrees', datatype=float,
                            value=mediantemp, label='degrees')
    outputs.add_observation(sample=label, variable='thermal_frequencies', trait='thermal frequencies',
                            method='plantcv.plantcv.analyze.thermal', scale='frequency', datatype=list,
                            value=hist_percent, label=bin_labels)
    # Restore user debug setting
    params.debug = debug
    return img