% Převzato od Ing. Ondřeje Macíčka Ph.D., ÚPT AV ČR

close all force
clear
clc

%% Načtení datasetu
% fileIn='b:\data\dce-mri\OSIPI\OurProcessing\P1v1_justnormalized\experiment1\conv\data.mat';
%fileIn = '/home/karela/data/StrokeRatBrain/batches/20190610_092401_190610_STROKE_RAT_BRAIN_AMCAO9_1_1__01/experiment1/conv/data.mat';
%fileIn = '/home/karela/data/StrokeRatBrain/batches/20190611_093556_190611_STROKE_RAT_BRAIN_AMCAO10_1_1_01/experiment1/conv/data.mat';
%fileIn = '/home/karela/data/StrokeRatBrain/batches/20190614_094953_20190614_Stroke_RAT_BRAIN_AMCAO12_1_1_01/experiment1/conv/data.mat';
%fileIn = '/home/karela/data/StrokeRatBrain/batches/20190821_092549_190821_STROKE_RAT_BRAIN_AMCAO14_1_1_01/experiment1/conv/data.mat';

fileIn = '/home/karela/data/StrokeRatBrain/batches/20200610_101545_AMCAO_AC05_1_1_20200610_101545_AMCAO_AC05_1_1_01/experiment1/conv/data.mat'
%fileIn = '/home/karela/data/StrokeRatBrain/batches/20200611_114511_AMCAO_AC08_1_1_20200611_114511_AMCAO_AC08_1_1_01/experiment1/conv/data.mat'
%fileIn = '/home/karela/data/StrokeRatBrain/batches/20200713_105447_AMCAO_AC10_1_1_20200713_105447_AMCAO_AC10_1_1_01/experiment1/conv/data.mat'

% fileIn= 'SyntheticEchoes_cartesian_reco';

load(fileIn);

%% Převod na 4D matici (x,y,z,čas)
nSlices=size(data2,1);
nSamples=size(data2,2);
[nRows,nCols]=size(data2{1,1});
data4D=zeros(nRows,nCols,nSlices,nSamples);
for sl=1:nSlices
    for t=1:nSamples
        data4D(:,:,sl,t)=imrotate(data2{sl,t},90);
    end
end

[aif,info]=FindAIF_ApproxAIF(data4D,info);
