% This package contains 4 demos illustrating the use of SegSALSA
% segmentation algorithm introduced in
%
%   J. Bioucas-Dias, F. Condessa, and J. Kovacevic, "Alternating direction
%   optimization for image segmentation using hidden Markov measure field
%   models", in IS&T/SPIE Electronic Imaging, International Society for
%   Optics and Photonics,  pp. 90190P-90190P, February, 2014.
%
% The 4 demos implement the following steps:
%
%      1) generate an image Y of labels by sampling an MRF
%         Multilogistic Level prior
%
%      2) generate Gaussian feature vectors X(:,i), for i=1,...,n, such
%         that the pdf of  X(:,i) in indexed by Y(i). The particular pdf
%         depends on the demo
%
%      3) For each pixel, compute the likelihood of each class
%
%      4) Segment the  image using SegSALSA
%
%  Steps 2) and 3) are detailed below for  each demo:
%
%
% ----  demo1 -----------------------------------------------
%
% no_classes = 3;    Y(i) \in {1,2,3}
%
%   X(:,i) \sim N(M(Y(i)), \sigma^2*I), size(X(:,i)) = 1
%
%   M = 1: no_classes;
%
%   Likelihood:
%
%   p(X(:,i|y=k) = 1/sqrt(2*pi)*exp(-(X(:,i)-M(k)).^2/2/sigma^2);
%
%
% ----  demo2 -----------------------------------------------
%
% no_classes = 10;    Y(i) \in {1,2,3...,10}
%
%   X(:,i) \sim N(M(Y(i)), \sigma^2*I), size(X(:,i)) = 1
%
%   M = 1: no_classes;
%
%   Likelihood:
%
%   p(X(:,i|y=k) = 1/sqrt(2*pi)*exp(-(X(:,i)-M(k)).^2/2/sigma^2);
%
%
% ----  demo3 -----------------------------------------------
%
% no_classes = 10;    Y(i) \in {1,2,3...,10}
%
%   X(:,i) \sim N(M(:,Y(i)), \sigma^2*I), size(X(:,i)) = [200,1]
%
%   M -> isometric matrix (M'*M = eye(no_classes))
%
%   Likelihood:
%
%   p(X(:,i|y=k) = 1/sqrt(2*pi*sigma^2)^(L/2)*exp(-sum((X(:,i)-M(:,k)).^2/2/sigma^2));
%
% ----  demo4 -----------------------------------------------
%
% no_classes = 10;    Y(i) \in {1,2,3...,10}
%
%   X(:,i) = M*A(:,i) + N(:,i)
%
%   M is a [224,no_classes] matrix containing spectral signatures of
%   minerals. The angle between any two columns of M is greater or equal
%   to 10 degrees
%
%   Vectors A(:,i) follows a Dirichlet distribution with parameters
%   Theta = Theta(A(Y(i))). In this way  M*A(:,i) models a linear
%   mixture indexed by the class
%
%   N -> Gaussian noise with covariance \sigma^2*I
%
%   Likelihood:
%
%    p(X(:,i|y=k) \propto p(y=k|X(:,i|,w)  given by the MLR, where w is
%    the MLR  regression vector  learned by the LORSAL algorithm. The
%    explanatory variables are given by are kernel radial basis functions 
%
% 

