% Statistical and Computational Methods in Brain Image Analysis
% Chapter 02. Bernoulli Models for Binary Images
%
% (C) 2013 Moo K. Chung 
% University of Wisconsin-Madison
% mkchung@wisc.edu

%------------------------------------
% BINARY STROKE SEGMENTATION DATA
% If you are using this data set or codes, please reference the book


%The first and the second group images are respectively stored in 
%the directories  ../stroke/0 and ../stroke/1. You must go to that 
%directory or set up the path to run the following codes


g0 = dir('*.bmp')
n0=size(g0,1); % number of images in gorup 0 
group0=zeros(370,301,n0);

for i=1:n0
    fname= g0(i).name;
    f=imread(fname,'bmp'); %The segmented images  are in the bitmap format.
    group0(:,:,i) = double(f(:,:,1)/255);
end;

g1 = dir('*.bmp')
n1=size(g1,1);  % number of images in gorup 1 
group1=zeros(370,301,n1); 

for i=1:n1
    fname= g1(i).name;
    f=imread(fname,'bmp');
    group1(:,:,i) = double(f(:,:,1)/255);
end;

% sample proportion in each group
p0=mean(group0, 3); 
p1=mean(group1,3);

%
[pvalue Zvalue] = stat_proportion(group0, []); 
[pvalue Zvalue] = stat_proportion(group0, group1);




