The purpose of this study is to develop a fully automatic algorithm for determining a 'proper' arterial input function (AIF) that is critical in the deconvolution approach for cerebral perfusion quantification. We proposed using a fast gamma variate model (GVM) fitting strategy to scout the whole brain dynamic susceptibility contrast magnetic resonance imaging (DSC-MRI) dataset for AIF candidates. Goodness-of-fit criteria such as signal to noise ratios and GVM peak shapes were first used to screen out voxels of noisy signals and non-AIF-shaped concentration-time curves respectively. Last, qualified AIF candidates were ranked by bolus peak arrival time and peak width. Our method was tested by 10 DSC-MRI datasets: 5 adults (24-52 years of age) with stenosis or occlusion, and 5 youths (9-18 years of age) with moyamoya disease. The preliminary results indicated that the proposed algorithm was able to detect AIFs robustly and efficiently under 1 minute.