%%mean_FA.m
% Get the mean FA value within mask(s)

%Select FA images
img = spm_select(inf,'image','Select FA images');

%Select mask images
msk = spm_select(inf,'image','Select mask images');

for j = 1:size(msk,1);
    roi = msk(j,:);

    for i = 1:size(img,1);
        data = spm_summarise(img(i,:),roi);
        output(i,j) = mean(data);
    end
    
end

%Save the result as a csv file
today = datestr(date);
filename = ['mean_FA_' today '.csv'];
csvwrite(filename,output);