<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _preprocess_input(test, ref, mask=None):
 """Wrapper to the metric Parameters ref : np.ndarray the reference image test : np.ndarray the tested image mask : np.ndarray, optional the mask for the ROI Notes ----- Compute the metric only on magnetude. Returns ------- ssim: float, the snr """


    test = np.abs(np.copy(test)).astype('float64')
    ref = np.abs(np.copy(ref)).astype('float64')
    test = min_max_normalize(test)
    ref = min_max_normalize(ref)

    if (not isinstance(mask, np.ndarray)) and (mask is not None):
        raise ValueError("mask should be None, or a np.ndarray,"
                         " got '{0}' instead.".format(mask))

    if mask is None:
        return test, ref, None

    return test, ref, mask