A method of determining a residue function in brain tissue, from medical images acquired after introducing contrast agent into the blood, correcting for contrast agent leakage into the tissue, comprising: a) providing time signals indicating contrast agent concentration for leaking voxels, a time signal indicating average contrast agent concentration for non-leaking voxels, and an artery input function, all derived from the images; b) fitting the leaking voxel signals to a model time signal with a free parameter for leakage rate, the model assuming that the concentration of contrast agent perfusing through a leaking voxel has a same shape as a function of time as the average contrast agent concentration for non-leaking voxels; c) using the best fit leakage rate parameter to make a correction for leakage to the leaking voxel signals; and d) deconvolving the corrected signals from the artery input function, to find the residue function.