function [reconImg] = extractPsShow(img, frames, tsel, blockx, blocky, deltapsAll, b, warp, xindex, yindex)
% Created by Yuandong Tian, Oct. 5, 2009
% Email: yuandong@andrew.cmu.edu
% show the temporal structure of coefficients, and the reconstructed image

deltaps = deltapsAll(:, :, xindex, yindex);
xsel = blockx(xindex):blockx(xindex)+b.w-1;
ysel = blocky(yindex):blocky(yindex)+b.h-1;

warpPatch = cropWarp(warp, ysel, xsel, tsel);
p = proj(b, warpPatch);

deltapsCenter = deltaps - repmat(mean(deltaps, 2), [1, length(tsel)]);
reconImg = reconMean(frames(ysel, xsel, tsel), deltapsCenter, b);
meanImg = mean(frames(ysel, xsel, tsel), 3);
medianImg = median(frames(ysel, xsel, tsel), 3);

figure;
comparev_sqr(img(ysel, xsel), reconImg, meanImg, medianImg);
figure;
showPs(deltapsCenter, p, b.variances);