Code covered by the BSD License  

Highlights from
GUI for Multivariate Image Analysis of 4-dimensional data

image thumbnail
from GUI for Multivariate Image Analysis of 4-dimensional data by Kateryna Artyushkova
Multivariate Image Analysis of 4-dimensional image sequences using 2-step two-way and three-way ...

[scores, load1, load2]=mcr_three_modes_pls(data,Ncomp);
function [scores, load1, load2]=mcr_three_modes_pls(data,Ncomp);
% function [scores, loads1, loads2]=mcr_three_modes_pls(data,Ncomp);
%
% function for calculating MCR results in three modes for multispectral
% image data set
% score images and loading profiles in 2 other modes are calculated using
% als_ka function;
% type help als_ka for help on type of MCR constraints used.
%
% created by K.Artyushkova
% kartyush@unm.edu
% December 2010

%% opening data
[n,m,p,q]=size(data);
data2=reshape(data,[n*m, p,q]);
%% setting up options for MCR
options=mcr('options');
options.display='off';
options.plots='none';
%options.alsoptions.ccon='none';
%options.alsoptions.scon='none';
options.alsoptions.display='off';

%% to get score images
data_row=reshape(data2,[n*m p*q]); 
H = progressbar('create', ['MCR'], ['wait while scores are calculated']);
model_im = mcr(data_row,Ncomp,options);
scores=reshape(model_im.loads{1},[n m Ncomp]);

%% to get profiles in mode 1
data_column1=reshape(data2, [n*m*q p]); %colomn-wise
progressbar('message', H, 'wait while loadings in mode 1 are calculated')
model_var1 = mcr(data_column1,Ncomp,options);
load1=model_var1.loads{2};

%% to get profiles in mode 2
  for i=1:p
    data_flip(:,:,:,i)=data(:,:,i,:);
  end
[n1,m1,p1,q1]=size(data_flip);
data2_f=reshape(data_flip,[n1*m1, p1,q1]);
data_column2=reshape(data2_f,[n1*m1*q1 p1]);
progressbar('message', H, 'wait while loadings in mode 1 are calculated')
model_var2 = mcr(data_column2,Ncomp,options);
load2=model_var2.loads{2};
progressbar('kill', H) 

%% plot results
H.Position=[761 43 285 577];
figure(H)
subplot(2,1,1)
plot(load1)
xlabel('variable1')
subplot(2,1,2)
plot(load2)
xlabel('variable2')
subplot(2,1,1)
title(['MCR results'])

H.Position=[479 43 276 577];
figure(H)
[a,b,c]=size(scores);
for i=1:c
    subplot(c,1,i)
    imagesc(scores(:,:,i)), colormap (gray)
end
subplot(c,1,1)
title(['MCR results'])

Contact us at files@mathworks.com