%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                   Data Import from Raw Source Files                    %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% DESCRIPTION
% This script performs the following procedures
% 1.- Define a data_folder where all the raw images are stored
% 2.- Import a low noise image from the file Capture One Catalog0463.tif
% 3.- Import a noisy image from the file Capture One Catalog0464.tif
% 4.- Import a noisy image from the file Capture One Catalog0462.tif
% 5.- Save the imported images into the file images.mat inside a data
%       folder.

% Author: David Villacis
% Editor: Santeri Kaupinm?ki (21/12/2016)
% Date: 25/10/2016
% Institution: University of Helsinki - MODEMAT (EPN)
% Version: 1

data_folder = 'data/original';

% IMPORT NOISY IMAGES
fname_clean = strcat(data_folder,'im_clean.tif');
im_clean = imread(fname_clean,'tif');
im_clean = double(im_clean);

fname_noise1 = strcat(data_folder,'im_noise1.tif');
im_noise1 = imread(fname_noise1,'tif');
im_noise1 = double(im_noise1);

fname_noise2 = strcat(data_folder,'im_noise2.tif');
im_noise2 = imread(fname_noise2,'tif');
im_noise2 = double(im_noise2);

fname_noise3 = strcat(data_folder,'im_noise3.tif');
im_noise3 = imread(fname_noise3,'tif');
im_noise3 = double(im_noise3);

% IMPORT NOISY IMAGES WITH SMALL BLUR
fname_blur1_noise1 = strcat(data_folder,'im_blur1_noise1.tif');
im_blur1_noise1 = imread(fname_blur1_noise1,'tif');
im_blur1_noise1 = double(im_blur1_noise1);

fname_blur1_noise2 = strcat(data_folder,'im_blur1_noise2.tif');
im_blur1_noise2 = imread(fname_blur1_noise2,'tif');
im_blur1_noise2 = double(im_blur1_noise2);

fname_blur1_noise3 = strcat(data_folder,'im_blur1_noise3.tif');
im_blur1_noise3 = imread(fname_blur1_noise3,'tif');
im_blur1_noise3 = double(im_blur1_noise3);

% IMPORT NOISY IMAGES WITH HEAVY BLUR
fname_blur2_noise1 = strcat(data_folder,'im_blur2_noise1.tif');
im_blur2_noise1 = imread(fname_blur2_noise1,'tif');
im_blur2_noise1 = double(im_blur2_noise1);

fname_blur2_noise2 = strcat(data_folder,'im_blur2_noise2.tif');
im_blur2_noise2 = imread(fname_blur2_noise2,'tif');
im_blur2_noise2 = double(im_blur2_noise2);

fname_blur2_noise3 = strcat(data_folder,'im_blur2_noise3.tif');
im_blur2_noise3 = imread(fname_blur2_noise3,'tif');
im_blur2_noise3 = double(im_blur2_noise3);

save('data/images.mat','im_clean','im_noise1','im_noise2','im_noise3',...
  'im_blur1_noise1','im_blur1_noise2','im_blur1_noise3',...
  'im_blur2_noise1','im_blur2_noise2','im_blur2_noise3');

%save('data/images_blur2.mat','im_clean','im_blur2_noise1','im_blur2_noise2','im_blur2_noise3');
