function hrf=hrf_filter(hrf);

% hrf is a matrix of 450 x #vox
  
RT=1; % 1 sec

Nyq = 1/(RT*2);	% Nyquist frequency in Hz


 %convert to % signal change
 %-------------------------
 %for i = 1:size(hrf,2)
 %hrf(:,i) = (hrf(:,i)-mean(hrf(:,i)))/mean(hrf(:,i));
 %end
 %hrf = hrf*100;


% Detrend by removing linear trend - separately for each session
% --------------------------------------------------------------
hrf = detrend(hrf);



% Low-pass filter the data using Butterworth filter
% --------------------------------------------------------------
	 cutoff = 1/8; %was24 	% HRF Hz cycle (~20s cycle or ~10s half-cycle)
	 order = 1;

	 [b,a] = butter(order,cutoff/Nyq);
	 hrf = filter(b,a,hrf);
	 

 % High-pass filter the data using Butterworth filter
    PoI = 100;
    cutoff = 1/PoI;	
	 order = 1;		
	 
    [b,a] = butter(order,cutoff/Nyq,'high');
	 hrf = filter(b,a,hrf);
